Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/fLabs.pas
- Timestamp:
- Jul 6, 2008, 8:20:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/foia-cprs/CPRS-Chart/fLabs.pas
r459 r460 7 7 fHSplit, StdCtrls, ExtCtrls, ORCtrls, ComCtrls, Grids, Buttons, fLabTest, 8 8 fLabTests, fLabTestGroups, ORFn, TeeProcs, TeEngine, Chart, Series, Menus, 9 uConst, ORDtTmRng, OleCtrls, SHDocVw, Variants ;9 uConst, ORDtTmRng, OleCtrls, SHDocVw, Variants, StrUtils; 10 10 11 11 type … … 83 83 TabControl1: TTabControl; 84 84 WebBrowser1: TWebBrowser; 85 lblGraph: TLabel; 85 86 procedure FormCreate(Sender: TObject); 86 87 procedure DisplayHeading; … … 133 134 procedure Memo1KeyUp(Sender: TObject; var Key: Word; 134 135 Shift: TShiftState); 136 procedure UpdateRemoteStatus(aSiteID, aStatus: string); 135 137 private 136 138 { Private declarations } … … 159 161 function FMToDateTime(FMDateTime: string): TDateTime; 160 162 procedure RequestPrint; override; 163 procedure ExtlstReportsClick(Sender: TObject; Ext: boolean); 161 164 162 165 end; … … 169 172 uLabLocalReportData: TStringList; //Storage for Local report data 170 173 uLabRemoteReportData: TStringList; //Storage for Remote lab query 174 uUpdateStat: boolean; //flag turned on when remote status is being updated 171 175 172 176 implementation 173 177 174 178 uses uCore, rLabs, rCore, rCover, rOrders, fLabPrint, fFrame, fRptBox, Printers, 175 clipbrd, rReports, activex, mshtml, uAccessibleStringGrid;179 clipbrd, rReports, rGraphs, activex, mshtml, uAccessibleStringGrid; 176 180 177 181 const … … 189 193 var 190 194 uFrozen: Boolean; 195 uGraphingActivated: Boolean; 191 196 uRemoteCount: Integer; 192 197 uHTMLDoc: string; … … 240 245 241 246 procedure TfrmLabs.FormCreate(Sender: TObject); 247 var 248 aList: TStrings; 242 249 begin 243 250 inherited; … … 246 253 memLab.Color := ReadOnlyColor; 247 254 uFrozen := False; 255 aList := TStringList.Create; 256 FastAssign(rpcGetGraphSettings, aList); 257 uGraphingActivated := aList.Count > 0; 258 aList.Free; 248 259 uRemoteCount := 0; 249 260 tmpGrid := TStringList.Create; … … 258 269 SerTest.GetHorizAxis.Increment := DateTimeStep[dtOneMinute]; 259 270 TAccessibleStringGrid.WrapControl(grdLab); 271 end; 272 273 procedure TfrmLabs.UpdateRemoteStatus(aSiteID, aStatus: string); 274 var 275 j: integer; 276 s: string; 277 c: boolean; 278 begin 279 if uUpdateStat = true then exit; //uUpdateStat also looked at in fFrame 280 uUpdateStat := true; 281 for j := 0 to frmFrame.lstCIRNLocations.Items.Count - 1 do 282 begin 283 s := frmFrame.lstCIRNLocations.Items[j]; 284 c := frmFrame.lstCIRNLocations.checked[j]; 285 if piece(s, '^', 1) = aSiteID then 286 begin 287 frmFrame.lstCIRNLocations.Items[j] := pieces(s, '^', 1, 3) + '^' + aStatus; 288 frmFrame.lstCIRNLocations.checked[j] := c; 289 end; 290 end; 291 uUpdateStat := false; 260 292 end; 261 293 … … 296 328 TabControl1.Tabs.Clear; 297 329 TabControl1.Visible := false; 330 tmpGrid.Clear; 298 331 with grdLab do 299 332 begin … … 374 407 375 408 procedure TfrmLabs.lstReportsClick(Sender: TObject); 409 begin 410 ExtlstReportsClick(Sender, false); 411 end; 412 413 procedure TfrmLabs.ExtlstReportsClick(Sender: TObject; Ext: boolean); 376 414 var 377 415 i,iCat: integer; … … 436 474 lblSpecimen.Caption := ''; 437 475 end; 438 SelectTests(Font.Size);476 if not Ext then SelectTests(Font.Size); 439 477 if lstTests.Items.Count > 0 then 440 478 begin … … 445 483 RedrawActivate(memLab.Handle); 446 484 lstDatesClick(self); 447 cmdOtherTests.SetFocus;485 if not Ext then cmdOtherTests.SetFocus; 448 486 cmdOtherTests.Default := true; 449 487 end 450 else uPrevReportIndex := lstReports.ItemIndex;488 else lstReports.ItemIndex := uPrevReportIndex; 451 489 end; 452 490 5: begin // Worksheet … … 456 494 lblSpecimen.Caption := ''; 457 495 end; 458 SelectTestGroups(Font.Size);496 if not Ext then SelectTestGroups(Font.Size); 459 497 if lstTests.Items.Count > 0 then 460 498 begin … … 472 510 //chkZoomClick(self); 473 511 lstDatesClick(self); 474 cmdOtherTests.SetFocus;512 if not Ext then cmdOtherTests.SetFocus; 475 513 cmdOtherTests.Default := true; 476 514 end 477 else uPrevReportIndex := lstReports.ItemIndex;515 else lstReports.ItemIndex := uPrevReportIndex; 478 516 end; 479 517 6: begin // Graph 480 if uPrevReportIndex <> lstReports.ItemIndex then 518 // do if graphing is activiated 519 if uGraphingActivated then 481 520 begin 482 lblSingleTest.Caption := ''; 483 lblSpecimen.Caption := ''; 484 end; 485 SelectTest(Font.Size); 486 if (length(lblSingleTest.Caption) > 2) and (length(lblSpecimen.Caption) > 2) then 521 memLab.Clear; 522 chkBrowser; 523 FormResize(self); 524 memLab.Align := alClient; 525 CommonComponentVisible(false,false,false,false,false,false,false,false,false); 526 RedrawActivate(memLab.Handle); 527 StatusText(''); 528 memLab.Lines.Insert(0, ' '); 529 memLab.Lines.Insert(1, 'Graphing activated'); 530 memLab.SelStart := 0; 531 frmFrame.mnuToolsGraphingClick(self); // make it just lab tests ?? 532 //lstReports.ItemIndex := uPrevReportIndex; 533 end 534 else // otherwise, do lab graph 487 535 begin 488 CommonComponentVisible(false,false,true,true,true,true,false,false,true); 489 pnlChart.Visible := true; 490 chtChart.Visible := true; 491 pnlButtons.Visible := false; 492 pnlWorksheet.Visible := false; 493 pnlGraph.Visible := true; 494 memLab.Height := pnlRight.Height div 5; 495 memLab.Clear; 496 if uReportType = 'H' then 536 if uPrevReportIndex <> lstReports.ItemIndex then 537 begin 538 lblSingleTest.Caption := ''; 539 lblSpecimen.Caption := ''; 540 end; 541 if not Ext then SelectTest(Font.Size); 542 if (length(lblSingleTest.Caption) > 2) and (length(lblSpecimen.Caption) > 2) then 543 begin 544 CommonComponentVisible(false,false,true,true,true,true,false,false,true); 545 pnlChart.Visible := true; 546 chtChart.Visible := true; 547 pnlButtons.Visible := false; 548 pnlWorksheet.Visible := false; 549 pnlGraph.Visible := true; 550 memLab.Height := pnlRight.Height div 5; 551 memLab.Clear; 552 if uReportType = 'H' then 497 553 begin 498 554 WebBrowser1.Visible := true; … … 502 558 memLab.Visible := false; 503 559 end 560 else 561 begin 562 WebBrowser1.Visible := false; 563 WebBrowser1.SendToBack; 564 memLab.Visible := true; 565 memLab.BringToFront; 566 end; 567 lstTestGraph.Items.Clear; 568 lstTestGraph.Width := 0; 569 FormResize(self); 570 RedrawActivate(memLab.Handle); 571 lblFooter.Caption := ''; 572 chkGraphZoom.Checked := false; 573 chkGraphZoomClick(self); 574 chkGraph3DClick(self); 575 chkGraphValuesClick(self); 576 lstDatesClick(self); 577 if not Ext then cmdOtherTests.SetFocus; 578 cmdOtherTests.Default := true; 579 end 504 580 else 505 begin 506 WebBrowser1.Visible := false; 507 WebBrowser1.SendToBack; 508 memLab.Visible := true; 509 memLab.BringToFront; 510 end; 511 lstTestGraph.Items.Clear; 512 lstTestGraph.Width := 0; 513 FormResize(self); 514 RedrawActivate(memLab.Handle); 515 lblFooter.Caption := ''; 516 chkGraphZoom.Checked := false; 517 chkGraphZoomClick(self); 518 chkGraph3DClick(self); 519 chkGraphValuesClick(self); 520 lstDatesClick(self); 521 cmdOtherTests.SetFocus; 522 cmdOtherTests.Default := true; 523 end 524 else uPrevReportIndex := lstReports.ItemIndex; 525 end; 526 else 581 lstReports.ItemIndex := uPrevReportIndex; 582 end; 583 end 584 else // case 527 585 begin 528 586 //added to deal with other reports from file 101.24 … … 734 792 end; 735 793 6: begin // Graph 736 chtChart.BottomAxis.Automatic := true; 737 chkGraphZoom.Checked := false; 738 chkGraphZoomClick(self); 739 memLab.Clear; 740 uLabLocalReportData.Clear; 741 uLabRemoteReportData.Clear; 742 tmpList := TStringList.Create; 743 try 744 StatusText('Retrieving data for graph...'); 745 tmpList.Assign(GetChart(Patient.DFN, date1, date2, 746 Piece(lblSpecimen.Caption, '^', 1), 747 Piece(lblSingleTest.Caption, '^', 1))); 748 if tmpList.Count > 1 then 749 begin 750 chtChart.Visible := true; 751 GraphChart(lblSingleTest.Caption, tmpList); 752 chtChart.ZoomPercent(ZOOM_PERCENT); 753 for i := strtoint(Piece(tmpList[0], '^', 1)) + 1 to tmpList.Count - 1 754 do memLab.Lines.Add(tmpList[i]); 755 if memLab.Lines.Count < 2 then 756 memLab.Lines.Add('<No comments on specimens.>'); 757 memLab.SelStart := 0; 758 end 759 else 760 begin 761 if Piece(lblSpecimen.Caption, '^', 1) = '0' then 762 pnlChart.Caption := '<No results can be graphed for ' + 763 Piece(lblSingleTest.Caption, '^', 2) + ' in this date range.>' 794 if not uGraphingActivated then 795 begin 796 chtChart.BottomAxis.Automatic := true; 797 chkGraphZoom.Checked := false; 798 chkGraphZoomClick(self); 799 memLab.Clear; 800 uLabLocalReportData.Clear; 801 uLabRemoteReportData.Clear; 802 tmpList := TStringList.Create; 803 try 804 StatusText('Retrieving data for graph...'); 805 tmpList.Assign(GetChart(Patient.DFN, date1, date2, 806 Piece(lblSpecimen.Caption, '^', 1), 807 Piece(lblSingleTest.Caption, '^', 1))); 808 if tmpList.Count > 1 then 809 begin 810 chtChart.Visible := true; 811 GraphChart(lblSingleTest.Caption, tmpList); 812 chtChart.ZoomPercent(ZOOM_PERCENT); 813 for i := strtoint(Piece(tmpList[0], '^', 1)) + 1 to tmpList.Count - 1 814 do memLab.Lines.Add(tmpList[i]); 815 if memLab.Lines.Count < 2 then 816 memLab.Lines.Add('<No comments on specimens.>'); 817 memLab.SelStart := 0; 818 lblGraph.Visible := false; 819 end 764 820 else 765 pnlChart.Caption := '<No results can be graphed for ' + 766 Piece(lblSingleTest.Caption, '^', 2) 767 + ' (' + Piece(lblSpecimen.Caption, '^', 2) + 768 ') in this date range.>'; 769 chtChart.Visible := false; 821 begin 822 lblGraph.Left := chtChart.Left + ((chtChart.Width - lblGraph.Width) div 2); 823 lblGraph.Top := 2; 824 lblGraph.Visible := true; 825 if Piece(lblSpecimen.Caption, '^', 1) = '0' then 826 pnlChart.Caption := '<No results can be graphed for ' + 827 Piece(lblSingleTest.Caption, '^', 2) + ' in this date range.> ' 828 + 'Results may be available, but cannot be graphed. Please try an alternate view.' 829 else 830 pnlChart.Caption := '<No results can be graphed for ' + 831 Piece(lblSingleTest.Caption, '^', 2) 832 + ' (' + Piece(lblSpecimen.Caption, '^', 2) + 833 ') in this date range.> ' 834 + 'Results may be available, but cannot be graphed. Please try an alternate view.'; 835 chtChart.Visible := false; 836 end; 837 finally 838 tmpList.Free; 770 839 end; 771 finally772 tmpList.Free;773 840 end; 774 841 end; … … 1285 1352 if valuecount = 0 then 1286 1353 begin 1354 lblGraph.Left := chtChart.Left + ((chtChart.Width - lblGraph.Width) div 2); 1355 lblGraph.Top := 2; 1356 lblGraph.Visible := true; 1287 1357 if length(Piece(specimen, '^', 2)) > 0 then 1288 pnlChart.Caption := '<No results can be graphed for ' + serTest.Title + ' in this date range.> '1358 pnlChart.Caption := '<No results can be graphed for ' + serTest.Title + ' in this date range.> ' 1289 1359 else 1290 1360 pnlChart.Caption := '<No results can be graphed for ' + Piece(test, '^', 2) + ' in this date range.>'; 1291 1361 chtChart.Visible := false; 1292 end; 1362 end 1363 else 1364 lblGraph.Visible := false; 1293 1365 if not chkZoom.Checked then 1294 1366 begin … … 1350 1422 memLab.Align := alBottom; 1351 1423 grdLab.Align := alClient; 1424 if tmpGrid.Count > 0 then HGrid(tmpGrid); 1352 1425 if (grdLab.VisibleRowCount + 1) < grdLab.RowCount then 1353 1426 grdLab.ColWidths[4] := grdLab.ColWidths[4] - 18; … … 1387 1460 end; 1388 1461 6: begin // Graph 1389 memLab.Height := pnlLeft.Height div 4; 1390 memLab.Align := alBottom; 1391 pnlChart.Top := pnlHeader.Height; 1392 pnlChart.Align := alClient; 1393 memLab.Height := pnlLeft.Height div 4; 1394 memLab.Align := alBottom; 1395 memLab.Repaint; 1462 if not uGraphingActivated then 1463 begin 1464 memLab.Height := pnlLeft.Height div 4; 1465 memLab.Align := alBottom; 1466 pnlChart.Top := pnlHeader.Height; 1467 pnlChart.Align := alClient; 1468 memLab.Height := pnlLeft.Height div 4; 1469 memLab.Align := alBottom; 1470 memLab.Repaint; 1471 end; 1396 1472 end; 1397 1473 7: begin // Anatomic Path … … 1985 2061 Timer1.Enabled := False; 1986 2062 TRemoteSite(Items[i]).LabQueryStatus := '-1^Timed out'; 2063 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Timed out'); 1987 2064 StatusText(''); 1988 2065 TabControl1.OnChange(nil); … … 2034 2111 begin 2035 2112 TRemoteSite(Items[i]).LabClear; 2113 if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') then 2114 begin 2115 TRemoteSite(Items[i]).LabQueryStatus := '1^Not Included'; 2116 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED'); 2117 TabControl1.OnChange(nil); 2118 continue; 2119 end; 2036 2120 TRemoteSite(Items[i]).CurrentLabQuery := 'Lab' + Patient.DFN + ';' + Patient.ICN + 2037 2121 '^' + IntToStr(AItem) + '^' + IntToStr(AReportID) + '^^' + ARpc + '^' + AHSType + … … 2055 2139 TRemoteSite(Items[i]).LabRemoteHandle := ''; 2056 2140 TRemoteSite(Items[i]).LabQueryStatus := '1^Done'; 2141 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Done'); 2057 2142 TabControl1.OnChange(nil); 2058 2143 end … … 2084 2169 end; 2085 2170 if Dest[0] = '' then 2086 TRemoteSite(Items[i]).LabQueryStatus := '-1^Communication error' 2171 begin 2172 TRemoteSite(Items[i]).LabQueryStatus := '-1^Communication error'; 2173 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Communication error'); 2174 end 2087 2175 else 2088 2176 begin 2089 2177 TRemoteSite(Items[i]).LabRemoteHandle := Dest[0]; 2090 2178 TRemoteSite(Items[i]).LabQueryStatus := '0^initialization...'; 2179 UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Initialization'); 2091 2180 Timer1.Enabled := True; 2092 2181 StatusText('Retrieving reports from '
Note:
See TracChangeset
for help on using the changeset viewer.