| [453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007 | 
|---|
|  | 2 | unit fEncVitals; | 
|---|
|  | 3 |  | 
|---|
|  | 4 | interface | 
|---|
|  | 5 |  | 
|---|
|  | 6 | uses | 
|---|
|  | 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
|  | 8 | fPCEBase, ORDtTm, StdCtrls, ORCtrls, ExtCtrls, Buttons, fAutoSz, ORFn, | 
|---|
|  | 9 | rvitals, ComCtrls, ORNet, uVitals | 
|---|
|  | 10 | , TRPCB, DKLang // Vitals Lite 2004-05-21 =========================================== | 
|---|
|  | 11 | ; | 
|---|
|  | 12 | {== Vitals Lite 2004-05-21 ===================================================} | 
|---|
|  | 13 | type | 
|---|
|  | 14 | TGMV_GetInputPanel = function( | 
|---|
|  | 15 | var anApp: TApplication; | 
|---|
|  | 16 | aB: TRPCBroker; | 
|---|
|  | 17 | aP,         // Patient DFN | 
|---|
|  | 18 | aL,         // Hospitals IEN | 
|---|
|  | 19 | aSig,       // Application signature | 
|---|
|  | 20 | aTemplate   // Vitals Input template | 
|---|
|  | 21 | : String; | 
|---|
|  | 22 | aNow        // Input Date/Time | 
|---|
|  | 23 | :TDateTime):TCustomForm; | 
|---|
|  | 24 | {== Vitals Lite 2004-05-21 ===================================================} | 
|---|
|  | 25 |  | 
|---|
|  | 26 | type | 
|---|
|  | 27 | TfrmEncVitals = class(TfrmPCEBase) | 
|---|
|  | 28 | pnlmain: TPanel; | 
|---|
|  | 29 | lblDate: TStaticText; | 
|---|
|  | 30 | lblDateBP: TStaticText; | 
|---|
|  | 31 | lblDateTemp: TStaticText; | 
|---|
|  | 32 | lblDateResp: TStaticText; | 
|---|
|  | 33 | lblDatePulse: TStaticText; | 
|---|
|  | 34 | lblDateHeight: TStaticText; | 
|---|
|  | 35 | lblDateWeight: TStaticText; | 
|---|
|  | 36 | lblLstMeas: TStaticText; | 
|---|
|  | 37 | lbllastBP: TStaticText; | 
|---|
|  | 38 | lblLastTemp: TStaticText; | 
|---|
|  | 39 | lblLastResp: TStaticText; | 
|---|
|  | 40 | lblLastPulse: TStaticText; | 
|---|
|  | 41 | lblLastHeight: TStaticText; | 
|---|
|  | 42 | lblLastWeight: TStaticText; | 
|---|
|  | 43 | lblVitPointer: TOROffsetLabel; | 
|---|
|  | 44 | lblVital: TStaticText; | 
|---|
|  | 45 | lblVitBP: TStaticText; | 
|---|
|  | 46 | lnlVitTemp: TStaticText; | 
|---|
|  | 47 | lblVitResp: TStaticText; | 
|---|
|  | 48 | lblVitPulse: TStaticText; | 
|---|
|  | 49 | lblVitHeight: TStaticText; | 
|---|
|  | 50 | lblVitWeight: TStaticText; | 
|---|
|  | 51 | txtMeasBP: TCaptionEdit; | 
|---|
|  | 52 | cboTemp: TCaptionComboBox; | 
|---|
|  | 53 | txtMeasTemp: TCaptionEdit; | 
|---|
|  | 54 | txtMeasResp: TCaptionEdit; | 
|---|
|  | 55 | cboHeight: TCaptionComboBox; | 
|---|
|  | 56 | txtMeasWt: TCaptionEdit; | 
|---|
|  | 57 | cboWeight: TCaptionComboBox; | 
|---|
|  | 58 | txtMeasDate: TORDateBox; | 
|---|
|  | 59 | lblVitPain: TStaticText; | 
|---|
|  | 60 | lblLastPain: TStaticText; | 
|---|
|  | 61 | lblDatePain: TStaticText; | 
|---|
|  | 62 | cboPain: TORComboBox; | 
|---|
|  | 63 | txtMeasPulse: TCaptionEdit; | 
|---|
|  | 64 | txtMeasHt: TCaptionEdit; | 
|---|
|  | 65 | pnlBottom: TPanel; | 
|---|
|  | 66 | btnEnterVitals: TButton; | 
|---|
|  | 67 | lvVitals: TCaptionListView; | 
|---|
|  | 68 | procedure SetVitPointer(Sender: TObject); | 
|---|
|  | 69 | procedure txtMeasBPExit(Sender: TObject); | 
|---|
|  | 70 | procedure cboTempChange(Sender: TObject); | 
|---|
|  | 71 | procedure cboTempExit(Sender: TObject); | 
|---|
|  | 72 | procedure txtMeasRespExit(Sender: TObject); | 
|---|
|  | 73 | procedure txtMeasPulseExit(Sender: TObject); | 
|---|
|  | 74 | procedure cboHeightChange(Sender: TObject); | 
|---|
|  | 75 | procedure cboHeightExit(Sender: TObject); | 
|---|
|  | 76 | procedure cboWeightChange(Sender: TObject); | 
|---|
|  | 77 | procedure cboWeightExit(Sender: TObject); | 
|---|
|  | 78 | procedure FormCreate(Sender: TObject); | 
|---|
|  | 79 | procedure FormDestroy(Sender: TObject); | 
|---|
|  | 80 | procedure lbllastClick(Sender: TObject); | 
|---|
|  | 81 | procedure FormShow(Sender: TObject); | 
|---|
|  | 82 | procedure FormActivate(Sender: TObject); | 
|---|
|  | 83 | function HasData: Boolean; | 
|---|
|  | 84 | function AssignVitals: boolean; | 
|---|
|  | 85 | procedure cboPainChange(Sender: TObject); | 
|---|
|  | 86 | procedure FormResize(Sender: TObject); | 
|---|
|  | 87 | procedure txtMeasTempExit(Sender: TObject); | 
|---|
|  | 88 | procedure txtMeasHtExit(Sender: TObject); | 
|---|
|  | 89 | procedure txtMeasWtExit(Sender: TObject); | 
|---|
|  | 90 | procedure FormKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 91 | Shift: TShiftState); | 
|---|
|  | 92 | procedure btnEnterVitalsClick(Sender: TObject); //vitals lite | 
|---|
|  | 93 | private | 
|---|
|  | 94 | FDataLoaded: boolean; | 
|---|
|  | 95 | FChangingFocus: boolean; | 
|---|
|  | 96 | UvitalNew: TStringList; | 
|---|
|  | 97 | uVitalOld: TSTringList; | 
|---|
|  | 98 | procedure InitVitalPanel; | 
|---|
|  | 99 | procedure PopulateLastVital; | 
|---|
|  | 100 | function GetVitHTRate: String; | 
|---|
|  | 101 | procedure CheckVitalUnit; | 
|---|
|  | 102 | procedure ChangeFocus(Control: TWinControl); | 
|---|
|  | 103 | procedure ClearData; | 
|---|
|  | 104 | procedure LoadVitalView(VitalsList : TStringList); //Vitals Lite | 
|---|
|  | 105 | procedure LoadVitalsList; | 
|---|
|  | 106 | public | 
|---|
|  | 107 | function OK2SaveVitals: boolean; | 
|---|
|  | 108 | property VitalNew: TStringList read uVitalNew; | 
|---|
|  | 109 | property VitalOld: TStringList read uVitalOld; | 
|---|
|  | 110 | end; | 
|---|
|  | 111 |  | 
|---|
|  | 112 | var | 
|---|
|  | 113 | frmEncVitals: TfrmEncVitals; | 
|---|
|  | 114 | //  uVitalLocation: Real; | 
|---|
|  | 115 |  | 
|---|
|  | 116 | implementation | 
|---|
|  | 117 |  | 
|---|
|  | 118 | {$R *.DFM} | 
|---|
|  | 119 |  | 
|---|
|  | 120 | uses UCore, rCore, rPCE, fPCELex, fPCEOther, fVitals,fVisit, fFrame, fEncnt, | 
|---|
|  | 121 | fEncounterFrame, uInit | 
|---|
|  | 122 | //   , fGMV_InputTemp // Vitals Lite 2004-05-21 | 
|---|
|  | 123 | ; | 
|---|
|  | 124 |  | 
|---|
|  | 125 | var | 
|---|
|  | 126 | TX_VDATE_REQ1  : string;  //kt | 
|---|
|  | 127 | TC_VDATE_REQ   : string;  //kt | 
|---|
|  | 128 | TX_KILLDATA    : string;  //kt | 
|---|
|  | 129 |  | 
|---|
|  | 130 | const | 
|---|
|  | 131 | //TX_VDATE_REQ1 = 'Entered vitals information can not be saved without a Date.' + CRLF +  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 132 | //                'Do you wish to use the encounter date of ';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 133 | TX_VDATE_REQ2 = '?'; | 
|---|
|  | 134 | //TC_VDATE_REQ = 'Missing Vitals Entry Date';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 135 |  | 
|---|
|  | 136 | //TX_KILLDATA = 'Discard entered vitals information?';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 137 |  | 
|---|
|  | 138 |  | 
|---|
|  | 139 | procedure SetupVars; | 
|---|
|  | 140 | //kt Added entire function to replace constant declarations 8/8/2007 | 
|---|
|  | 141 | begin | 
|---|
|  | 142 | TX_VDATE_REQ1 := DKLangConstW('fEncVitals_Entered_vitals_information_can_not_be_saved_without_a_Datex') + CRLF + | 
|---|
|  | 143 | DKLangConstW('fEncVitals_Do_you_wish_to_use_the_encounter_date_of'); | 
|---|
|  | 144 | TC_VDATE_REQ := DKLangConstW('fEncVitals_Missing_Vitals_Entry_Date'); | 
|---|
|  | 145 | TX_KILLDATA := DKLangConstW('fEncVitals_Discard_entered_vitals_informationx'); | 
|---|
|  | 146 | end; | 
|---|
|  | 147 |  | 
|---|
|  | 148 | var | 
|---|
|  | 149 | UcboVitChanging:      Boolean = False; | 
|---|
|  | 150 |  | 
|---|
|  | 151 | function TfrmEncVitals.HasData: Boolean; | 
|---|
|  | 152 | begin | 
|---|
|  | 153 | result := False; | 
|---|
|  | 154 | if ((txtMeasBP.text <> '') or (txtMeasTemp.text <> '') or (txtMeasResp.text <> '') or | 
|---|
|  | 155 | (txtMeasPulse.text <> '') or (txtMeasHt.text <> '') or (txtMeasWt.text <> '')) or | 
|---|
|  | 156 | (cboPain.text <>'') then | 
|---|
|  | 157 | result := True; | 
|---|
|  | 158 | end; | 
|---|
|  | 159 |  | 
|---|
|  | 160 | procedure TfrmEncVitals.InitVitalPanel; | 
|---|
|  | 161 | begin | 
|---|
|  | 162 | lblDate.font.Style := [fsBold]; | 
|---|
|  | 163 | lblDateBP.font.Style := [fsBold]; | 
|---|
|  | 164 | lblDateTemp.font.Style := [fsBold]; | 
|---|
|  | 165 | lblDateResp.font.Style := [fsBold]; | 
|---|
|  | 166 | lblDatePulse.font.Style := [fsBold]; | 
|---|
|  | 167 | lblDateHeight.font.Style := [fsBold]; | 
|---|
|  | 168 | lblDateWeight.font.Style := [fsBold]; | 
|---|
|  | 169 | lblDatePain.font.style := [fsBold]; | 
|---|
|  | 170 | lblLstMeas.font.Style := [fsBold]; | 
|---|
|  | 171 | lblLastBP.font.Style := [fsBold]; | 
|---|
|  | 172 | lblLastTemp.font.Style := [fsBold]; | 
|---|
|  | 173 | lblLastResp.font.Style := [fsBold]; | 
|---|
|  | 174 | lblLastPulse.font.Style := [fsBold]; | 
|---|
|  | 175 | lblLastHeight.font.Style := [fsBold]; | 
|---|
|  | 176 | lblLastWeight.font.Style := [fsBold]; | 
|---|
|  | 177 | lblLastPain.font.style := [fsBold]; | 
|---|
|  | 178 | lblVital.font.Style := [fsbold]; | 
|---|
|  | 179 |  | 
|---|
|  | 180 | {Use this area to read parameter for units and set apropriately | 
|---|
|  | 181 | after parameter is defined. in next version | 
|---|
|  | 182 | } | 
|---|
|  | 183 | UcboVitchanging := true; //prevents entering code in CheckVitalUnit | 
|---|
|  | 184 |  | 
|---|
|  | 185 | try | 
|---|
|  | 186 | InitPainCombo(cboPain); | 
|---|
|  | 187 | cboTemp.Text := cboTemp.Items[0]; | 
|---|
|  | 188 | cboHeight.Text := cboHeight.Items[0]; | 
|---|
|  | 189 | cboWeight.Text := cboWeight.Items[0]; | 
|---|
|  | 190 | finally | 
|---|
|  | 191 | UcboVitchanging := False; //prevents entering code in CheckVitalUnit | 
|---|
|  | 192 | end; | 
|---|
|  | 193 |  | 
|---|
|  | 194 | if txtMeasDate.Text = '' then | 
|---|
|  | 195 | txtMeasDate.Text := FormatFMDateTime('mmm dd,yy@hh:nn', uEncPCEData.VisitDateTime); | 
|---|
|  | 196 | if (UvitalOld.text = '') then | 
|---|
|  | 197 | PopulateLastVital; | 
|---|
|  | 198 | end; | 
|---|
|  | 199 |  | 
|---|
|  | 200 |  | 
|---|
|  | 201 | procedure TfrmEncVitals.PopulateLastVital; | 
|---|
|  | 202 | var | 
|---|
|  | 203 | i: integer; | 
|---|
|  | 204 | begin | 
|---|
|  | 205 | GetLastVital(uVitalOld,Patient.DFN); | 
|---|
|  | 206 | //populate labels from UVitalOld; | 
|---|
|  | 207 | with UVitalOld do | 
|---|
|  | 208 | for i := 0 to count-1 do | 
|---|
|  | 209 | begin | 
|---|
|  | 210 | if piece(strings[i],U,2) = 'T' then | 
|---|
|  | 211 | begin | 
|---|
|  | 212 | lblLastTemp.Caption := ConvertVitalData(piece(strings[i],U,3), vtTemp); | 
|---|
|  | 213 | lblDateTemp.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 214 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 215 | end; | 
|---|
|  | 216 | if piece(strings[i],U,2) = 'P' then | 
|---|
|  | 217 | begin | 
|---|
|  | 218 | lblLastPulse.Caption := piece(strings[i],U,3); | 
|---|
|  | 219 | lblDatePulse.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 220 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 221 | end; | 
|---|
|  | 222 | if piece(strings[i],U,2) = 'R' then | 
|---|
|  | 223 | begin | 
|---|
|  | 224 | lblLastResp.Caption := piece(strings[i],U,3); | 
|---|
|  | 225 | lblDateResp.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 226 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 227 | end; | 
|---|
|  | 228 | if piece(strings[i],U,2) = 'BP' then | 
|---|
|  | 229 | begin | 
|---|
|  | 230 | lblLastBP.Caption := piece(strings[i],U,3); | 
|---|
|  | 231 | lblDateBP.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 232 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 233 | end; | 
|---|
|  | 234 | if piece(strings[i],U,2) = 'HT' then | 
|---|
|  | 235 | begin | 
|---|
|  | 236 | lblLastHeight.Caption := ConvertVitalData(piece(strings[i],U,3), vtHeight); | 
|---|
|  | 237 | lblDateHeight.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 238 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 239 | end; | 
|---|
|  | 240 | if piece(strings[i],U,2) = 'WT' then | 
|---|
|  | 241 | begin | 
|---|
|  | 242 | lblLastWeight.Caption := ConvertVitalData(piece(strings[i],U,3), vtWeight); | 
|---|
|  | 243 | lblDateWeight.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 244 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 245 |  | 
|---|
|  | 246 | end; | 
|---|
|  | 247 | if piece(strings[i],U,2) = 'PN' then | 
|---|
|  | 248 | begin | 
|---|
|  | 249 | lblLastPain.Caption := piece(strings[i],U,3); | 
|---|
|  | 250 | lblDatePain.Caption := FormatFMDateTime('mmm dd,yy', | 
|---|
|  | 251 | StrToFloat(piece(strings[i],U,4))); | 
|---|
|  | 252 | end; | 
|---|
|  | 253 | end; | 
|---|
|  | 254 | end; | 
|---|
|  | 255 |  | 
|---|
|  | 256 |  | 
|---|
|  | 257 | procedure TfrmEncVitals.SetVitPointer(Sender: TObject); | 
|---|
|  | 258 | begin | 
|---|
|  | 259 | if ActiveCtrl.tag in VitalTagSet then | 
|---|
|  | 260 | begin | 
|---|
|  | 261 | // move pointer to some height and five pixels to right of edit box. | 
|---|
|  | 262 | lblVitPointer.Top := ActiveCtrl.Top+((ActiveCtrl.height ) div | 
|---|
|  | 263 | (lblVitPointer.height )); | 
|---|
|  | 264 |  | 
|---|
|  | 265 | if ActiveCtrl = txtMeasTemp then | 
|---|
|  | 266 | lblVitPointer.left := (cboTemp.left + cboTemp.Width) | 
|---|
|  | 267 | else if ActiveCtrl = txtMeasHT then | 
|---|
|  | 268 | lblVitPointer.left := (cboHeight.left + cboHeight.Width) | 
|---|
|  | 269 | else if ActiveCtrl = txtMeasWT then | 
|---|
|  | 270 | lblVitPointer.left := (cboWeight.left + cboWeight.Width) | 
|---|
|  | 271 | else | 
|---|
|  | 272 | lblVitPointer.left := (ActiveCtrl.left + ActiveCtrl.Width); | 
|---|
|  | 273 |  | 
|---|
|  | 274 | end; | 
|---|
|  | 275 | end; | 
|---|
|  | 276 |  | 
|---|
|  | 277 |  | 
|---|
|  | 278 | function TfrmEncVitals.GetVitHTRate: String; | 
|---|
|  | 279 | begin | 
|---|
|  | 280 | Result := ConvertHeight2Inches(txtMeasHT.Text); | 
|---|
|  | 281 | txtMeasHT.text := result; | 
|---|
|  | 282 | end; | 
|---|
|  | 283 |  | 
|---|
|  | 284 | function TfrmEncVitals.AssignVitals: boolean; | 
|---|
|  | 285 | var | 
|---|
|  | 286 | TmpDate: TFMDateTime; | 
|---|
|  | 287 |  | 
|---|
|  | 288 | begin | 
|---|
|  | 289 | TmpDate := txtMeasDate.FMDateTime; | 
|---|
|  | 290 | Result := ValidVitalsDate(TmpDate); | 
|---|
|  | 291 | if Result then | 
|---|
|  | 292 | AssignVitals2List(uVitalNew, TmpDate, FloatToStr(PCERPCEncLocation), | 
|---|
|  | 293 | txtMeasBP.text, txtMeasTemp.text, cboTemp.text, | 
|---|
|  | 294 | txtMeasResp.text, txtMeasPulse.text, GetVitHTRate, cboHeight.text, | 
|---|
|  | 295 | txtMeasWT.text, cboWeight.text, cboPain.ItemID); | 
|---|
|  | 296 | end; | 
|---|
|  | 297 |  | 
|---|
|  | 298 | procedure TfrmEncVitals.cboTempChange(Sender: TObject); | 
|---|
|  | 299 | begin | 
|---|
|  | 300 | inherited; | 
|---|
|  | 301 | if not (cbotemp.droppeddown) then | 
|---|
|  | 302 | CheckVitalUnit; | 
|---|
|  | 303 | end; | 
|---|
|  | 304 |  | 
|---|
|  | 305 |  | 
|---|
|  | 306 | procedure TfrmEncVitals.CheckVitalUnit; | 
|---|
|  | 307 | var | 
|---|
|  | 308 | len,i: integer; | 
|---|
|  | 309 | found: boolean; | 
|---|
|  | 310 | comp: string; //substring for comparing | 
|---|
|  | 311 | temp: string; | 
|---|
|  | 312 | begin | 
|---|
|  | 313 | if (UcboVitchanging = true) then exit; | 
|---|
|  | 314 |  | 
|---|
|  | 315 | UcboVitChanging := true; | 
|---|
|  | 316 | try | 
|---|
|  | 317 | with ActiveCtrl as TComboBox do | 
|---|
|  | 318 | begin | 
|---|
|  | 319 | found := False; | 
|---|
|  | 320 | temp := text; | 
|---|
|  | 321 | while (found = false) and (Length(temp) > 0) do | 
|---|
|  | 322 | begin | 
|---|
|  | 323 | i := 0; | 
|---|
|  | 324 | while (found = false) and (length(items[i]) > 0) do | 
|---|
|  | 325 | begin | 
|---|
|  | 326 | len := length(temp); | 
|---|
|  | 327 | //match text to string | 
|---|
|  | 328 | comp := copy(items[i],0,len); | 
|---|
|  | 329 | if (CompareText(comp,temp) = 0) then | 
|---|
|  | 330 | begin | 
|---|
|  | 331 | found := true; | 
|---|
|  | 332 | Text := ''; | 
|---|
|  | 333 | text := items[i]; | 
|---|
|  | 334 |  | 
|---|
|  | 335 | end; | 
|---|
|  | 336 | inc(i); | 
|---|
|  | 337 | end; | 
|---|
|  | 338 | if (found = false) then Delete(temp,1,1); | 
|---|
|  | 339 | end; | 
|---|
|  | 340 | if (found = False) then | 
|---|
|  | 341 | begin | 
|---|
|  | 342 | Text := ''; | 
|---|
|  | 343 | end; | 
|---|
|  | 344 | end; | 
|---|
|  | 345 | finally | 
|---|
|  | 346 | UcboVitChanging := false; | 
|---|
|  | 347 | end; | 
|---|
|  | 348 | end; | 
|---|
|  | 349 |  | 
|---|
|  | 350 |  | 
|---|
|  | 351 | procedure TfrmEncVitals.cboHeightChange(Sender: TObject); | 
|---|
|  | 352 | begin | 
|---|
|  | 353 | inherited; | 
|---|
|  | 354 | CheckVitalUnit; | 
|---|
|  | 355 | end; | 
|---|
|  | 356 |  | 
|---|
|  | 357 | procedure TfrmEncVitals.cboWeightChange(Sender: TObject); | 
|---|
|  | 358 | begin | 
|---|
|  | 359 | inherited; | 
|---|
|  | 360 | CheckVitalUnit; | 
|---|
|  | 361 | end; | 
|---|
|  | 362 |  | 
|---|
|  | 363 | procedure TfrmEncVitals.txtMeasBPExit(Sender: TObject); | 
|---|
|  | 364 | begin | 
|---|
|  | 365 | inherited; | 
|---|
|  | 366 | if VitalInvalid(txtMeasBP) then | 
|---|
|  | 367 | ChangeFocus(txtMeasBP); | 
|---|
|  | 368 | end; | 
|---|
|  | 369 |  | 
|---|
|  | 370 | procedure TfrmEncVitals.cboTempExit(Sender: TObject); | 
|---|
|  | 371 | begin | 
|---|
|  | 372 | inherited; | 
|---|
|  | 373 | if(ActiveCtrl <> txtMeasTemp) then | 
|---|
|  | 374 | begin | 
|---|
|  | 375 | if VitalInvalid(txtMeasTemp, cboTemp) then | 
|---|
|  | 376 | ChangeFocus(txtMeasTemp); | 
|---|
|  | 377 | end; | 
|---|
|  | 378 | end; | 
|---|
|  | 379 |  | 
|---|
|  | 380 | procedure TfrmEncVitals.txtMeasRespExit(Sender: TObject); | 
|---|
|  | 381 | begin | 
|---|
|  | 382 | inherited; | 
|---|
|  | 383 | if VitalInvalid(txtMeasResp) then | 
|---|
|  | 384 | ChangeFocus(txtMeasResp); | 
|---|
|  | 385 | end; | 
|---|
|  | 386 |  | 
|---|
|  | 387 | procedure TfrmEncVitals.txtMeasPulseExit(Sender: TObject); | 
|---|
|  | 388 | begin | 
|---|
|  | 389 | inherited; | 
|---|
|  | 390 | if VitalInvalid(txtMeasPulse) then | 
|---|
|  | 391 | ChangeFocus(txtMeasPulse); | 
|---|
|  | 392 | end; | 
|---|
|  | 393 |  | 
|---|
|  | 394 | procedure TfrmEncVitals.cboHeightExit(Sender: TObject); | 
|---|
|  | 395 | begin | 
|---|
|  | 396 | inherited; | 
|---|
|  | 397 | if(ActiveCtrl <> txtMeasHt) then | 
|---|
|  | 398 | begin | 
|---|
|  | 399 | if VitalInvalid(txtMeasHt, cboHeight, GetVitHTRate) then | 
|---|
|  | 400 | ChangeFocus(txtMeasHt); | 
|---|
|  | 401 | end; | 
|---|
|  | 402 | end; | 
|---|
|  | 403 |  | 
|---|
|  | 404 | procedure TfrmEncVitals.cboWeightExit(Sender: TObject); | 
|---|
|  | 405 | begin | 
|---|
|  | 406 | inherited; | 
|---|
|  | 407 | if(ActiveCtrl <> txtMeasWt) then | 
|---|
|  | 408 | begin | 
|---|
|  | 409 | if VitalInvalid(txtMeasWt, cboWeight) then | 
|---|
|  | 410 | ChangeFocus(txtMeasWt); | 
|---|
|  | 411 | end; | 
|---|
|  | 412 | end; | 
|---|
|  | 413 |  | 
|---|
|  | 414 |  | 
|---|
|  | 415 | procedure TfrmEncVitals.FormCreate(Sender: TObject); | 
|---|
|  | 416 | begin | 
|---|
|  | 417 |  | 
|---|
|  | 418 | inherited; | 
|---|
|  | 419 | FTabName := CT_VitNm; | 
|---|
|  | 420 | //uVisitType := TPCEProc.create; | 
|---|
|  | 421 | uVitalOld  := TStringList.create; | 
|---|
|  | 422 | uVitalNew  := TStringList.create; | 
|---|
|  | 423 |  | 
|---|
|  | 424 | end; | 
|---|
|  | 425 |  | 
|---|
|  | 426 |  | 
|---|
|  | 427 |  | 
|---|
|  | 428 | procedure TfrmEncVitals.FormDestroy(Sender: TObject); | 
|---|
|  | 429 |  | 
|---|
|  | 430 | begin | 
|---|
|  | 431 | //uVisitType.Free; | 
|---|
|  | 432 | uVitalOld.Free; | 
|---|
|  | 433 | uVitalNew.free; | 
|---|
|  | 434 |  | 
|---|
|  | 435 | {== Vitals Lite 2004-05-21 ===================================================} | 
|---|
|  | 436 | FreeLibrary(VitalsDLLHandle); | 
|---|
|  | 437 | {== Vitals Lite 2004-05-21 ===================================================} | 
|---|
|  | 438 | inherited; | 
|---|
|  | 439 | end; | 
|---|
|  | 440 |  | 
|---|
|  | 441 |  | 
|---|
|  | 442 |  | 
|---|
|  | 443 |  | 
|---|
|  | 444 | procedure TfrmEncVitals.lbllastClick(Sender: TObject); | 
|---|
|  | 445 | begin | 
|---|
|  | 446 | inherited; | 
|---|
|  | 447 | // | 
|---|
|  | 448 | try | 
|---|
|  | 449 | frmEncVitals.Show; | 
|---|
|  | 450 | except | 
|---|
|  | 451 | with sender as TStaticText do | 
|---|
|  | 452 | SelectVital(self.Font.Size, tag); | 
|---|
|  | 453 | end; //end of try | 
|---|
|  | 454 | end; | 
|---|
|  | 455 |  | 
|---|
|  | 456 |  | 
|---|
|  | 457 | procedure TfrmEncVitals.FormShow(Sender: TObject); | 
|---|
|  | 458 | var | 
|---|
|  | 459 | GMV_LibName: String; | 
|---|
|  | 460 | begin | 
|---|
|  | 461 | inherited; | 
|---|
|  | 462 | //Begin Vitals Lite | 
|---|
|  | 463 | {Visit is Assumed to Be selected when Opening Encounter Dialog} | 
|---|
|  | 464 | GMV_LibName :='GMV_VitalsViewEnter.dll'; | 
|---|
|  | 465 | GMV_LibName := GetProgramFilesPath + SHARE_DIR + GMV_LibName; | 
|---|
|  | 466 | VitalsDLLHandle := LoadLibrary(PChar(GMV_LibName)); | 
|---|
|  | 467 | if VitalsDLLHandle = 0 then // No Handle found | 
|---|
|  | 468 | //  MessageDLG('Can''t find library "'+GMV_LibName+'".',mtError,[mbok],0)  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 469 | MessageDLG(DKLangConstW('fEncVitals_Canxxt_find_library_x')+GMV_LibName+'".',mtError,[mbok],0) //kt added 8/8/2007 | 
|---|
|  | 470 | else | 
|---|
|  | 471 | LoadVitalsList; | 
|---|
|  | 472 | //End Vitals Lite | 
|---|
|  | 473 | //  frmEncVitals.caption := 'Vital entry for - '+ patient.name; {RAB 6/15/98} | 
|---|
|  | 474 | FormActivate(Sender); | 
|---|
|  | 475 | end; | 
|---|
|  | 476 |  | 
|---|
|  | 477 | procedure TfrmEncVitals.FormActivate(Sender: TObject); | 
|---|
|  | 478 | begin | 
|---|
|  | 479 | inherited; | 
|---|
|  | 480 | if(not FChangingFocus) and (not FDataLoaded) then | 
|---|
|  | 481 | begin | 
|---|
|  | 482 | FDataLoaded := TRUE; | 
|---|
|  | 483 | InitVitalPanel; | 
|---|
|  | 484 | //    txtMeasTemp.setfocus;  //added 3/30/99 after changing tab order. | 
|---|
|  | 485 | //The date is now first in tab order, but it shouldn't default there. | 
|---|
|  | 486 | end; | 
|---|
|  | 487 | end; | 
|---|
|  | 488 |  | 
|---|
|  | 489 |  | 
|---|
|  | 490 |  | 
|---|
|  | 491 | procedure TfrmEncVitals.cboPainChange(Sender: TObject); | 
|---|
|  | 492 | begin | 
|---|
|  | 493 | inherited; | 
|---|
|  | 494 | CheckVitalUnit; | 
|---|
|  | 495 | end; | 
|---|
|  | 496 |  | 
|---|
|  | 497 | procedure TfrmEncVitals.FormResize(Sender: TObject); | 
|---|
|  | 498 | begin | 
|---|
|  | 499 | inherited; | 
|---|
|  | 500 | //added to make things austo size that do not heave the property. | 
|---|
|  | 501 | cboTemp.height := txtmeastemp.height; | 
|---|
|  | 502 | cboPain.height := txtmeastemp.height; | 
|---|
|  | 503 | cboheight.height := txtmeastemp.height; | 
|---|
|  | 504 | cboweight.height := txtmeastemp.height; | 
|---|
|  | 505 | end; | 
|---|
|  | 506 |  | 
|---|
|  | 507 | procedure TfrmEncVitals.txtMeasTempExit(Sender: TObject); | 
|---|
|  | 508 | begin | 
|---|
|  | 509 | inherited; | 
|---|
|  | 510 | if(ActiveCtrl <> cboTemp) then | 
|---|
|  | 511 | begin | 
|---|
|  | 512 | if VitalInvalid(txtMeasTemp, cboTemp) then | 
|---|
|  | 513 | ChangeFocus(txtMeasTemp); | 
|---|
|  | 514 | end; | 
|---|
|  | 515 | end; | 
|---|
|  | 516 |  | 
|---|
|  | 517 | procedure TfrmEncVitals.txtMeasHtExit(Sender: TObject); | 
|---|
|  | 518 | begin | 
|---|
|  | 519 | inherited; | 
|---|
|  | 520 | if(ActiveCtrl <> cboHeight) then | 
|---|
|  | 521 | begin | 
|---|
|  | 522 | if VitalInvalid(txtMeasHt, cboHeight, GetVitHTRate) then | 
|---|
|  | 523 | ChangeFocus(txtMeasHt); | 
|---|
|  | 524 | end; | 
|---|
|  | 525 | end; | 
|---|
|  | 526 |  | 
|---|
|  | 527 | procedure TfrmEncVitals.txtMeasWtExit(Sender: TObject); | 
|---|
|  | 528 | begin | 
|---|
|  | 529 | inherited; | 
|---|
|  | 530 | if(ActiveCtrl <> cboWeight) then | 
|---|
|  | 531 | begin | 
|---|
|  | 532 | if VitalInvalid(txtMeasWt, cboWeight) then | 
|---|
|  | 533 | ChangeFocus(txtMeasWt); | 
|---|
|  | 534 | end; | 
|---|
|  | 535 | end; | 
|---|
|  | 536 |  | 
|---|
|  | 537 | procedure TfrmEncVitals.ChangeFocus(Control: TWinControl); | 
|---|
|  | 538 | begin | 
|---|
|  | 539 | FChangingFocus := TRUE; | 
|---|
|  | 540 | try | 
|---|
|  | 541 | Control.SetFocus; | 
|---|
|  | 542 | finally | 
|---|
|  | 543 | FChangingFocus := FALSE; | 
|---|
|  | 544 | end; | 
|---|
|  | 545 | end; | 
|---|
|  | 546 |  | 
|---|
|  | 547 | function TfrmEncVitals.OK2SaveVitals: boolean; | 
|---|
|  | 548 | begin | 
|---|
|  | 549 | SetupVars;  //kt added 8/8/2007 to replace constants with vars. | 
|---|
|  | 550 | Result := TRUE; | 
|---|
|  | 551 | if(HasData and (abs(txtMeasDate.FMDateTime) <= 0.0000000000001)) then | 
|---|
|  | 552 | begin | 
|---|
|  | 553 | Result := (InfoBox(TX_VDATE_REQ1 + FormatFMDateTime('mmm dd,yy@hh:nn', uEncPCEData.DateTime) + | 
|---|
|  | 554 | TX_VDATE_REQ2, TC_VDATE_REQ, MB_YESNO or MB_ICONWARNING) = IDYES); | 
|---|
|  | 555 | if Result then | 
|---|
|  | 556 | txtMeasDate.FMDateTime := uEncPCEData.DateTime | 
|---|
|  | 557 | else | 
|---|
|  | 558 | begin | 
|---|
|  | 559 | Result := (InfoBox(TX_KILLDATA, TC_VDATE_REQ, MB_YESNO or MB_ICONWARNING) = IDYES); | 
|---|
|  | 560 | if(Result) then | 
|---|
|  | 561 | ClearData; | 
|---|
|  | 562 | end; | 
|---|
|  | 563 | end; | 
|---|
|  | 564 | end; | 
|---|
|  | 565 |  | 
|---|
|  | 566 | procedure TfrmEncVitals.ClearData; | 
|---|
|  | 567 | begin | 
|---|
|  | 568 | txtMeasBP.text    := ''; | 
|---|
|  | 569 | txtMeasTemp.text  := ''; | 
|---|
|  | 570 | txtMeasResp.text  := ''; | 
|---|
|  | 571 | txtMeasPulse.text := ''; | 
|---|
|  | 572 | txtMeasHt.text    := ''; | 
|---|
|  | 573 | txtMeasWt.text    := ''; | 
|---|
|  | 574 | cboPain.text      := ''; | 
|---|
|  | 575 | end; | 
|---|
|  | 576 |  | 
|---|
|  | 577 | procedure TfrmEncVitals.FormKeyDown(Sender: TObject; var Key: Word; | 
|---|
|  | 578 | Shift: TShiftState); | 
|---|
|  | 579 | begin | 
|---|
|  | 580 | {capture return key press if on the vital screen} | 
|---|
|  | 581 | begin | 
|---|
|  | 582 | inherited; | 
|---|
|  | 583 | if (ActiveCtrl.tag in VitalDateTagSet)then | 
|---|
|  | 584 | begin | 
|---|
|  | 585 | if Key = VK_RETURN then | 
|---|
|  | 586 | begin | 
|---|
|  | 587 | Key := 0; | 
|---|
|  | 588 | if (ActiveCtrl.Tag = TAG_VITPAIN) then | 
|---|
|  | 589 | ChangeFocus(btnOK) | 
|---|
|  | 590 | else | 
|---|
|  | 591 | begin | 
|---|
|  | 592 | GetParentForm(Self).Perform(WM_NEXTDLGCTL,0,0); | 
|---|
|  | 593 | SetVitPointer(Sender); | 
|---|
|  | 594 | end; | 
|---|
|  | 595 | end; | 
|---|
|  | 596 | end; | 
|---|
|  | 597 | end; | 
|---|
|  | 598 | end; | 
|---|
|  | 599 |  | 
|---|
|  | 600 | //Begin Vitals Lite | 
|---|
|  | 601 | procedure TfrmEncVitals.LoadVitalView(VitalsList: TStringList); | 
|---|
|  | 602 | var | 
|---|
|  | 603 | i : integer; | 
|---|
|  | 604 | curCol : TListColumn; | 
|---|
|  | 605 | curItem : TListItem; | 
|---|
|  | 606 | HeadingList,tmpList : TStringList; | 
|---|
|  | 607 | begin | 
|---|
|  | 608 | HeadingList := TStringList.Create; | 
|---|
|  | 609 | tmpList := TStringList.Create; | 
|---|
|  | 610 | lvVitals.ShowColumnHeaders := false;                //CQ: 10069 - the column display becomes squished. | 
|---|
|  | 611 | lvVitals.Items.Clear; | 
|---|
|  | 612 | lvVitals.Columns.Clear; | 
|---|
|  | 613 | PiecesToList(VitalsList[0],U,HeadingList); | 
|---|
|  | 614 | for i := 0 to HeadingList.Count-1 do | 
|---|
|  | 615 | begin | 
|---|
|  | 616 | curCol := lvVitals.Columns.Add; | 
|---|
|  | 617 | curCol.Caption := HeadingList[i]; | 
|---|
|  | 618 | curCol.AutoSize := true; | 
|---|
|  | 619 | end; | 
|---|
|  | 620 | for i := 1 to VitalsList.Count-1 do | 
|---|
|  | 621 | begin | 
|---|
|  | 622 | curItem := lvVitals.Items.Add; | 
|---|
|  | 623 | PiecesToList(VitalsList[i],U,tmpList); | 
|---|
|  | 624 | curItem.Caption := tmpList[0]; | 
|---|
|  | 625 | tmpList.Delete(0); | 
|---|
|  | 626 | curItem.SubItems.Assign(tmpList); | 
|---|
|  | 627 | end; | 
|---|
|  | 628 | lvVitals.ShowColumnHeaders := true;                 //CQ: 10069 - the column display becomes squished. | 
|---|
|  | 629 | HeadingList.Free; | 
|---|
|  | 630 | tmpList.Free; | 
|---|
|  | 631 | end; | 
|---|
|  | 632 |  | 
|---|
|  | 633 | procedure TfrmEncVitals.btnEnterVitalsClick(Sender: TObject); | 
|---|
|  | 634 | var | 
|---|
|  | 635 | VLPtVitals : TGMV_VitalsEnterDLG; | 
|---|
|  | 636 | GMV_FName : String; | 
|---|
|  | 637 | begin | 
|---|
|  | 638 | inherited; | 
|---|
|  | 639 | if VitalsDLLHandle = 0 then Exit;//The DLL was initialized on Create, but just in case.... | 
|---|
|  | 640 | //GMV_FName := 'GMV_VitalsEnterDLG';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 641 | GMV_FName := DKLangConstW('fEncVitals_GMV_VitalsEnterDLG'); //kt added 8/8/2007 | 
|---|
|  | 642 | @VLPtVitals := GetProcAddress(VitalsDLLHandle,PChar(GMV_FName)); | 
|---|
|  | 643 | if assigned(VLPtVitals) then | 
|---|
|  | 644 | begin | 
|---|
|  | 645 | VLPtVitals( | 
|---|
|  | 646 | RPCBrokerV, | 
|---|
|  | 647 | Patient.DFN, | 
|---|
|  | 648 | FloatToStr(uEncPCEData.Location), | 
|---|
|  | 649 | GMV_DEFAULT_TEMPLATE, | 
|---|
|  | 650 | GMV_APP_SIGNATURE, | 
|---|
|  | 651 | FMDateTimeToDateTime(uEncPCEData.DateTime), | 
|---|
|  | 652 | Patient.Name, | 
|---|
|  | 653 | frmFrame.lblPtSSN.Caption + '    ' + frmFrame.lblPtAge.Caption | 
|---|
|  | 654 | ); | 
|---|
|  | 655 | end | 
|---|
|  | 656 | else | 
|---|
|  | 657 | //  MessageDLG('Can not find function "'+GMV_FName+'".',mtError,[mbok],0);  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 658 | MessageDLG(DKLangConstW('fEncVitals_Can_not_find_function_x')+GMV_FName+'".',mtError,[mbok],0); //kt added 8/8/2007 | 
|---|
|  | 659 | @VLPtVitals := nil; | 
|---|
|  | 660 | LoadVitalsList; | 
|---|
|  | 661 | end; | 
|---|
|  | 662 |  | 
|---|
|  | 663 | procedure TfrmEncVitals.LoadVitalsList; | 
|---|
|  | 664 | var | 
|---|
|  | 665 | VitalsList : TStringList; | 
|---|
|  | 666 | VLPtVitals : TGMV_LatestVitalsList; | 
|---|
|  | 667 | GMV_FName : String; | 
|---|
|  | 668 | begin | 
|---|
|  | 669 | if VitalsDLLHandle = 0 then Exit;//The DLL was initialized on Create, but just in case.... | 
|---|
|  | 670 | //GMV_FName := 'GMV_LatestVitalsList';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 671 | GMV_FName := DKLangConstW('fEncVitals_GMV_LatestVitalsList'); //kt added 8/8/2007 | 
|---|
|  | 672 | @VLPtVitals := GetProcAddress(VitalsDLLHandle,PChar(GMV_FName)); | 
|---|
|  | 673 | if assigned(VLPtVitals) then | 
|---|
|  | 674 | begin | 
|---|
|  | 675 | frmFrame.VitalsDLLActive := True;  // need this flag for CCOW (RV) | 
|---|
|  | 676 | VitalsList := VLPtVitals(RPCBrokerV,Patient.DFN,U,false); | 
|---|
|  | 677 | if assigned(VitalsList) then | 
|---|
|  | 678 | LoadVitalView(VitalsList); | 
|---|
|  | 679 | end | 
|---|
|  | 680 | else | 
|---|
|  | 681 | //  MessageDLG('Can''t find function "'+GMV_FName+'".',mtError,[mbok],0);  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 682 | MessageDLG(DKLangConstW('fEncVitals_Canxxt_find_function_x')+GMV_FName+'".',mtError,[mbok],0); //kt added 8/8/2007 | 
|---|
|  | 683 | @VLPtVitals := nil; | 
|---|
|  | 684 | frmFrame.VitalsDLLActive := False;  // need this flag for CCOW (RV) | 
|---|
|  | 685 | end; | 
|---|
|  | 686 | //End Vitals Lite | 
|---|
|  | 687 |  | 
|---|
|  | 688 | end. | 
|---|