source: cprs/trunk/CPRS-Chart/fvit.pas@ 1798

Last change on this file since 1798 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 15.0 KB
Line 
1{///////////////////////////////////////////////////////
2//Description: This form has been copied form the vital entry tab in fPCEEdit
3// It is intended to be used for vital entry off of the cover sheet in CPRS and
4// posibly being ported to a separate application from CPRS that only does Vital entry.
5//
6//Created: April 1998
7//Author: Robert Bott
8//Location: ISL
9//
10//To Do List:
11// needs to be modified to use the application font settings.
12
13////////////////////////////////////////////////////////
14//Modifed: 4/21/98
15//By: Robert Bott
16//Location: ISL
17//Description of Mod: Modified this unit to use only the Date/time entered
18// rather than the encounter.datetime.
19//
20//Modifed: 5/06/98
21//By: Robert Bott
22//Location: ISL
23//Description of Mod: removed DateStrToFMDateTimeStr function and added
24// TOTDateBox to allow the date/time to be edited.
25//
26//Modifed: 6/15/98
27//By: Robert Bott
28//Location: ISL
29//Description of Mod: moved line of code to change caption from formCreate event
30// to formShow event. This prevents an error occuring at that line if there is
31// not a broker connection.
32
33//Modifed: 6/23/98
34//By: Robert Bott
35//Location: ISL
36//Description of Mod:
37// Moved code that verifies valid provider and visit from fvit into fVitals.
38// now found in procedure TfrmVitals.btnEnterVitalsClick(Sender: TObject);
39// formerly in procedure TfrmVit.FormActivate(Sender: TObject);
40
41//Modifed: 9/18/98
42//By: Robert Bott
43//Location: ISL
44//Description of Mod:
45// changed procedure TfrmVit.cmdOKClick to display the error message returned
46// from ValAndStoreVitals.
47
48//Modifed: 12/10/98
49//By: Robert Bott
50//Location: ISL
51//Description of Mod:
52// Changed oredr of display and entry to Temp, Pulse, Resp, B/P, HT, WT
53
54//Modifed: 6/29/99
55//By: Robert Bott
56//Location: ISL
57//Description of Mod:
58// Changed AssignVitals finction to round conversions before storing them.
59
60///////////////////////////////////////////////////////////////////////////////}
61
62unit fvit;
63
64interface
65
66uses
67 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
68 ExtCtrls, fAutoSz,StdCtrls, ORFn, ORCtrls, rvitals, ORDtTm,
69 VA508AccessibilityManager;
70
71
72type
73 TfrmVit = class(TfrmAutoSz)
74 pnlmain: TPanel;
75 lblDate: TStaticText;
76 lblDateBP: TStaticText;
77 lblDateTemp: TStaticText;
78 lblDateResp: TStaticText;
79 lblDatePulse: TStaticText;
80 lblDateHeight: TStaticText;
81 lblDateWeight: TStaticText;
82 lblLstMeas: TStaticText;
83 lbllastBP: TStaticText;
84 lblLastTemp: TStaticText;
85 lblLastResp: TStaticText;
86 lblLastPulse: TStaticText;
87 lblLastHeight: TStaticText;
88 lblLastWeight: TStaticText;
89 txtMeasBP: TCaptionEdit;
90 cboTemp: TCaptionComboBox;
91 txtMeasTemp: TCaptionEdit;
92 txtMeasResp: TCaptionEdit;
93 txtMeasPulse: TCaptionEdit;
94 txtMeasHt: TCaptionEdit;
95 cboHeight: TCaptionComboBox;
96 txtMeasWt: TCaptionEdit;
97 cboWeight: TCaptionComboBox;
98 lblVitPointer: TOROffsetLabel;
99 cmdOK: TButton;
100 cmdCancel: TButton;
101 lblVital: TStaticText;
102 lblVitBP: TStaticText;
103 lnlVitTemp: TStaticText;
104 lblVitResp: TStaticText;
105 lblVitPulse: TStaticText;
106 lblVitHeight: TStaticText;
107 lblVitWeight: TStaticText;
108 txtMeasDate: TORDateBox;
109 lblDatePain: TStaticText;
110 lblLastPain: TStaticText;
111 lblVitPain: TStaticText;
112 cboPain: TORComboBox;
113 procedure FormKeyPress(Sender: TObject; var Key: Char);
114 procedure txtMeasBPExit(Sender: TObject);
115 procedure cboTempChange(Sender: TObject);
116 procedure cboTempExit(Sender: TObject);
117 procedure txtMeasRespExit(Sender: TObject);
118 procedure txtMeasPulseExit(Sender: TObject);
119 procedure cboHeightChange(Sender: TObject);
120 procedure cboHeightExit(Sender: TObject);
121 procedure cboWeightChange(Sender: TObject);
122 procedure cboWeightExit(Sender: TObject);
123 procedure FormCreate(Sender: TObject);
124 procedure FormDestroy(Sender: TObject);
125 procedure cmdCancelClick(Sender: TObject);
126 procedure cmdOKClick(Sender: TObject);
127 procedure lbllastClick(Sender: TObject);
128 procedure FormShow(Sender: TObject);
129 procedure FormActivate(Sender: TObject);
130 procedure cboPainChange(Sender: TObject);
131 procedure SetVitPointer(Sender: TObject);
132 procedure txtMeasTempExit(Sender: TObject);
133 procedure txtMeasHtExit(Sender: TObject);
134 procedure txtMeasWtExit(Sender: TObject);
135
136 private
137 { Private declarations }
138 procedure InitVitalPanel;
139 procedure PopulateLastVital;
140 function GetVitHTRate: String;
141 procedure AssignVitals;
142 procedure CheckVitalUnit(AWinControl: TWinControl);
143 public
144 { Public declarations }
145 end;
146
147const
148 TX_NEED_VISIT = 'A visit or location is required before entering vital signs.';
149 TX_NO_VISIT = 'Insufficient Visit Information';
150 TX_NEED_PROVIDER = 'A valid provider must be selected before entering vital signs.';
151 TX_NO_PROVIDER = 'Undefined Provider';
152
153var
154 frmVit: TfrmVit;
155 uVitalLocation: Real;
156 //uVitalNew: TStringlist;
157
158implementation
159
160{$R *.DFM}
161
162uses UCore, rCore, rPCE, fPCELex, fPCEOther, fVitals,fVisit, fFrame, fEncnt,
163 uVitals, VAUtils;
164
165var
166 uVitalOld: TStringlist;
167 uVitalNew: TStringlist;
168 UcboVitChanging: Boolean = False;
169
170
171{Start of code for Vital Page--------------------------------------------------}
172procedure TfrmVit.FormKeyPress(Sender: TObject; var Key: Char);
173{capture return key press if on the vital screen}
174begin
175 inherited;
176 if (ActiveControl.tag IN ([TAG_VITTEMP,TAG_VITPULSE,TAG_VITRESP,
177 TAG_VITBP,TAG_VITHEIGHT,TAG_VITWEIGHT,TAG_VITTEMPUNIT,TAG_VITHTUNIT,TAG_VITWTUNIT,TAG_VITPAIN,TAG_VITDATE]))then
178 begin
179 if Key = #13 then
180 begin
181 Key := #0;
182
183 if (activeControl.Tag = TAG_VITPAIN) then cmdOK.setfocus
184 else
185 begin
186 Perform(WM_NEXTDLGCTL,0,0);
187 SetVitPointer(Sender);
188 end;
189 end;
190 end;
191
192end;
193
194procedure TfrmVit.InitVitalPanel;
195begin
196 lblDate.font.Style := [fsBold];
197 lblDateBP.font.Style := [fsBold];
198 lblDateTemp.font.Style := [fsBold];
199 lblDateResp.font.Style := [fsBold];
200 lblDatePulse.font.Style := [fsBold];
201 lblDateHeight.font.Style := [fsBold];
202 lblDateWeight.font.Style := [fsBold];
203 lblDatePain.font.style := [fsBold]; {*RAB*}
204 lblLstMeas.font.Style := [fsBold];
205 lblLastBP.font.Style := [fsBold];
206 lblLastTemp.font.Style := [fsBold];
207 lblLastResp.font.Style := [fsBold];
208 lblLastPulse.font.Style := [fsBold];
209 lblLastHeight.font.Style := [fsBold];
210 lblLastWeight.font.Style := [fsBold];
211 lblLastPain.font.style := [fsBold]; {*RAB*}
212 lblVital.font.Style := [fsbold];
213
214
215 UcboVitChanging := true; //prevents entering code in CheckVitalUnit
216 try
217 InitPainCombo(cboPain);
218 cboTemp.Text := cboTemp.Items[0];
219 cboHeight.Text := cboHeight.Items[0];
220 cboWeight.Text := cboWeight.Items[0];
221 finally
222 UcboVitchanging := False; //prevents entering code in CheckVitalUnit
223 end;
224
225 txtMeasDate.Text := FormatFMDateTime('mmm dd,yy@hh:nn', FMNOW);
226
227 if (UvitalOld.text = '') then
228 PopulateLastVital;
229end;
230
231
232
233procedure TfrmVit.PopulateLastVital;
234var
235 i: integer;
236begin
237 GetLastVital(uVitalOld,Patient.DFN);
238 //populate labels from UVitalOld;
239 with UVitalOld do
240 for i := 0 to count-1 do
241 begin
242 if piece(strings[i],U,2) = 'T' then
243 begin
244 lblLastTemp.Caption := piece(strings[i],U,3);
245 lblDateTemp.Caption := FormatFMDateTime('mmm dd,yy',
246 StrToFloat(piece(strings[i],U,4)));
247 end;
248 if piece(strings[i],U,2) = 'P' then
249 begin
250 lblLastPulse.Caption := piece(strings[i],U,3);
251 lblDatePulse.Caption := FormatFMDateTime('mmm dd,yy',
252 StrToFloat(piece(strings[i],U,4)));
253 end;
254 if piece(strings[i],U,2) = 'R' then
255 begin
256 lblLastResp.Caption := piece(strings[i],U,3);
257 lblDateResp.Caption := FormatFMDateTime('mmm dd,yy',
258 StrToFloat(piece(strings[i],U,4)));
259 end;
260 if piece(strings[i],U,2) = 'BP' then
261 begin
262 lblLastBP.Caption := piece(strings[i],U,3);
263 lblDateBP.Caption := FormatFMDateTime('mmm dd,yy',
264 StrToFloat(piece(strings[i],U,4)));
265 end;
266 if piece(strings[i],U,2) = 'HT' then
267 begin
268 lblLastHeight.Caption := piece(strings[i],U,3);
269 lblDateHeight.Caption := FormatFMDateTime('mmm dd,yy',
270 StrToFloat(piece(strings[i],U,4)));
271 end;
272 if piece(strings[i],U,2) = 'WT' then
273 begin
274 lblLastWeight.Caption := piece(strings[i],U,3);
275 lblDateWeight.Caption := FormatFMDateTime('mmm dd,yy',
276 StrToFloat(piece(strings[i],U,4)));
277 end;
278 if piece(strings[i],U,2) = 'PN' then {*RAB*}
279 begin
280 lblLastPain.Caption := piece(strings[i],U,3); {*RAB*}
281 lblDatePain.Caption := FormatFMDateTime('mmm dd,yy', {*RAB*}
282 StrToFloat(piece(strings[i],U,4))); {*RAB*}
283
284 end;
285 end;
286
287end;
288
289
290
291function TfrmVit.GetVitHTRate: String;
292begin
293 Result := ConvertHeight2Inches(txtMeasHT.Text);
294 txtMeasHT.text := Result;
295end;
296
297//procedure: procedure TFrmVit.AssignVitals;
298//Modifed: 10/02/98
299//By: Robert Bott
300//Location: ISL
301//Description of Mod:
302// If encounter.provider is not defined (=0) then use User.DUZ to store vitals.
303procedure TFrmVit.AssignVitals;
304begin
305 AssignVitals2List(uVitalNew, txtMeasDate.FMDateTime, FloatToStr(uVitalLocation),
306 txtMeasBP.text, txtMeasTemp.text, cboTemp.text,
307 txtMeasResp.text, txtMeasPulse.text, GetVitHTRate, cboHeight.text,
308 txtMeasWT.text, cboWeight.text, cboPain.ItemID);
309end;
310
311procedure TfrmVit.cboTempChange(Sender: TObject);
312begin
313 inherited;
314 if not (cbotemp.droppeddown) then
315 CheckVitalUnit(cboTemp);
316end;
317
318
319procedure TFrmVit.CheckVitalUnit(AWinControl: TWinControl);
320var
321 len,i: integer;
322 found: boolean;
323 comp: string; //substring for comparing
324 temp: string;
325begin
326 if (UcboVitchanging = true) then exit;
327
328 UcboVitChanging := true;
329 try
330 with AWinControl as TComboBox do
331 begin
332 found := False;
333 temp := (AWinControl as TComboBox).text;
334 while (found = false) and (Length(temp) > 0) do
335 begin
336 i := 0;
337 while (found = false) and (length(items[i]) > 0) do
338 begin
339 len := length(temp);
340 //match text to string
341 comp := copy(items[i],0,len);
342 if (CompareText(comp,temp) = 0) then
343 begin
344 found := true;
345 (AWinControl as TComboBox).Text := '';
346 (AWinControl as TComboBox).text := items[i];
347
348 end;
349 inc(i);
350 end;
351 if (found = false) then Delete(temp,1,1);
352 end;
353 if (found = False) then
354 begin
355 (AWinControl as TComboBox).Text := '';
356 end;
357 end;
358 finally
359 UcboVitChanging := false;
360 end;
361end;
362
363
364procedure TfrmVit.cboHeightChange(Sender: TObject);
365begin
366 inherited;
367 CheckVitalUnit(cboHeight);
368end;
369
370procedure TfrmVit.cboWeightChange(Sender: TObject);
371begin
372 inherited;
373 CheckVitalUnit(cboWeight);
374end;
375
376procedure TfrmVit.txtMeasBPExit(Sender: TObject);
377begin
378 inherited;
379 if VitalInvalid(txtMeasBP) then
380 txtMeasBP.SetFocus;
381end;
382
383procedure TfrmVit.cboTempExit(Sender: TObject);
384begin
385 inherited;
386 if(ActiveControl <> txtMeasTemp) then
387 begin
388 if VitalInvalid(txtMeasTemp, cboTemp) then
389 txtMeasTemp.SetFocus;
390 end;
391end;
392
393procedure TfrmVit.txtMeasRespExit(Sender: TObject);
394begin
395 inherited;
396 if VitalInvalid(txtMeasResp) then
397 txtMeasResp.SetFocus;
398end;
399
400procedure TfrmVit.txtMeasPulseExit(Sender: TObject);
401begin
402 inherited;
403 if VitalInvalid(txtMeasPulse) then
404 txtMeasPulse.SetFocus;
405end;
406
407procedure TfrmVit.cboHeightExit(Sender: TObject);
408begin
409 inherited;
410 if(ActiveControl <> txtMeasHt) then
411 begin
412 if VitalInvalid(txtMeasHt, cboHeight, GetVitHTRate) then
413 txtMeasHt.SetFocus;
414 end;
415end;
416
417procedure TfrmVit.cboWeightExit(Sender: TObject);
418begin
419 inherited;
420 if(ActiveControl <> txtMeasWt) then
421 begin
422 if VitalInvalid(txtMeasWt, cboWeight) then
423 txtMeasWt.SetFocus;
424 end;
425end;
426
427procedure TfrmVit.FormCreate(Sender: TObject);
428
429begin
430 inherited;
431 //uVisitType := TPCEProc.create;
432 uVitalOld := TStringList.create;
433 uVitalNew := TStringList.create;
434 ResizeAnchoredFormToFont(self);
435end;
436
437
438
439procedure TfrmVit.FormDestroy(Sender: TObject);
440
441begin
442 inherited;
443 //uVisitType.Free;
444 uVitalOld.Free;
445 uVitalNew.free;
446end;
447
448
449
450procedure TfrmVit.cmdCancelClick(Sender: TObject);
451begin
452 inherited;
453 close();
454end;
455
456procedure TfrmVit.cmdOKClick(Sender: TObject);
457var
458 StoreMessage: string;
459begin
460 inherited;
461 // do validation for vitals & anything else here
462 AssignVitals;
463
464 //store vitals
465 StoreMessage := ValAndStoreVitals(UVitalNew);
466 if (Storemessage <> 'True') then
467 begin
468 ShowMsg(storemessage);
469 exit;
470 end;
471 close();
472end;
473
474procedure TfrmVit.lbllastClick(Sender: TObject);
475begin
476 inherited;
477 //
478 try
479 frmVitals.Show;
480 except
481 with sender as tLabel do
482 SelectVital(self.Font.Size, tag);
483 end; //end of try
484end;
485
486
487procedure TfrmVit.FormShow(Sender: TObject);
488begin
489 inherited;
490 frmVit.caption := 'Vital entry for - '+ patient.name; {RAB 6/15/98}
491end;
492
493procedure TfrmVit.FormActivate(Sender: TObject);
494begin
495 inherited;
496 InitVitalPanel;
497 txtMeasTemp.setfocus; //added 3/30/99 after changing tab order.
498 //The date is now first in tab order, but it shouldn't default there.
499
500end;
501
502
503procedure TfrmVit.cboPainChange(Sender: TObject);
504begin
505 inherited;
506 CheckVitalUnit(cboPain);
507end;
508
509procedure TfrmVit.SetVitPointer(Sender: TObject);
510begin
511 if ActiveControl.tag in ([TAG_VITTEMP, TAG_VITPULSE, TAG_VITRESP, TAG_VITBP, TAG_VITHEIGHT,
512 TAG_VITWEIGHT]) then
513 begin
514 // move pointer to some height and five pixels to right of edit box.
515 lblVitPointer.Top := ActiveControl.Top+((ActiveControl.height ) div
516 (lblVitPointer.height ));
517
518 if ActiveControl = txtMeasTemp then
519 lblVitPointer.left := (cboTemp.left + cboTemp.Width)
520 else if ActiveControl = txtMeasHT then
521 lblVitPointer.left := (cboHeight.left + cboHeight.Width)
522 else if ActiveControl = txtMeasWT then
523 lblVitPointer.left := (cboWeight.left + cboWeight.Width)
524 else
525 lblVitPointer.left := (ActiveControl.left + ActiveControl.Width);
526
527 end;
528end;
529
530procedure TfrmVit.txtMeasTempExit(Sender: TObject);
531begin
532 if(ActiveControl <> cboTemp) then
533 begin
534 if VitalInvalid(txtMeasTemp, cboTemp) then
535 txtMeasTemp.SetFocus;
536 end;
537end;
538
539procedure TfrmVit.txtMeasHtExit(Sender: TObject);
540begin
541 if(ActiveControl <> cboHeight) then
542 begin
543 if VitalInvalid(txtMeasHt, cboHeight, GetVitHTRate) then
544 txtMeasHt.SetFocus;
545 end;
546end;
547
548procedure TfrmVit.txtMeasWtExit(Sender: TObject);
549begin
550 if(ActiveControl <> cboWeight) then
551 begin
552 if VitalInvalid(txtMeasWt, cboWeight) then
553 txtMeasWt.SetFocus;
554 end;
555end;
556
557end.
Note: See TracBrowser for help on using the repository browser.