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