unit class_measure;

interface

uses SysUtils, Classes, Dialogs, DataUnit, ConstUnit, DB,
     check_user_data, user_types, class_point, class_counted_values, class_diagnoz,
     class_basics;

type
  TRDMeasure = class (TObject)
    private
      ID:             string;             //порядковый номер
      date:           string;             //дата
      description:    string;             //описание измерения

    //информация о пациенте
      patinent_id:          string;
      patinent_sirname:     string;
      patinent_first_name:  string;
      patinent_middle_name: string;

      function Set_measure_id( in_measure_id: string ): boolean;
      function Set_measure_date( in_measure_date: string ): boolean;
      function Set_measure_opisanie( in_measure_description: string ): boolean;

      function Set_measure_patient_id( in_patient_id:string ): boolean;
      function Set_measure_patient_sirname( in_patient_sirname: string ): boolean;
      function Set_measure_patient_first_name( in_patient_first_name: string ): boolean;
      function Set_measure_patient_middle_name( in_patient_middle_name: string ): boolean;

    public
      initial_values: TRDPointList;
      counted_values: TRDCounted_Values;
      diagnoz:        TRDMeasure_diagnoz;

      //функция установки информации об измерении
      //функция установки информации о пациенте

      constructor Create;  virtual;
      destructor  Destroy; override;

end;


implementation

constructor TRDMeasure.Create;
begin
  inherited Create;
  initial_values := TRD_List.Create();
  counted_values := TRDCounted_Values.Create;
  diagnoz := TRDMeasure_diagnoz.Create;
  with self do
  begin
    ID := '';
    date := '';
    description := '';
    patinent_id := '';
    patinent_sirname := '';
    patinent_first_name := '';
    patinent_middle_name := '';
  end;
end;
destructor TRDMeasure.Destroy;
begin
  initial_values.Free;
  counted_values.Free;
  diagnoz.Free;
  with self do
    begin
      ID := '';
      date := '';
      description := '';
      patinent_id := '';
      patinent_sirname := '';
      patinent_first_name := '';
      patinent_middle_name := '';
    end;
   inherited Destroy;;
end;

function TRDMeasure.Set_measure_id( in_measure_id: string ): boolean;
begin
Assert( ( ( in_measure_id <> '' ) and ( strtoint(in_measure_id)>0 ) ),
        'Входное поле ID измерения класса RDMeasure недопустимо!'+'{B8FFAE03-5A34-4A02-937F-2AF5003C6717}');
  self.ID := in_measure_id;
  result := true;
end;

function TRDMeasure.Set_measure_date( in_measure_date: string ): boolean;
begin
Assert( ( in_measure_date <> '' ) ,
        'Входное поле Date измерения класса RDMeasure недопустимо!'+'{EFCE36FB-9E58-4437-9492-856026C3105C}');
  try
    strtodate( in_measure_date );
  finally
    self.date := in_measure_date;
    result := true; 
  end;
end;

function TRDMeasure.Set_measure_opisanie( in_measure_description: string ): boolean;
begin
  self.description := in_measure_description;
  result := true;
end;

function TRDMeasure.Set_measure_patient_id( in_patient_id: string ): boolean;
begin
Assert( ( ( in_patient_id <> '' ) and ( strtoint( in_patient_id ) > 0 ) ),
        'Входное поле ID пациента класса RDMeasure недопустимо!'+'{7D3EA97C-93FB-41EC-A8CB-2E7FA500F2E2}');
  self.ID := in_patient_id;
end;

function TRDMeasure.Set_measure_patient_sirname( in_patient_sirname: string ): boolean;
begin

end;

function TRDMeasure.Set_measure_patient_first_name( in_patient_first_name: string ): boolean;
begin

end;

function TRDMeasure.Set_measure_patient_middle_name( in_patient_middle_name: string ): boolean;
begin

end;


end.
