source: cprs/trunk/CPRS-Chart/Vitals/rVitals.pas@ 730

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

Initial Upload of Official WV CPRS 1.0.26.76

File size: 4.3 KB
RevLine 
[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
10unit rVitals;
11
12{$OPTIMIZATION OFF} // REMOVE AFTER UNIT IS DEBUGGED
13
14interface
15
16uses SysUtils, Classes, ORNet, ORFn;
17
18procedure SaveVitals(VitalList: TStringList);
19Procedure GetLastVital(Dest: TStrings; const PatientID: string); //*DFN*
20function VerifyVital(typ,rte,unt: String):boolean;
21function ValAndStoreVitals(VitalList: TStringList):string; //9/18/98
22Procedure GetVitalFromNoteIEN(Dest: TStrings; const PatientID: string; NoteIEN: Integer); //*DFN*
23Procedure GetVitalsFromEncDateTime(Dest: TStrings; const PatientID: string; datetime: TFMDateTime); //*DFN*
24procedure LoadUserVitalPreferences;
25procedure SaveUserVitalPreferences;
26function GetVList(Loc: integer): TStringList;
27
28var
29 uVitalsMetric: boolean = FALSE;
30 uVitCVPmmHg: boolean = FALSE;
31
32implementation
33
34var
35 uOldVitalsMetric: boolean = FALSE;
36 uOldVitCVPmmHg: boolean = FALSE;
37 uVitalList: TStringList = nil;
38 uLastVitalLoc: integer = -1;
39
40procedure SaveVitals(VitalList: TStringList);
41begin
42 CallV('ORWVITALS SAVE', [VitalList]);
43end;
44
45procedure GetLastVital(Dest: TStrings; const PatientID: string); //*DFN*
46var
47 IDString: String;
48begin
49 IDString := patientid; //*DFN*
50 CallV('ORQQVI VITALS', [IDString]);
51 Dest.assign(RPCBrokerV.Results);
52end;
53
54function VerifyVital(typ,rte,unt: String):boolean;
55begin
56 result := False;
57 CallV('ORQQVI2 VITALS RATE CHECK',[typ,rte,unt]);
58 if RPCBrokerV.results[0] = '1' then
59 result := True;
60end;
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////////////////////////////////////////////////////////////////////////////////
71function ValAndStoreVitals(VitalList: TStringList):string;
72begin
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);
79end;
80
81Procedure GetVitalFromNoteIEN(Dest: TStrings; const PatientID: string; NoteIEN: Integer); //*DFN*
82var
83 NoteIENStr,IDString: String;
84begin
85 IDString := patientid; //*DFN*
86 NoteIENStr := IntToStr(NoteIen);
87 CallV('ORQQVI NOTEVIT', [IDString, NoteIENStr]);
88 Dest.assign(RPCBrokerV.Results);
89end;
90
91Procedure GetVitalsFromEncDateTime(Dest: TStrings; const PatientID: string; DateTime: TFMDateTime); //*DFN*
92var
93 EncDate,IDString: String;
94begin
95 IDString := patientid; //*DFN*
96 EncDate := FloatToStr(DateTime);
97 CallV('ORQQVI VITALS', [IDString, EncDate]);
98 Dest.assign(RPCBrokerV.Results);
99end;
100
101procedure LoadUserVitalPreferences;
102var
103 Tmp: string;
104begin
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;
110end;
111
112procedure SaveUserVitalPreferences;
113var
114 P1, P2: string;
115
116begin
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]);
122end;
123
124function GetVList(Loc: integer): TStringList;
125var
126 GetList: boolean;
127
128begin
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;
144end;
145
146initialization
147
148finalization
149 KillObj(@uVitalList);
150
151end.
Note: See TracBrowser for help on using the repository browser.