source: cprs/branches/tmg-cprs/CPRS-Chart/rECS.pas@ 454

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 4.4 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 8/20/2007
2unit rECS;
3
4interface
5
6uses SysUtils, Windows, Classes, Forms, ORFn, rCore, uConst, ORClasses, ORNet, uCore;
7
8type
9 TECSReport = Class(TObject)
10 private
11 FReportHandle: string; // PCE report or Patient Summary report
12 FReportType : string; // D: display P: print
13 FPrintDEV : string; // if Print, the print device IEN
14 FReportStart : string; // Start Date
15 FReportEnd : string; // End Date
16 FNeedReason : string; // Need procedure reason ?
17 FECSPermit : boolean; // Authorized use of ECS
18 public
19 constructor Create;
20 property ReportHandle: string read FReportHandle write FReportHandle;
21 property ReportType : string read FReportType write FReportType;
22 property ReportStart : string read FReportStart write FReportStart;
23 property ReportEnd : string read FReportEnd write FReportEnd;
24 property PrintDEV : string read FPrintDEV write FPrintDEV;
25 property NeedReason : string read FNeedReason write FNeedReason;
26 property ECSPermit : boolean read FECSPermit write FECSPermit;
27 end;
28
29function GetVisitID: string;
30function GetDivisionID: string;
31function IsESSOInstalled: boolean;
32procedure SaveUserPath(APathInfo: string; var CurPath: string);
33procedure FormatECSDate(ADTStr: string; var AnECSRpt: TECSReport);
34procedure LoadECSReportText(Dest: TStrings; AnECSRpt: TECSReport);
35procedure PrintECSReportToDevice(AnECSRpt: TECSReport);
36
37implementation
38uses TRPCB;
39
40constructor TECSReport.Create;
41begin
42 ReportHandle := '';
43 ReportType := '';
44 ReportStart := '';
45 ReportEnd := '';
46 PrintDEV := '';
47 FNeedReason := '';
48 ECSPermit := False;
49end;
50
51function IsESSOInstalled: boolean;
52var
53 rtn: integer;
54begin
55 Result := False;
56 rtn := StrToIntDef(SCallV('ORECS01 CHKESSO',[nil]),0);
57 if rtn > 0 then
58 Result := True;
59end;
60
61function GetVisitID: string;
62var
63 vsitStr: string;
64begin
65 vsitStr := Encounter.VisitStr + ';' + Patient.DFN;
66 Result := SCallV('ORECS01 VSITID',[vsitStr]);
67end;
68
69function GetDivisionID: string;
70var
71 divID: string;
72begin
73 divID := SCallV('ORECS01 GETDIV',[nil]);
74 Result := divID;
75end;
76
77procedure SaveUserPath(APathInfo: string; var CurPath: string);
78begin
79 CurPath := SCallV('ORECS01 SAVPATH',[APathInfo]);
80end;
81
82procedure FormatECSDate(ADTStr: string; var AnECSRpt: TECSReport);
83var
84 x,DaysBack :string;
85 Alpha, Omega: double;
86begin
87 Alpha := 0;
88 Omega := 0;
89 if CharAt(ADTStr, 1) = 'T' then
90 begin
91 Alpha := StrToFMDateTime(Piece(ADTStr,';',1));
92 Omega := StrToFMDateTime(Piece(ADTStr,';',2));
93 end;
94 if CharAt(ADTStr, 1) = 'd' then
95 begin
96 x := Piece(ADTStr,';',1);
97 DaysBack := Copy(x, 2, Length(x));
98 Alpha := StrToFMDateTime('T-' + DaysBack);
99 Omega := StrToFMDateTime('T');
100 end;
101 AnECSRpt.ReportStart := FloatToStr(Alpha);
102 AnECSRpt.ReportEnd := FloatToStr(Omega);
103end;
104
105procedure LoadECSReportText(Dest: TStrings; AnECSRpt: TECSReport);
106var
107 userid: string;
108begin
109 with RPCBrokerv do
110 begin
111 ClearParameters := True;
112 RemoteProcedure := 'ORECS01 ECRPT';
113 Param[0].PType := list;
114 Param[0].Mult['"ECHNDL"'] := AnECSRpt.ReportHandle;
115 Param[0].Mult['"ECPTYP"'] := AnECSRpt.ReportType;
116 Param[0].Mult['"ECDEV"'] := AnECSRpt.PrintDEV;
117 Param[0].Mult['"ECDFN"'] := Patient.DFN;
118 Param[0].Mult['"ECSD"'] := AnECSRpt.ReportStart;
119 Param[0].Mult['"ECED"'] := AnECSRpt.ReportEnd;
120 Param[0].Mult['"ECRY"'] := AnECSRpt.NeedReason;
121 Param[0].Mult['"ECDUZ"'] := userid;
122 CallBroker;
123 end;
124 QuickCopy(RPCBrokerV.Results,Dest);
125end;
126
127procedure PrintECSReportToDevice(AnECSRpt: TECSReport);
128var
129 userid: string;
130begin
131 userid := IntToStr(User.DUZ);
132 with RPCBrokerV do
133 begin
134 clearParameters := True;
135 RemoteProcedure := 'ORECS01 ECPRINT';
136 Param[0].PType := List;
137 Param[0].Mult['"ECHNDL"'] := AnECSRpt.ReportHandle;
138 Param[0].Mult['"ECPTYP"'] := AnECSRpt.ReportType;
139 Param[0].Mult['"ECDEV"'] := AnECSRpt.PrintDEV;
140 Param[0].Mult['"ECDFN"'] := Patient.DFN;
141 Param[0].Mult['"ECSD"'] := AnECSRpt.ReportStart;
142 Param[0].Mult['"ECED"'] := AnECSRpt.ReportEnd;
143 Param[0].Mult['"ECRY"'] := AnECSRpt.NeedReason;
144 Param[0].Mult['"ECDUZ"'] := userid;
145 CallBroker;
146 end;
147end;
148
149end.
Note: See TracBrowser for help on using the repository browser.