source: cprs/trunk/CPRS-Chart/rECS.pas@ 1707

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

Upgrading to version 27

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