source: cprs/branches/tmg-cprs/CPRS-Chart/Vitals/rVitals.pas@ 1376

Last change on this file since 1376 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

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