1 | //kt -- Modified with SourceScanner on 8/20/2007
|
---|
2 | unit rECS;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses SysUtils, Windows, Classes, Forms, ORFn, rCore, uConst, ORClasses, ORNet, uCore;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
29 | function GetVisitID: string;
|
---|
30 | function GetDivisionID: string;
|
---|
31 | function IsESSOInstalled: boolean;
|
---|
32 | procedure SaveUserPath(APathInfo: string; var CurPath: string);
|
---|
33 | procedure FormatECSDate(ADTStr: string; var AnECSRpt: TECSReport);
|
---|
34 | procedure LoadECSReportText(Dest: TStrings; AnECSRpt: TECSReport);
|
---|
35 | procedure PrintECSReportToDevice(AnECSRpt: TECSReport);
|
---|
36 |
|
---|
37 | implementation
|
---|
38 | uses TRPCB;
|
---|
39 |
|
---|
40 | constructor TECSReport.Create;
|
---|
41 | begin
|
---|
42 | ReportHandle := '';
|
---|
43 | ReportType := '';
|
---|
44 | ReportStart := '';
|
---|
45 | ReportEnd := '';
|
---|
46 | PrintDEV := '';
|
---|
47 | FNeedReason := '';
|
---|
48 | ECSPermit := False;
|
---|
49 | end;
|
---|
50 |
|
---|
51 | function IsESSOInstalled: boolean;
|
---|
52 | var
|
---|
53 | rtn: integer;
|
---|
54 | begin
|
---|
55 | Result := False;
|
---|
56 | rtn := StrToIntDef(SCallV('ORECS01 CHKESSO',[nil]),0);
|
---|
57 | if rtn > 0 then
|
---|
58 | Result := True;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | function GetVisitID: string;
|
---|
62 | var
|
---|
63 | vsitStr: string;
|
---|
64 | begin
|
---|
65 | vsitStr := Encounter.VisitStr + ';' + Patient.DFN;
|
---|
66 | Result := SCallV('ORECS01 VSITID',[vsitStr]);
|
---|
67 | end;
|
---|
68 |
|
---|
69 | function GetDivisionID: string;
|
---|
70 | var
|
---|
71 | divID: string;
|
---|
72 | begin
|
---|
73 | divID := SCallV('ORECS01 GETDIV',[nil]);
|
---|
74 | Result := divID;
|
---|
75 | end;
|
---|
76 |
|
---|
77 | procedure SaveUserPath(APathInfo: string; var CurPath: string);
|
---|
78 | begin
|
---|
79 | CurPath := SCallV('ORECS01 SAVPATH',[APathInfo]);
|
---|
80 | end;
|
---|
81 |
|
---|
82 | procedure FormatECSDate(ADTStr: string; var AnECSRpt: TECSReport);
|
---|
83 | var
|
---|
84 | x,DaysBack :string;
|
---|
85 | Alpha, Omega: double;
|
---|
86 | begin
|
---|
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);
|
---|
103 | end;
|
---|
104 |
|
---|
105 | procedure LoadECSReportText(Dest: TStrings; AnECSRpt: TECSReport);
|
---|
106 | var
|
---|
107 | userid: string;
|
---|
108 | begin
|
---|
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);
|
---|
125 | end;
|
---|
126 |
|
---|
127 | procedure PrintECSReportToDevice(AnECSRpt: TECSReport);
|
---|
128 | var
|
---|
129 | userid: string;
|
---|
130 | begin
|
---|
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;
|
---|
147 | end;
|
---|
148 |
|
---|
149 | end.
|
---|