source: WorldVistAEHR/trunk/r/ASISTS-OOPS/OOPSGUIS.m@ 1716

Last change on this file since 1716 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.4 KB
Line 
1OOPSGUIS ;WIOFO/LLH-RPC Broker calls for GUI ;03/25/04
2 ;;2.0;ASISTS;**8,11**;Jun 03, 2002
3 ;
4STA(RESULTS) ; Get listing of Stations from Edit Site Parameter
5 ;
6 ; Output: RESULTS contains a listing or all stations listed in the
7 ; Edit Site Parameter file. This list will be used for
8 ; selecting a station from any field that expects an entry
9 ; from the Institution file. If no stations exist, then
10 ; a call will automatically be made to GETINST^OOPSGUI7
11 ; to use the rpc to get all the stations.
12 ;
13 N ARR,CN,FAC,IFLAG,SNAME,SNUM,SP,STA,VAL
14 K ^TMP("OOPSINST",$J)
15 S (CN,SP)=0
16 F S SP=$O(^OOPS(2262,SP)) Q:SP="" S STA=0 D
17 .F S STA=$O(^OOPS(2262,SP,STA)) Q:STA'>0 S IEN=0 D
18 ..F S IEN=$O(^OOPS(2262,SP,STA,IEN)) Q:IEN'>0 D
19 ...S FAC=$P($G(^OOPS(2262,SP,STA,IEN,0)),U,1)
20 ...I '$G(FAC) Q
21 ...; have station #, now go to the institution file and get the info
22 ...I $$GET1^DIQ(4,FAC,101)=1 Q ; FAC inactive, don't get
23 ...S SNAME=$$GET1^DIQ(4,FAC,.01) I $G(SNAME)="" Q
24 ...S SNUM=$$GET1^DIQ(4,FAC,99)
25 ...S VAL=SNAME_" = "_SNUM
26 ...S CN=CN+1,^TMP("OOPSINST",$J,CN)=FAC_":"_VAL_$C(10)
27 S CN=CN+1,^TMP("OOPSINST",$J,CN)="999999:All Stations"
28 I CN=1 D GETINST^OOPSGUI7(.ARR) Q ; if only entry = all get all
29 S RESULTS=$NA(^TMP("OOPSINST",$J))
30 Q
31 ;
32SIGNCA7(RESULTS,INPUT,SIGN) ; Validates Electronic Signature and creates
33 ; validation code to ensure data not changed
34 ; Input: INPUT - FILE^FIELD^IEN where File and Field are the file
35 ; and field the data is being filed into and IEN
36 ; is the internal record number.
37 ; SIGN - the electronic signature to be encrypted
38 ; Output: RESULTS - is an array containing a list of fields that did
39 ; not pass data validation prior to applying the ES.
40 ;
41 N CALL,CHKSUM,IEN,ESIG,FILE,FLD,FLD48,FLD84,FLD95,FLD96,FLD97,REC,REC1
42 N SIGNBLK,VALID,VER,DR,DA,DIE
43 S RESULTS="SIGNED"
44 S FILE=$P($G(INPUT),U),FLD=$P($G(INPUT),U,2),IEN=$P($G(INPUT),U,3)
45 I '$G(IEN)!('$G(FILE))!('$G(FLD)) S RESULTS(1)="Invalid Parameters" Q
46 I $G(SIGN)="" S RESULTS="No signature passed in" Q
47 S CALL=$S(FLD=48:"E",FLD=84:"W",1:"")
48 I CALL="" S RESULTS="Invalid field number" Q
49 ; S VALID=0 D CHKFLD(IEN,CALL.VALID) I 'VALID Q
50 S ESIG=$$HASH($$DECRYP^XUSRB1(SIGN))
51 I $G(ESIG)=""!(ESIG'=$P($G(^VA(200,DUZ,20)),U,4)="") D Q
52 . S RESULTS="Invalid Electronic Signature"
53 S SIGNBLK=$P($G(^VA(200,DUZ,20)),U,2)
54 I SIGNBLK="" S RESULTS="No signature block on file" Q
55 K DR S DIE="^OOPS("_FILE_",",DA=IEN
56 D NOW^%DTC S DTIME=%
57 I CALL="E" D
58 .S REC=$G(^OOPS(FILE,IEN,0)),REC1=$G(^OOPS(FILE,IEN,"CA7S2"))
59 .S CHKSUM=$$SUM(IEN_U_REC_U_REC1)
60 .S FLD48=$$ENCODE(SIGNBLK,DUZ,CHKSUM),FLD96=1
61 .S FLD95=$$SUM(SIGNBLK)
62 .S DR="47////^S X=+DUZ;48////^S X=FLD48;49////^S X=DTIME"
63 .S DR=DR_";95////^S X=FLD95;96////^S X=FLD96"
64 I CALL="W" D
65 .S REC=$G(^OOPS(FILE,IEN,"CA7S10")),REC1=$G(^OOPS(FILE,IEN,"CA7S13"))
66 .S CHKSUM=$$SUM(IEN_U_REC_U_REC1)
67 .S FLD84=$$ENCODE(SIGNBLK,DUZ,CHKSUM)
68 .S FLD97=$$SUM(SIGNBLK)
69 .S DR="83////^S X=+DUZ;84////^S X=FLD84;85////^S X=DTIME"
70 .S DR=DR_";97////^S X=FLD97"
71 D ^DIE
72 I $G(Y)'="" S RESULTS="Problem filing E-Signature" Q
73 ; patch 11 - send bulletin when employee signs CA7
74 I CALL="E" D
75 .N GRP,X0,STR
76 .S X0=$P($G(^OOPS(2264,IEN,0)),U,5)
77 .S STR=$G(^OOPS(2260,X0,0)) K XMY
78 .S XMB(1)=$$GET1^DIQ(2260,X0,4)
79 .S XMB(2)=$P(STR,U,1)
80 .S XMB="OOPS EMPSIGNCA7"
81 .S GRP="OOPS WCP"
82 .D MFAC^OOPSMBUL
83 .D ^XMB K XMB,XMY,XMM,XMDT
84 Q
85HASH(X) ;
86 D HASH^XUSHSHP
87 Q X
88ENCODE(X,X1,X2) ; X=SIGN BLK, X1=DUZ, X2=CHKSUM CRITICAL FIELDS
89 D EN^XUSHSHP
90 Q X
91DECODE(RESULTS,IEN,CALL,FORM) ;
92 ; Call to return electronic signature to readable form
93 ; Input: IEN - internal record number of CA7 case
94 ; CALL - call menu - either E (Employee) or W (Workers Comp)
95 ; FORM - form - right now only expects CA7
96 ; Output: RESULTS - readable electronic signature
97 ;
98 N FILE,NODE,REC,REC1,VAL,VALID,VER,X,X1,X2
99 S RESULTS="",VALID=1
100 I '$G(IEN)!($G(CALL)="")!($G(FORM)="") Q
101 S (NODE,FILE,VER)=""
102 I FORM="CA7" S FILE=2264
103 S NODE=$S(CALL="E":"CA7S7",CALL="W":"CA7S15",1:"")
104 I FILE=""!(NODE="") Q
105 S VER=$P($G(^OOPS(FILE,IEN,"CA7S7")),U,5) I VER'=1 Q
106 I CALL="E" D
107 .S VAL=$P($G(^OOPS(FILE,IEN,"CA7S7")),U,4) I VAL="" S VALID=0
108 .S REC=$G(^OOPS(FILE,IEN,0)),REC1=$G(^OOPS(FILE,IEN,"CA7S2"))
109 I CALL="W" D
110 .S VAL=$P($G(^OOPS(FILE,IEN,"CA7S15")),U,11) I VAL="" S VALID=0
111 .S REC=$G(^OOPS(FILE,IEN,"CA7S10")),REC1=$G(^OOPS(FILE,IEN,"CA7S13"))
112 ;
113 I 'VALID Q
114 S X=$P($G(^OOPS(FILE,IEN,NODE)),U,2) I X="" Q ; ES VALIDATION #
115 S X1=$P($G(^OOPS(FILE,IEN,NODE)),U,1) ; USER NUMBER
116 S X2=$$SUM(IEN_U_REC_U_REC1) ; CHECKSUM
117 D DE^XUSHSHP
118 ; I $$SUM(X)'=VAL S X="DECODING FAILED"
119 S RESULTS=X
120 Q
121 ;
122SUM(X) ;CALCULATE CHECKSUM VALUE FOR STRING
123 N I,Y
124 S Y=0 F I=1:1:$L(X) S Y=$A(X,I)*I+Y
125 Q Y
126CLRES(IEN,CALL,FORM) ; Clear signature from CA7, if necessary
127 ; Input: IEN - record IEN for CA7
128 ; CALL - calling menu - either E (EMP) or W (Workers comp)
129 ; FORM - form where ES should be removed (now only CA7)
130 N FILE,SIG,NODE,FIELD
131 S (FILE,SIG,NODE,FIELD)="",RESULTS="FAILED"
132 I ('$G(IEN)),($G(CALL)=""),($G(FORM)="") Q
133 I FORM="CA7" S FILE=2264
134 I FILE=2264 D
135 .I CALL="E" S SIG="CA7S7;1,5"
136 .I CALL="W" S SIG="CA7S15;1,3"
137 S NODE=$P(SIG,";") Q:NODE=""
138 S FIELD=$P(SIG,";",2)
139 I '$D(^OOPS(FILE,IEN,NODE)) Q
140 F I=$P(FIELD,","):1:$P(FIELD,",",2) S $P(^OOPS(FILE,IEN,NODE),U,I)=""
141 Q
142GETDLOC(RESULTS,INPUT) ; Get Detail Loc for specific incident setting
143 ; Input: INPUT - File _"^"_Station IEN from a station in the
144 ; site par file_"^"_rec ien from file to retrieve
145 ; subfile information for.
146 ; Output: RESULTS - listing of valid sub file data
147 ;
148 N CN,FIEN,FILE,I,REC,STA
149 S CN=0
150 S FILE=$P($G(INPUT),U,1),STA=$P($G(INPUT),U,2),FIEN=$P($G(INPUT),U,3)
151 I FILE=""!(STA="")!(FIEN="") D Q
152 . S ^TMP($J,"DLOC",CN)="MISSING PARAMETERS",RESULTS=$NA(^TMP($J,"DLOC"))
153 S REC=$O(^OOPS(FILE,FIEN,1,"B",STA,""))
154 I '$G(REC) S ^TMP($J,"DLOC",CN)="NO DETAIL LOCATIONS LOADED",RESULTS=$NA(^TMP($J,"DLOC")) Q
155 I '$D(^OOPS(FILE,"F",REC,FIEN)) D Q
156 .S ^TMP($J,"DLOC",CN)="NO DETAIL LOCATIONS LOADED",RESULTS=$NA(^TMP($J,"DLOC"))
157 S DATA=""
158 F S DATA=$O(^OOPS(FILE,"F",REC,FIEN,DATA)) Q:DATA="" S DATAIEN=0 D
159 .S DATAIEN=$O(^OOPS(FILE,"F",REC,FIEN,DATA,DATAIEN))
160 .S ^TMP($J,"DLOC",CN)=DATA_U_DATAIEN,CN=CN+1
161 S RESULTS=$NA(^TMP($J,"DLOC"))
162 Q
Note: See TracBrowser for help on using the repository browser.