source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURS.m@ 1396

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

initial load of WorldVistAEHR

File size: 8.1 KB
Line 
1TIURS ; SLC/JER - Electronic signature actions ;19-JAN-2001 11:14:07 [4/27/04 2:35pm] [12/20/04 8:55am]
2 ;;1.0;TEXT INTEGRATION UTILITIES;**3,4,20,67,79,98,107,58,100,109,179,157**;Jun 20, 1997
3ACCEPT(TIUSLST,TIUI) ; Accept for signing
4 N TIUSGN,TIUMSG,TIUPR,TIUFLAG
5 I +$G(TIUDA),($G(TIUEVNT)]"") D Q:'+$G(TIUSGN)
6 . S TIUSGN=$$CANDO^TIULP(TIUDA,TIUEVNT)
7 . I '+TIUSGN D
8 . . D FULL^VALM1
9 . . W !!,"Document has changed...",!,$P(TIUSGN,U,2)
10 . . W !!,"Item #",TIUI,": Removed from signature list.",!
11 . . W:$$READ^TIUU("EA","Press RETURN to continue...") ""
12 S TIUSLST(TIUI)=""
13 W !,"Item #",TIUI,": Added to signature list." ;H 2
14 I +$P($G(TIUDPRM(0)),U,8) D
15 . S TIUMSG="Print this note"
16 . S TIUPR=$$READ^TIUU("Y",TIUMSG,"No")
17 . I +TIUPR S TIUSLST(TIUI)=1
18 I +$G(TIUPR),+$P($G(TIUDPRM(0)),U,9) D
19 . S TIUFLAG=$$FLAG^TIUPRPN3
20 . I +TIUFLAG S $P(TIUSLST(TIUI),U,2)=1
21 I +$G(XTRASGNR) S $P(TIUSLST(TIUI),U,3)=$G(XTRASGNR)
22 Q
23EDSIG(TIUDA,TIUADD,TIUPASK) ; interactive sign
24 N TIU,TIU0,TIU12,ASK,X,X1,TIUTYPE,SIGNER,COSIGNER,TIUTYPE,TIUMSG,TIUSTAT
25 N TIUES,TIUACT,TIUDPRM,XTRASGNR,TIUCOM,TIU15,TIUCPFLD
26 I +$D(TIUSIGN),(TIUSIGN=0) Q
27 I '$D(TIUPRM0) D SETPARM^TIULE
28 I '+$P(TIUPRM0,U,2) S VALMBCK="R" Q
29 S TIUADD=1
30 S TIU0=$G(^TIU(8925,+TIUDA,0)),TIU12=$G(^(12)),TIU15=$G(^(15))
31 S SIGNER=$S(+$P(TIU12,U,4):$P(TIU12,U,4),1:$P(TIU12,U,2))
32 S COSIGNER=$P(TIU12,U,8)
33 I (DUZ'=SIGNER),(DUZ'=COSIGNER) S XTRASGNR=+$O(^TIU(8925.7,"AE",+TIUDA,+DUZ,0))
34 I '$G(XTRASGNR) S XTRASGNR=$$ASURG^TIUADSIG(TIUDA)
35 S TIUSTAT=+$P(TIU0,U,5)
36 S TIUACT=$S(TIUSTAT'>5:"SIGNATURE",+$G(XTRASGNR):"SIGNATURE",1:"COSIGNATURE")
37 S ASK=$$CANDO^TIULP(TIUDA,TIUACT)
38 S TIUTYPE=$$PNAME^TIULC1(+TIU0)
39 I +ASK'>0 D Q
40 . S VALMBCK="R"
41 . I +$$ISA^USRLM(+$G(DUZ),"MEDICAL INFORMATION SECTION"),(+$$ISPN^TIULX(+TIU0)'>0) Q
42 . I +$$ISA^USRLM(+$G(DUZ),"MAS TRANSCRIPTIONIST") Q
43 . I +$$ISA^USRLM(+$G(DUZ),"TRANSCRIPTIONIST") Q
44 . W !,$P(ASK,U,2)
45 . I $$READ^TIUU("EA","Press RETURN to continue...") ; pause
46 W:$G(VALMAR)'="^TMP(""TIUVIEW"",$J)" !
47 ;If document is a clinical procedures (CP) title, and
48 ;(P179 for P182) this is not an additional signature,
49 ;check if CP fields are required. If required, prompt for them
50 ;and don't let user sign unless fields are defined. (P109)
51 I '$G(XTRASGNR),+$$ISA^TIULX(+TIU0,+$$CLASS^TIUCP),$$REQCPF^TIULP(+$P($G(^TIU(8925,+TIUDA,14)),U,5)) D Q:+TIUCPFLD'>0
52 . I $G(^TIU(8925,+TIUDA,702)),$P(^(702),U)]"",$P(^(702),U,2)]"" S TIUCPFLD=1 Q
53 . S TIUCPFLD=$$ASKCPF(TIUDA)
54 . I +TIUCPFLD'>0 D
55 . . W !!,"The Procedure Summary Code and Date/Time Performed MUST be entered before",!,"you may sign.",!
56 . . I $$READ^TIUU("EA","Press RETURN to continue...") ;pause
57 I $S(+$$REQCOSIG^TIULP(+TIU0,+TIUDA,+SIGNER):1,+$P(TIU15,U,6):1,1:0),(+COSIGNER'>0) D Q:+COSIGNER'>0
58 . S COSIGNER=$$ASKCSNR(TIUDA,SIGNER)
59 . I +COSIGNER'>0 D
60 . . W !!,"This ",TIUTYPE," MUST have a cosigner before you may sign.",!
61 . . I $$READ^TIUU("EA","Press RETURN to continue...") ; pause
62 I TIUSTAT=5,$G(DUZ)'=SIGNER D
63 . S TIUMSG="Author hasn't signed, are you SURE you want to sign "_TIUTYPE
64 W ! I $G(TIUMSG)]"",$$READ^TIUU("YO",TIUMSG,"NO","^D SIG^TIUDIRH")'>0 S VALMBCK="R" Q
65 L +^TIU(8925,+TIUDA):1
66 E W !?5,$C(7),"Another user is editing this entry.",! W:$$READ^TIUU("EA","Press RETURN to continue...") "" S TIUQUIT=2 Q
67 S TIUES=$$ASKSIG^TIULA1 L -^TIU(8925,+TIUDA) I '+TIUES Q
68 I $D(VALMAR) D FULL^VALM1
69 I +$G(XTRASGNR) D ADDSIG^TIURS1(TIUDA,XTRASGNR)
70 I '+$G(XTRASGNR) D ES(TIUDA,TIUES)
71 I $G(TIUACT)="COSIGNATURE",(+$$ISADDNDM^TIULC1(TIUDA)'>0) D Q:+TIUCOM
72 . N TIUADDND S TIUCOM=0
73 . S TIUADDND=$$READ^TIUU("YO","Do you wish to add your comments in an addendum","NO")
74 . I +TIUADDND D ADD^TIUADD(TIUDA,.TIUCHNG) S TIUCOM=1
75 I '+$G(TIUPASK) Q
76 D DOCPRM^TIULC1(+TIU0,.TIUDPRM,TIUDA)
77 I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(TIUDA)
78 Q
79 ;
80ASKCPF(DA) ;Ask required clinical procedure fields
81 N DR,DIE,TIUY
82 D FULL^VALM1
83AGNCP W !!,$C(7),"You must designate the Procedure Summary Code and Date/Time Performed...",!
84 L +^TIU(8925,+DA):1
85 E W !?5,$C(7),"Another user is editing this entry.",! W:$$READ^TIUU("EA","Press RETURN to continue...") "" G ASKCPFQ
86 S DR="70201R;70202R"
87 S DIE="^TIU(8925," D ^DIE
88ASKCPFQ L -^TIU(8925,+DA)
89 I $G(^TIU(8925,+DA,702)),$P(^(702),U)]"",$P(^(702),U,2)]"" S TIUY=1
90 Q +$G(TIUY)
91 ;
92ASKCSNR(DA,SIGNER) ; Ask cosigner
93 N DR,DIE,TIUY,TIUDCSNR,TIUPREF,TIUFLD
94 S TIUPREF=$$PERSPRF^TIULE(SIGNER)
95 S TIUDCSNR=$$PERSNAME^TIULC1($P(TIUPREF,U,9))
96 I TIUDCSNR="UNKNOWN" S TIUDCSNR=""
97 S TIUFLD=$S(+$$ISDS^TIULX(+$G(^TIU(8925,+DA,0))):"ATTENDING PHYSICIAN",1:"EXPECTED COSIGNER")
98 D FULL^VALM1
99AGN W !!,$C(7),"You must designate an ",TIUFLD,"...",!
100 L +^TIU(8925,+DA):1
101 E W !?5,$C(7),"Another user is editing this entry.",! W:$$READ^TIUU("EA","Press RETURN to continue...") "" G ASKCOUT
102 I $E(TIUFLD)="A" S DR="1209R//^S X=TIUDCSNR;1208////^S X=$P(^TIU(8925,DA,12),U,9);1506////1"
103 E S DR="1208R//^S X=TIUDCSNR;1506////1"
104 S DIE="^TIU(8925," D ^DIE
105ASKCOUT L -^TIU(8925,+DA)
106 S TIUY=+$P($G(^TIU(8925,+DA,12)),U,8)
107 Q TIUY
108ES(DA,TIUES,TIUI) ; ^DIE call for /es/
109 N SIGNER,DR,DIE,ESDT,TIUSTAT,TIUSTNOW,COSIGNER,SVCHIEF,CSREQ,TIUPRINT
110 N CSNEED,TIUTTL,TIUPSIG,TIUDPRM,DAO,TIUSTWAS,TIUSTIS,DAORIG
111 S TIUSTWAS=$P($G(^TIU(8925,DA,0)),U,5)
112 D DOCPRM^TIULC1(+$G(^TIU(8925,+DA,0)),.TIUDPRM,DA)
113 S TIUSTAT=$P($G(^TIU(8925,+DA,0)),U,5),ESDT=$$NOW^TIULC
114 S SVCHIEF=+$$ISA^USRLM(DUZ,"CLINICAL SERVICE CHIEF")
115 S SIGNER=$P(^TIU(8925,+DA,12),U,4),COSIGNER=$P(^(12),U,8),CSREQ=0
116 S CSNEED=+$P($G(^TIU(8925,+DA,15)),U,6)
117 I +CSNEED,(DUZ'=COSIGNER),'+$G(SVCHIEF),(TIUSTAT'=6) S CSREQ=1
118 I TIUSTAT=5 D
119 . S DR=".05////"_$S(+CSREQ:6,1:7)_";1501////"_ESDT_";1502////"_+DUZ
120 . I '+$G(CSREQ),+CSNEED,$S(DUZ=COSIGNER:1,+$G(SVCHIEF):1,1:0) D
121 . . S DR=DR_";1506////0;1507////"_ESDT_";1508////"_+DUZ_";1509///^S X=$P(TIUES,U,2);1510///^S X=$P(TIUES,U,3);1511////E"
122 I TIUSTAT=6 S DR=".05////7;1506////0;1507////"_ESDT_";1508////"_+DUZ
123 Q:'$D(DR)
124 S DIE=8925 D ^DIE W:'$D(XWBOS) "."
125 I TIUSTAT=5 S DR="1503///^S X=$P(TIUES,U,2);1504///^S X=$P(TIUES,U,3);1505////E"
126 I TIUSTAT=6 D
127 . N TIUSBY S DR="",TIUSBY=$P($G(^TIU(8925,+DA,15)),U,2)
128 . I +TIUSBY>0 S DR="1503///^S X=$$SIGNAME^TIULS("_TIUSBY_");1504///^S X=$$SIGTITL^TIULS("_TIUSBY_");"
129 . S DR=$G(DR)_"1509///^S X=$P(TIUES,U,2);1510///^S X=$P(TIUES,U,3);1511////E"
130 S DIE=8925 D ^DIE W:'$D(XWBOS) "." S:'+$G(TIUCHNG) TIUCHNG=1
131 D SEND^TIUALRT(DA),SIGNIRT^TIUDIRT(+DA)
132 S DAORIG=DA
133 I +$$ISADDNDM^TIULC1(DA) S DA=+$P($G(^TIU(8925,+DA,0)),U,6)
134 I +$G(CSREQ)'>0 D MAIN^TIUPD(DA,"S") I 1
135 ;If 'Credit Stop Code on Completion' is Yes
136 I +$P(^TIU(8925,+DA,0),U,11) D
137 . ;If workload does not exist, process using TIU's interview otherwise
138 . ;process as an edit using PCE's interview
139 . I '$$CHKVST^TIUPXAP2(+DA) D I 1
140 . . N TIUCONT,TIUPRMT
141 . . Q:$D(XWBOS)
142 . . I $P(+$P(^TIU(8925,+DA,0),U,7),".")>DT D Q
143 . . . W !!
144 . . . D QUE^TIUPXAP1
145 . . . W:$$READ^TIUU("EA","Press RETURN to continue...") ""
146 . . W !!
147 . . ;Check if workload should be entered
148 . . I $$CHKWKL^TIUPXAP2(+DA,.TIUDPRM) D CREDIT^TIUVSIT(DA)
149 . E D
150 . . ;Check if workload should be entered
151 . . I $$CHKWKL^TIUPXAP2(+DA,.TIUDPRM) D EDTENC^TIUPXAP2(DA)
152 . D REMFLAG^TIUVSIT(+DA)
153 ;If document does not have a visit and docmt is associated with
154 ;an event type visit or call is invoked by broker, check if
155 ;docmt can be linked to an existing visit or try and create a new
156 ;visit. (P179)
157 I $D(^TIU(8925,+DA,0)),$P(^(0),U,3)'>0,($P(^(0),U,13)="E"!($$BROKER^XWBLIB)) D
158 . N D0,DFN,TIU,TIUVSIT
159 . ;Try to link docmt to an existing visit, quit if successful
160 . I $$LNKVST^TIUPXAP3(DA,.TIUVSIT) Q
161 . ;Otherwise set TIU array and DFN to use TIU API which calls PCE
162 . ;to resolve multiple visits or creates a new visit
163 . D GETTIU^TIULD(.TIU,DA)
164 . S DFN=$P($G(^TIU(8925,+DA,0)),U,2)
165 . D QUE^TIUPXAP1
166 ; post-signature action
167 N TIUCONS S TIUCONS=-1
168 D ISCNSLT^TIUCNSLT(.TIUCONS,+$G(^TIU(8925,DA,0)))
169 I TIUCONS S DA=DAORIG
170 S TIUSTIS=$P($G(^TIU(8925,DA,0)),U,5)
171 S TIUTTL=+$G(^TIU(8925,+DA,0)),TIUPSIG=$$POSTSIGN^TIULC1(TIUTTL)
172 I +$L(TIUPSIG),'+$G(CSREQ) X TIUPSIG
173 I TIUCONS,TIUSTIS=7,TIUSTWAS<7,$$HASKIDS^TIUSRVLI(DA) D
174 . N SEQUENCE,TIUKIDS,TIUINT,TIUK
175 . S SEQUENCE="D",TIUKIDS="TIUKIDS",TIUINT=0,TIUK=0
176 . D SETKIDS^TIUSRVLI(TIUKIDS,DA,TIUINT)
177 . F S TIUK=$O(TIUKIDS(TIUK)) Q:'TIUK D
178 . . I $P(TIUKIDS(TIUK),U,7)="completed" X TIUPSIG
179 Q
Note: See TracBrowser for help on using the repository browser.