source: cprs/branches/tmg-cprs/CPRS-Chart/Vitals/uVitals.pas@ 1623

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 25.4 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit uVitals;
3{ Old class TVital currently not used - commented out at bottom of unit }
4
5interface
6
7uses
8 SysUtils, Dialogs, Controls, Windows, Classes, ORClasses, ORCtrls, ORFn, Forms,
9 DKlang, //kt
10 TRPCB
11 ;
12
13//const
14// NoVitalOverrideValue = '^None^';
15function NoVitalOverrideValue : string; //kt
16
17
18type
19 TVitalType = (vtUnknown, vtTemp, vtPulse, vtResp, vtBP, vtHeight, vtWeight, vtPain,
20 vtPO2, vtCVP, vtCircum);
21 TValidVitalTypes = vtTemp..vtCircum;
22
23procedure InitPainCombo(cboPain: TORComboBox);
24procedure ConvertVital(VType: TVitalType; var VValue, VUnit: string);
25function GetVitalStr(VType: TVitalType; rte, unt, UserStr, DateStr: string): string;
26function GetVitalUser: string;
27procedure AssignVitals2List(List: TStrings; ADateTime: TFMDateTime;
28 ALocation, ABP, ATemp, ATempUnits,
29 AResp, APulse, AHeight, AHeightUnits,
30 AWeight, AWeightUnits, APain: string);
31//kt function VitalInvalid(VitalControl: TControl; UnitsControl: TControl = nil;
32//kt OverrideValue: string = NoVitalOverrideValue): boolean;
33function VitalInvalid(VitalControl: TControl; UnitsControl: TControl = nil;
34 OverrideValue: string = 'x'): boolean;
35function VitalControlTag(VType: TVitalType; UnitControl: boolean = FALSE): integer;
36function ConvertHeight2Inches(Ht: string): string;
37function FormatVitalForNote(VitalStr: string):String;
38function ConvertVitalData(const Value: string; VitalType: TVitalType; UnitType: string = ''): string;
39procedure VitalsFrameCreated(Frame: TFrame);
40procedure SetVitalsMetric(const Value: boolean);
41procedure SetVitCVPmmHg(const Value: boolean);
42function ValidVitalsDate(var ADate: TFMDateTime; SkipFirst: boolean = FALSE; Show: boolean = true): boolean;
43function IsNumericWeight(const x: string): Boolean;
44procedure CloseVitalsDLL;
45
46const
47 VitalPCECodes: array[TValidVitalTypes] of string =
48 { vtTemp } ('TMP',
49 { vtPulse } 'PU',
50 { vtResp } 'RS',
51 { vtBP } 'BP',
52 { vtHeight } 'HT',
53 { vtWeight } 'WT',
54 { vtPain } 'PN',
55 { vtPO2 } 'PO2',
56 { vtCVP } 'CVP',
57 { vtCircum } 'CG');
58
59
60 VitalCodes: array[TValidVitalTypes] of string =
61 { vtTemp } ('T',
62 { vtPulse } 'P',
63 { vtResp } 'R',
64 { vtBP } 'BP',
65 { vtHeight } 'HT',
66 { vtWeight } 'WT',
67 { vtPain } 'PN',
68 { vtPO2 } 'PO2',
69 { vtCVP } 'CVP',
70 { vtCircum } 'CG');
71
72 TAG_VITTEMP = 2;
73 TAG_VITPULSE = 4;
74 TAG_VITRESP = 3;
75 TAG_VITBP = 1;
76 TAG_VITHEIGHT = 5;
77 TAG_VITWEIGHT = 6;
78 TAG_VITTEMPUNIT= 7;
79 TAG_VITHTUNIT = 8;
80 TAG_VITWTUNIT = 9;
81 TAG_VITPAIN = 10;
82 TAG_VITDATE = 11;
83
84 VitalDateStr = 'VST^DT^';
85 VitalPatientStr = 'VST^PT^';
86 VitalLocationStr = 'VST^HL^';
87
88 SHARE_DIR = '\VISTA\Common Files\';
89 GMV_CONTEXT = 'OR CPRS GUI CHART';
90 GMV_APP_SIGNATURE = 'CPRS';
91 GMV_DEFAULT_TEMPLATE = '';
92
93type
94 VitalTags = TAG_VITBP..TAG_VITPAIN;
95
96 TGMV_VitalsEnterForm = function(
97 aBroker:TRPCBroker;
98 aPatient, aLocation, aTemplate,aSignature:String;
99 aDateTime:TDateTime): TCustomForm; stdcall;
100
101 TGMV_VitalsEnterDLG = function(
102 aBroker:TRPCBroker;
103 aDFN, aLocation, aTemplate,aSignature:String;
104 aDateTime:TDateTime;
105 aName,anInfo:String): Integer; stdcall;
106
107 TGFM_VitalsViewDLG = function(
108 aBroker:TRPCBroker;
109 aDFN, aLocation,
110 DateStart, DateStop,
111 aSignature,
112 aContextIn,aContextOut,
113 aName,anInfo,aHospitalName:String): Integer; stdcall;
114
115 TGMV_VitalsViewForm = function(
116 aBroker:TRPCBroker;
117 aDFN, aLocation,
118 DateStart, DateStop,
119 aSignature,
120 aContextIn,aContextOut,
121 aName,anInfo,
122 aDynamicParameter {HospitolName^Vital Type Abbreviation} :String): TCustomForm; stdcall;
123
124 TGMV_LatestVitalsList = function (
125 aBroker:TRPCBroker;
126 aDFN,
127 aDelim:String;
128 bSilent:Boolean
129 ): TStringList; stdcall;
130
131 TGMV_VitalsExit = Procedure;
132
133var
134 VitalsDLLHandle : THandle;
135 DLLForceClose : Boolean = False;
136
137
138const
139 VitalTagSet = [TAG_VITBP..TAG_VITPAIN];
140 VitalDateTagSet = [TAG_VITBP..TAG_VITDATE];
141
142 VitalTagCodes: array[VitalTags] of TVitalType =
143 { TAG_VITBP } (vtBP,
144 { TAG_VITTEMP } vtTemp,
145 { TAG_VITRESP } vtResp,
146 { TAG_VITPULSE } vtPulse,
147 { TAG_VITHEIGHT } vtHeight,
148 { TAG_VITWEIGHT } vtWeight,
149 { TAG_VITTEMPUNIT } vtTemp,
150 { TAG_VITHTUNIT } vtHeight,
151 { TAG_VITWTUNIT } vtWeight,
152 { TAG_VITPAIN } vtPain);
153
154(* //kt replace with a function below
155 VitalDesc: array[TVitalType] of string =
156 { vtUnknown } ('Unknown',
157 { vtTemp } 'Temperature',
158 { vtPulse } 'Pulse',
159 { vtResp } 'Respiration',
160 { vtBP } 'Blood Pressure',
161 { vtHeight } 'Height',
162 { vtWeight } 'Weight',
163 { vtPain } 'Pain Score',
164 { vtPO2 } 'Pulse Oximetry',
165 { vtCVP } 'Central Venous Pressure',
166 { vtCircum } 'Circumference/Girth');
167
168 VitalFormatedDesc: array[TValidVitalTypes] of string =
169 { vtTemp } ('Temperature ',
170 { vtPulse } 'Pulse ',
171 { vtResp } 'Resp ',
172 { vtBP } 'Blood Press. ',
173 { vtHeight } 'Height ',
174 { vtWeight } 'Weight ',
175 { vtPain } 'Pain Scale. ',
176 { vtPO2 } 'Pulse Ox. ',
177 { vtCVP } 'Cnt Vns Pres ',
178 { vtCircum } 'Circum/Girth ');
179*)
180
181 vnumType = 2;
182 vnumValue = 3;
183 vnumDate = 4;
184
185
186function VitalDesc(index : TVitalType): string; //kt
187function VitalFormatedDesc (index: TValidVitalTypes): string; //kt
188
189implementation
190
191uses
192 uCore, rCore, rVitals, Contnrs, mVitBase, mVitMetric, fVitalsDate;
193
194var
195 uVitalFrames: TComponentList = nil;
196
197//kt 8-17-07 added to replace array with function to allow just-in-time translation
198function NoVitalOverrideValue : string; //kt
199begin Result := '^'+DKLangConstW('uVitals_None')+'^';
200end;
201
202//kt 8-17-07 added to replace array with function to allow just-in-time translation
203function VitalDesc(index : TVitalType): string;
204begin
205 Result := '';
206 case index of
207 vtUnknown: Result := DKLangConstW('uVitals_Unknown');
208 vtTemp : Result := DKLangConstW('uVitals_Temperature');
209 vtPulse : Result := DKLangConstW('uVitals_Pulse');
210 vtResp : Result := DKLangConstW('uVitals_Respiration');
211 vtBP : Result := DKLangConstW('uVitals_Blood_Pressure');
212 vtHeight : Result := DKLangConstW('uVitals_Height');
213 vtWeight : Result := DKLangConstW('uVitals_Weight');
214 vtPain : Result := DKLangConstW('uVitals_Pain_Score');
215 vtPO2 : Result := DKLangConstW('uVitals_Pulse_Oximetry');
216 vtCVP : Result := DKLangConstW('uVitals_Central_Venous_Pressure');
217 vtCircum : Result := DKLangConstW('uVitals_CircumferencexGirth');
218 end; {case}
219end;
220
221function VitalFormatedDesc (index: TValidVitalTypes): string;
222begin
223 Result :='';
224 case index of
225 vtTemp : Result := DKLangConstW('uVitals_Temperature');
226 vtPulse : Result := DKLangConstW('uVitals_Pulse');
227 vtResp : Result := DKLangConstW('uVitals_Resp');
228 vtBP : Result := DKLangConstW('uVitals_Blood_Pressx');
229 vtHeight : Result := DKLangConstW('uVitals_Height');
230 vtWeight : Result := DKLangConstW('uVitals_Weight');
231 vtPain : Result := DKLangConstW('uVitals_Pain_Scalex');
232 vtPO2 : Result := DKLangConstW('uVitals_Pulse_Oxx');
233 vtCVP : Result := DKLangConstW('uVitals_Cnt_Vns_Pres');
234 vtCircum : Result := DKLangConstW('uVitals_CircumxGirth');
235 end; {case}
236end;
237
238
239procedure CloseVitalsDLL;
240var
241 VitalsExit : TGMV_VitalsExit;
242begin
243 if VitalsDLLHandle <> 0 then
244 begin
245 @VitalsExit := GetProcAddress(VitalsDLLHandle,PChar('GMV_VitalsExit'));
246 if assigned(VitalsExit) then
247 VitalsExit();
248 DLLForceClose := True;
249 end;
250end;
251
252function VitalErrorText(VType: TVitalType): string;
253begin
254 case VType of
255 vtTemp, vtHeight, vtWeight:
256// Result := '- check rate and unit.'; <-- original line. //kt 8/8/2007
257 Result := DKLangConstW('uVitals_x_check_rate_and_unitx'); //kt added 8/8/2007
258 else
259// Result := 'reading entered.'; <-- original line. //kt 8/8/2007
260 Result := DKLangConstW('uVitals_reading_enteredx'); //kt added 8/8/2007
261 end;
262//Result := 'Invalid ' + VitalDesc[VType] + ' ' + Result; <-- original line. //kt 8/8/2007
263 Result := DKLangConstW('uVitals_Invalid') + VitalDesc(VType) + ' ' + Result; //kt added 8/8/2007
264end;
265
266procedure InitPainCombo(cboPain: TORComboBox);
267begin
268 cboPain.Items.Clear;
269//cboPain.Items.Add('0^ - no pain'); <-- original line. //kt 8/8/2007
270 cboPain.Items.Add('0^'+DKLangConstW('uVitals___x_no_pain')); //kt added 8/8/2007
271//cboPain.Items.Add('1^ - slightly uncomfortable'); <-- original line. //kt 8/8/2007
272 cboPain.Items.Add('1^'+DKLangConstW('uVitals___x_slightly_uncomfortable')); //kt added 8/8/2007
273 cboPain.Items.Add('2^');
274 cboPain.Items.Add('3^');
275 cboPain.Items.Add('4^');
276 cboPain.Items.Add('5^');
277 cboPain.Items.Add('6^');
278 cboPain.Items.Add('7^');
279 cboPain.Items.Add('8^');
280 cboPain.Items.Add('9^');
281//cboPain.Items.Add('10^ - worst imaginable'); <-- original line. //kt 8/8/2007
282 cboPain.Items.Add('10^'+DKLangConstW('uVitals___x_worst_imaginable')); //kt added 8/8/2007
283//cboPain.Items.Add('99^ - unable to respond'); <-- original line. //kt 8/8/2007
284 cboPain.Items.Add('99^'+DKLangConstW('uVitals__x_unable_to_respond')); //kt added 8/8/2007
285end;
286
287procedure ConvertVital(VType: TVitalType; var VValue, VUnit: string);
288begin
289 case VType of
290 vtTemp: if(VUnit = 'C') then //if metric, convert to standard
291 begin
292 if StrToFloat(VValue) > 0 then
293 //VValue := FloatToStr(StrToFloat(VValue) * 9.0 / 5.0 +32.0);
294 VValue := FloatToStr(Round((StrToFloat(VValue) * 9.0 / 5.0 +32.0)*100)/100);
295 VUnit := 'F';
296 end;
297
298 vtHeight: if VUnit = 'CM' then
299 begin
300 if StrToFloat(VValue) > 0 then
301 //VValue := FloatToStr(StrtoFloat(VValue) / 2.54);
302 VValue := FloatToStr(Round((StrtoFloat(VValue) / 2.54)*1000)/1000);
303 VUnit := 'IN';
304 end;
305
306 vtWeight: if VUnit = 'KG' then
307 begin
308 if StrToFloat(VValue) > 0 then
309 //VValue := FloatToStr(StrtoFloat(VValue) * 2.2046);
310 //
311 // the vitals package uses 2.2 (not 2.2046), so the GUI needs to use the
312 // same so conversions back & forth don't lead to errors
313 // this probably shouldn't even be done here - it should be done by the
314 // vitals package - KCM
315 //
316 VValue := FloatToStr(Round(StrtoFloat(VValue) * 2.2{046} *1000)/1000);
317 VUnit := 'LB';
318 end;
319 end;
320end;
321
322function GetVitalStr(VType: TVitalType; rte, unt, UserStr, DateStr: string): string;
323begin
324 Result := '';
325 ConvertVital(VType, rte, unt);
326 if rte <> '' then
327 begin
328 if(VType = vtPain) then unt := U;
329 Result := 'VIT'+U+VitalPCECodes[VType]+U+U+U+rte+U+UserStr+U+unt+U+DateStr;
330 end;
331end;
332
333function GetVitalUser: string;
334var
335 UserID: Int64;
336
337begin
338 UserID := Encounter.Provider;
339 if UserID <= 0 then
340 UserID := User.DUZ;
341 Result := IntToStr(UserID);
342end;
343
344procedure AssignVitals2List(List: TStrings; ADateTime: TFMDateTime;
345 ALocation, ABP, ATemp, ATempUnits,
346 AResp, APulse, AHeight, AHeightUnits,
347 AWeight, AWeightUnits, APain: string);
348var
349 UserStr, DateStr: string;
350
351 procedure AddVital(VType: TVitalType; ARte: string; AUnit: string = '');
352 var
353 VStr: string;
354
355 begin
356 VStr := GetVitalStr(VType, ARte, AUnit, UserStr, DateStr);
357 if(VStr <> '') then
358 List.Add(VStr);
359 end;
360
361begin
362 with List do
363 begin
364 UserStr := GetVitalUser;
365 DateStr := FloatToStr(ADateTime);
366 clear;
367
368 Add(VitalDateStr + DateStr);
369 Add(VitalPatientStr + Patient.DFN); // encounter Patient //*DFN*
370 Add(VitalLocationStr + ALocation);
371 AddVital(vtBP, ABP); // Blood Pressure
372 AddVital(vtTemp, ATemp, ATempUnits); // Temperature
373 AddVital(vtResp, AResp); // Resp
374 AddVital(vtPulse, APulse); // Pulse
375 AddVital(vtHeight, AHeight, AHeightUnits); // Height
376 AddVital(vtWeight, AWeight, AWeightUnits); // Weight
377 AddVital(vtPain, APain); // Pain
378 end;
379end;
380
381//kt function VitalInvalid(VitalControl: TControl; UnitsControl: TControl = nil;
382//kt OverrideValue: string = NoVitalOverrideValue): boolean;
383function VitalInvalid(VitalControl: TControl; UnitsControl: TControl = nil;
384 OverrideValue: string = 'x'): boolean;
385var
386 rte, unt: string;
387 Tag: integer;
388 VType: TVitalType;
389
390begin
391 Tag := -1;
392 if OverrideValue='x' then OverrideValue := NoVitalOverrideValue; //kt added
393 if(OverrideValue = NoVitalOverrideValue) then
394 begin
395 if(assigned(VitalControl)) then
396 begin
397 rte := TORExposedControl(VitalControl).Text;
398 Tag := VitalControl.Tag;
399 end
400 else
401 rte := '';
402 end
403 else
404 begin
405 rte := OverrideValue;
406 if(assigned(VitalControl)) then
407 Tag := VitalControl.Tag;
408 end;
409
410 if(assigned(UnitsControl)) then
411 begin
412 unt := TORExposedControl(UnitsControl).Text;
413 if(Tag < 0) then
414 Tag := UnitsControl.Tag;
415 end
416 else
417 unt := '';
418
419 if(Tag >= low(VitalTags)) and (Tag <= high(VitalTags)) then
420 VType := VitalTagCodes[Tag]
421 else
422 VType := vtUnknown;
423 //pain does not need to be validated because the combo box limits the selection.
424 if(VType = vtPain) then
425 Result := FALSE
426 else
427 begin
428 Result := TRUE;
429 if(VType <> vtUnknown) then
430 begin
431 if (rte = '') then
432 Result := FALSE
433 else
434 if (VerifyVital(VitalPCECodes[VType],rte,unt) = True) then
435 Result := FALSE;
436 end;
437 end;
438 // GRE 2/12/03 added to disallow user entering "lb" with weight NOIS MWV-0103-22037
439 if VType = vtWeight then
440 begin
441 if (IsNumericWeight(rte) = FALSE) then
442 Result := True;
443 end;
444 if(Result) then
445 ShowMessage(VitalErrorText(VType));
446end;
447
448function VitalControlTag(VType: TVitalType; UnitControl: boolean = FALSE): integer;
449var
450 i,cnt: integer;
451
452begin
453 if UnitControl then
454 cnt := 0
455 else
456 cnt := 1;
457 Result := -1;
458 for i := low(VitalTags) to high(VitalTags) do
459 begin
460 if(VitalTagCodes[i] = VType) then
461 begin
462 inc(cnt);
463 if(cnt = 2) then
464 begin
465 Result := i;
466 break;
467 end;
468 end;
469 end;
470end;
471
472function ConvertHeight2Inches(Ht: string): string;
473var
474 c: char;
475 i: integer; //counter
476 inchstr,feetstr : string;
477 feet: boolean;
478 v: double;
479
480begin
481 feet := False;
482 result := '';
483 feetstr := '';
484 inchstr := '';
485
486 // check for feet
487 for i := 1 to (length(Ht)) do
488 begin
489 c := Ht[i];
490 if (c = '''') then feet := True;
491 end;
492
493 if (feet = True) then
494 begin
495 i := 1;
496 while (Ht[i] <> '''') do
497 begin
498 if (Ht[i] in ['0'..'9']) or (Ht[i] = '.') then
499 feetstr := feetstr + Ht[i];
500 inc(i);
501 end;
502 while (i <= length(Ht)) and (Ht[i] <> '"') and
503 (Ht[i] <> '') do
504 begin
505 if (Ht[i] in ['0'..'9']) or (Ht[i] = '.') then
506 inchstr := inchstr + Ht[i];
507 inc(i);
508 end;
509 v := 0;
510 if (feetstr <> '') then
511 v := v + (StrTofloat(feetstr)*12);
512 if(inchstr <> '') then
513 v := v + StrToFloat(inchstr);
514 result := floatToStr(v);
515 //add here to convert to CM if CM is the unit
516
517 end
518 else //no feet
519 begin
520 for i := 1 to (length(Ht)) do
521 begin
522 c := Ht[i]; //first character
523 if (c in ['0'..'9']) or (c = '.') then
524 result := result + c;
525 if (c = '"') then break;
526 end;
527 end;
528end;
529
530{
5311215^T^98.6^2991108.11^98.6 F^(37.0 C)
5321217^P^70^2991108.11^70
5331216^R^18^2991108.11^18
5341214^BP^120/70^2991108.11^120/70
5351218^HT^70^2991108.11^70 in^(177.8 cm)
5361219^WT^200^2991108.11^200 lb^(90.0 kg)
5371220^PN^1^2991108.11^1
538}
539 //format string as it should appear on the PCE panel.
540function FormatVitalForNote(VitalStr: string):String;
541var
542 Code, Value: string;
543 v: TVitalType;
544
545begin
546 Code := UpperCase(Piece(VitalStr, U, vnumType));
547 for v := low(TValidVitalTypes) to high(TValidVitalTypes) do
548 begin
549 if(Code = VitalCodes[v]) then
550 begin
551 Value := ConvertVitalData(Piece(VitalStr, U, vnumValue), v);
552 if(v = vtPain) and (Value = '99') then
553// Value := 'Unable to respond.'; <-- original line. //kt 8/8/2007
554 Value := DKLangConstW('uVitals_Unable_to_respondx'); //kt added 8/8/2007
555 //kt Result := VitalFormatedDesc[v] + Value + ' ' +
556 Result := VitalFormatedDesc(v) + Value + ' ' +
557 FormatFmDateTime('mmm dd,yyyy hh:nn',(StrToFloat(Piece(VitalStr, U, vnumDate))));
558 end
559 end;
560end;
561
562function ConvertVitalData(const Value: string; VitalType: TVitalType; UnitType: string = ''): string;
563var
564 dbl: Double;
565
566begin
567 Result := Value;
568 if(VitalType in [vtTemp, vtHeight, vtWeight]) then
569 begin
570 try
571 dbl := StrToFloat(Value);
572 except
573 on EConvertError do
574 dbl := 0
575 else
576 raise;
577 end;
578 if(dbl <> 0) then
579 begin
580 UnitType := UpperCase(UnitType);
581 case VitalType of
582 vtTemp:
583 begin
584 if(UnitType = 'C') then
585 begin
586 dbl := dbl * (9/5);
587 dbl := dbl + 32;
588 dbl := round(dbl * 10) / 10;
589 Result := FloatToStr(dbl) + ' F (' + Result + ' C)';
590 end
591 else
592 begin
593 dbl := dbl - 32;
594 dbl := dbl * (5/9);
595 dbl := round(dbl * 10) / 10;
596 Result := Result + ' F (' + FloatToStr(dbl) + ' C)';
597 end;
598 end;
599
600 vtHeight:
601 begin
602 if(UnitType = 'CM') then
603 begin
604 dbl := dbl / 2.54;
605 dbl := round(dbl * 10) / 10;
606 Result := FloatToStr(dbl) + ' in [' + Result + ' cm)';
607 end
608 else
609 begin
610 dbl := dbl * 2.54;
611 dbl := round(dbl * 10) / 10;
612 Result := Result + ' in [' + FloatToStr(dbl) + ' cm)';
613 end;
614 end;
615
616 vtWeight:
617 begin
618 if(UnitType = 'KG') then
619 begin
620 dbl := dbl * 2.2;
621 dbl := round(dbl * 10) / 10;
622 Result := FloatToStr(dbl) + ' lb (' + Result + ' kg)';
623 end
624 else
625 begin
626 dbl := dbl / 2.2;
627 dbl := round(dbl * 10) / 10;
628 Result := Result + ' lb (' + FloatToStr(dbl) + ' kg)';
629 end;
630 end;
631 end;
632 end;
633 end;
634end;
635
636procedure VitalsFrameCreated(Frame: TFrame);
637begin
638 if not assigned(uVitalFrames) then
639 uVitalFrames := TComponentList.Create(FALSE);
640 uVitalFrames.Add(Frame);
641end;
642
643procedure SetVitalsMetric(const Value: boolean);
644var
645 i: integer;
646
647begin
648 if(uVitalsMetric <> Value) then
649 begin
650 uVitalsMetric := Value;
651 for i := 0 to uVitalFrames.Count-1 do
652 begin
653 if uVitalFrames[i] is TfraVitBase then
654 TfraVitBase(uVitalFrames[i]).VitalsMetricChanged
655 else
656 if uVitalFrames[i] is TfraVitMetric then
657 TfraVitMetric(uVitalFrames[i]).VitalsMetricChanged
658 end;
659 end;
660end;
661
662procedure SetVitCVPmmHg(const Value: boolean);
663var
664 i: integer;
665
666begin
667 if(uVitCVPmmHg <> Value) then
668 begin
669 uVitCVPmmHg := Value;
670 for i := 0 to uVitalFrames.Count-1 do
671 if uVitalFrames[i] is TfraVitBase then
672 TfraVitBase(uVitalFrames[i]).VitalsCVPUnitsChanged;
673 end;
674end;
675
676
677function ValidVitalsDate(var ADate: TFMDateTime; SkipFirst: boolean = FALSE; Show: boolean = true): boolean; //AGP Change 26.1
678var
679 frmVitalsDate: TfrmVitalsDate;
680 ok: boolean;
681
682begin
683 Result := TRUE;
684 while (Result and (SkipFirst or (ADate > FMNow))) do
685 begin
686 if(SkipFirst) then
687 begin
688 ok := TRUE;
689 SkipFirst := FALSE;
690 end
691 else
692// ok := (InfoBox('Vital sign Date/Time entered (' + FormatFMDateTime('mmm dd yyyy hh:nn', ADate) + <-- original line. //kt 8/8/2007
693 ok := (InfoBox(DKLangConstW('uVitals_Vital_sign_DatexTime_entered_x') + FormatFMDateTime(DKLangConstW('uVitals_mmm_dd_yyyy_hhxnn'), ADate) + //kt added 8/8/2007
694// ') cannot be in the future.' + CRLF + <-- original line. //kt 8/8/2007
695 DKLangConstW('uVitals_x_cannot_be_in_the_futurex') + CRLF + //kt added 8/8/2007
696// 'If you do not change the entered date/time vitals information will be lost.' + CRLF + <-- original line. //kt 8/8/2007
697 DKLangConstW('uVitals_If_you_do_not_change_the_entered_datextime_vitals_information_will_be_lostx') + CRLF + //kt added 8/8/2007
698// 'Do you want to enter a new Date/Time?', <-- original line. //kt 8/8/2007
699 DKLangConstW('uVitals_Do_you_want_to_enter_a_new_DatexTimex'), //kt added 8/8/2007
700// 'Invalid Vital Entry Date/Time', <-- original line. //kt 8/8/2007
701 DKLangConstW('uVitals_Invalid_Vital_Entry_DatexTime'), //kt added 8/8/2007
702 MB_YESNO + MB_ICONWARNING) = ID_YES);
703 if ok then
704 begin
705 frmVitalsDate := TfrmVitalsDate.Create(Application);
706 try
707 frmVitalsDate.dteVitals.FMDateTime := ADate;
708 frmVitalsDate.btnNow.Visible := Show; //AGP Change 26.1
709 if frmVitalsDate.ShowModal = mrOK then
710 ADate := frmVitalsDate.dteVitals.FMDateTime;
711 finally
712 frmVitalsDate.Free;
713 end;
714 end
715 else
716 Result := FALSE;
717 end;
718end;
719
720function IsNumericWeight(const x: string): Boolean;
721var
722 i: Integer;
723begin
724 Result := True;
725 for i := 1 to Length(x) do if not (x[i] in ['0'..'9','.']) then Result := False;
726end;
727(* Old class currently not used
728{$OPTIMIZATION OFF} // REMOVE AFTER UNIT IS DEBUGGED
729
730interface
731
732uses SysUtils, Classes;
733
734type
735 TVital = class(TObject)
736 {class for vital}
737 Private
738 Fsend: Boolean; //do we need this?
739 public
740 Typ: String; //type
741 Value: Single;
742 Unt: String; //unit
743 Provider: Integer;
744 procedure Assign(Src: TVital); //will we need assign?
745 procedure Clear;
746 procedure SetFromString(const x: string);
747 function DelimitedStr: string;
748 end;
749
750
751implementation
752
753uses ORFn, fPCEEdit, uPCE;
754
755Procedure TVital.Assign(Src: TVital);
756{assigns the values from one vital to another}
757begin
758 Fsend := Src.Fsend;
759 Typ := Src.Typ;
760 Value := Src.Value;
761 Unt := Src.Unt;
762 provider := Src.Provider;
763end;
764
765procedure Tvital.Clear;
766{clear all fields}
767begin
768 Fsend := False;
769 Typ := '';
770 Value := 0.0;
771 Unt := ''; //will default to Inches/LBs/Farenheit on M side,
772 //depending on the Type
773 //Provider := UProvider;
774end;
775
776Procedure TVital.SetFromString(const X: string);
777begin
778 Typ := Piece(x, U, 2);
779 Value := StrToFloat(Piece(x, U, 5));
780 Provider := StrToInt(Piece(x, U, 6));
781 Unt := Piece(x, U, 7);
782end;
783
784function TVital.DelimitedStr: string;
785begin
786 Result := 'VIT' + U + Typ + U + U + U + FloatToStr(Value) + U +
787 IntToStr(Provider) + U + Unt;
788end;
789*)
790
791initialization
792
793finalization
794 KillObj(@uVitalFrames);
795
796end.
Note: See TracBrowser for help on using the repository browser.