[456] | 1 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //Modifed: 9/18/98
|
---|
| 3 | //By: Robert Bott
|
---|
| 4 | //Location: ISL
|
---|
| 5 | //Description of Mod:
|
---|
| 6 | // Changed function ValAndStoreVitals to return the string indicating the value
|
---|
| 7 | // that failed.
|
---|
| 8 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 9 |
|
---|
| 10 | unit rVitals;
|
---|
| 11 |
|
---|
| 12 | {$OPTIMIZATION OFF} // REMOVE AFTER UNIT IS DEBUGGED
|
---|
| 13 |
|
---|
| 14 | interface
|
---|
| 15 |
|
---|
| 16 | uses SysUtils, Classes, ORNet, ORFn;
|
---|
| 17 |
|
---|
| 18 | procedure SaveVitals(VitalList: TStringList);
|
---|
| 19 | Procedure GetLastVital(Dest: TStrings; const PatientID: string); //*DFN*
|
---|
| 20 | function VerifyVital(typ,rte,unt: String):boolean;
|
---|
| 21 | function ValAndStoreVitals(VitalList: TStringList):string; //9/18/98
|
---|
| 22 | Procedure GetVitalFromNoteIEN(Dest: TStrings; const PatientID: string; NoteIEN: Integer); //*DFN*
|
---|
| 23 | Procedure GetVitalsFromEncDateTime(Dest: TStrings; const PatientID: string; datetime: TFMDateTime); //*DFN*
|
---|
| 24 | procedure LoadUserVitalPreferences;
|
---|
| 25 | procedure SaveUserVitalPreferences;
|
---|
| 26 | function GetVList(Loc: integer): TStringList;
|
---|
| 27 |
|
---|
| 28 | var
|
---|
| 29 | uVitalsMetric: boolean = FALSE;
|
---|
| 30 | uVitCVPmmHg: boolean = FALSE;
|
---|
| 31 |
|
---|
| 32 | implementation
|
---|
| 33 |
|
---|
| 34 | var
|
---|
| 35 | uOldVitalsMetric: boolean = FALSE;
|
---|
| 36 | uOldVitCVPmmHg: boolean = FALSE;
|
---|
| 37 | uVitalList: TStringList = nil;
|
---|
| 38 | uLastVitalLoc: integer = -1;
|
---|
| 39 |
|
---|
| 40 | procedure SaveVitals(VitalList: TStringList);
|
---|
| 41 | begin
|
---|
| 42 | CallV('ORWVITALS SAVE', [VitalList]);
|
---|
| 43 | end;
|
---|
| 44 |
|
---|
| 45 | procedure GetLastVital(Dest: TStrings; const PatientID: string); //*DFN*
|
---|
| 46 | var
|
---|
| 47 | IDString: String;
|
---|
| 48 | begin
|
---|
| 49 | IDString := patientid; //*DFN*
|
---|
| 50 | CallV('ORQQVI VITALS', [IDString]);
|
---|
| 51 | Dest.assign(RPCBrokerV.Results);
|
---|
| 52 | end;
|
---|
| 53 |
|
---|
| 54 | function VerifyVital(typ,rte,unt: String):boolean;
|
---|
| 55 | begin
|
---|
| 56 | result := False;
|
---|
| 57 | CallV('ORQQVI2 VITALS RATE CHECK',[typ,rte,unt]);
|
---|
| 58 | if RPCBrokerV.results[0] = '1' then
|
---|
| 59 | result := True;
|
---|
| 60 | end;
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 64 | //Modifed: 9/18/98
|
---|
| 65 | //By: Robert Bott
|
---|
| 66 | //Location: ISL
|
---|
| 67 | //Description of Mod:
|
---|
| 68 | // Changed function ValAndStoreVitals to return the string indicating the value
|
---|
| 69 | // that failed.
|
---|
| 70 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 71 | function ValAndStoreVitals(VitalList: TStringList):string;
|
---|
| 72 | begin
|
---|
| 73 | CallV('ORQQVI2 VITALS VAL & STORE',[VitalList]);
|
---|
| 74 | if RPCBrokerV.results[0] >= '0' then
|
---|
| 75 | result := 'True' //stored ok
|
---|
| 76 | else
|
---|
| 77 | result := Piece(RPCBrokerV.results[1],U,2) + ': '+Piece(RPCBrokerV.results[1],U,3)+' Value: '+
|
---|
| 78 | Piece(RPCBrokerV.results[1],U,4);
|
---|
| 79 | end;
|
---|
| 80 |
|
---|
| 81 | Procedure GetVitalFromNoteIEN(Dest: TStrings; const PatientID: string; NoteIEN: Integer); //*DFN*
|
---|
| 82 | var
|
---|
| 83 | NoteIENStr,IDString: String;
|
---|
| 84 | begin
|
---|
| 85 | IDString := patientid; //*DFN*
|
---|
| 86 | NoteIENStr := IntToStr(NoteIen);
|
---|
| 87 | CallV('ORQQVI NOTEVIT', [IDString, NoteIENStr]);
|
---|
| 88 | Dest.assign(RPCBrokerV.Results);
|
---|
| 89 | end;
|
---|
| 90 |
|
---|
| 91 | Procedure GetVitalsFromEncDateTime(Dest: TStrings; const PatientID: string; DateTime: TFMDateTime); //*DFN*
|
---|
| 92 | var
|
---|
| 93 | EncDate,IDString: String;
|
---|
| 94 | begin
|
---|
| 95 | IDString := patientid; //*DFN*
|
---|
| 96 | EncDate := FloatToStr(DateTime);
|
---|
| 97 | CallV('ORQQVI VITALS', [IDString, EncDate]);
|
---|
| 98 | Dest.assign(RPCBrokerV.Results);
|
---|
| 99 | end;
|
---|
| 100 |
|
---|
| 101 | procedure LoadUserVitalPreferences;
|
---|
| 102 | var
|
---|
| 103 | Tmp: string;
|
---|
| 104 | begin
|
---|
| 105 | Tmp := sCallV('ORQQVI3 GETVPREF', []);
|
---|
| 106 | uVitalsMetric := (Piece(Tmp,U,1) = '1');
|
---|
| 107 | uVitCVPmmHg := (Piece(Tmp,U,2) = '1');
|
---|
| 108 | uOldVitalsMetric := uVitalsMetric;
|
---|
| 109 | uOldVitCVPmmHg := uVitCVPmmHg;
|
---|
| 110 | end;
|
---|
| 111 |
|
---|
| 112 | procedure SaveUserVitalPreferences;
|
---|
| 113 | var
|
---|
| 114 | P1, P2: string;
|
---|
| 115 |
|
---|
| 116 | begin
|
---|
| 117 | // Don't same same value loaded, since saving is at user level,
|
---|
| 118 | // and loading may be at a different level
|
---|
| 119 | if(uOldVitalsMetric = uVitalsMetric) then P1 := '' else P1 := BOOLCHAR[uVitalsMetric];
|
---|
| 120 | if(uOldVitCVPmmHg = uVitCVPmmHg) then P2 := '' else P2 := BOOLCHAR[uVitCVPmmHg];
|
---|
| 121 | CallV('ORQQVI3 SETVPREF', [P1, P2]);
|
---|
| 122 | end;
|
---|
| 123 |
|
---|
| 124 | function GetVList(Loc: integer): TStringList;
|
---|
| 125 | var
|
---|
| 126 | GetList: boolean;
|
---|
| 127 |
|
---|
| 128 | begin
|
---|
| 129 | GetList := TRUE;
|
---|
| 130 | if not assigned(uVitalList) then
|
---|
| 131 | uVitalList := TStringList.Create
|
---|
| 132 | else
|
---|
| 133 | if Loc = uLastVitalLoc then
|
---|
| 134 | GetList := FALSE;
|
---|
| 135 | if(GetList) then
|
---|
| 136 | begin
|
---|
| 137 | uLastVitalLoc := Loc;
|
---|
| 138 | CallV('ORQQVI3 GETVLIST', [Loc]);
|
---|
| 139 | if(RPCBrokerV.Results.Count > 0) then
|
---|
| 140 | RPCBrokerV.Results.Delete(0);
|
---|
| 141 | uVitalList.assign(RPCBrokerV.Results);
|
---|
| 142 | end;
|
---|
| 143 | Result := uVitalList;
|
---|
| 144 | end;
|
---|
| 145 |
|
---|
| 146 | initialization
|
---|
| 147 |
|
---|
| 148 | finalization
|
---|
| 149 | KillObj(@uVitalList);
|
---|
| 150 |
|
---|
| 151 | end.
|
---|