TIUALRT ; SLC/JER,AJB - Notify Author and Attending. ;10-Mar-2014 15:28;DU
;;1.0;TEXT INTEGRATION UTILITIES;**21,84,79,88,58,61,151,158,175,1009,221,1011,227,259,1013**;Jun 20, 1997;Build 33
;IHS/ITSC/LJF 02/21/2003
; -- changed SSN to HRCN
; -- removed code forcing attending to be cosigner
SEND(DA,OVERDUE) ; Generate "available for signature" alert
;ICR 10035 ^DPT( .01 NAME 0;1 Direct Global Read
N TIU0,TIU12,TIU13,TIU14,TIU15,TIUDATE,TIUESNR,TIUPNM,TIUECSNR,TIUSIG,TIUDPRM
N TIUCOSG,TIUEDT,TIUSSN,TIU,TIUTYP,XQA,XQAKILL,XQAMSG,XQAROU,XQAID
N XQAFLG,STATUS,SIGACT,ECSNRFLG
N XQADATA ;259
I '$D(TIUPRM0)!'$D(TIUPRM1) D SETPARM^TIULE
I '$D(TIUTMP("NODEL")) D ALERTDEL(DA)
S TIU0=$G(^TIU(8925,+DA,0)),TIU12=$G(^(12)),TIU13=$G(^(13))
S TIU14=$G(^TIU(8925,+DA,14)),TIU15=$G(^(15))
D DOCPRM^TIULC1(+TIU0,.TIUDPRM,DA)
; Quit if notifications not enabled
I '$D(TIUDPRM(0)) Q
; If document is an addendum, and the original is incomplete, quit
; per NOIS DUR-0101-32087
; I +$$ISADDNDM^TIULC1(DA),($P($G(^TIU(8925,+$P(TIU0,U,6),0)),U,5)<7) Q
I '+$P(TIUPRM1,U,7)!(+$P(TIU12,U)<+$P(TIUPRM1,U,7)) Q
;VMP/ELR PATCH 221 DO NOT SEND ALERTS FOR RETRACTED DOCUMENTS
I +$P(TIU0,U,5)=15 Q
; If third party alert from TIUALFUN **158**
I $D(TIUTMP("THIRD PARTY ALERTS")) G THIRD
; If document is completed, jump to additional signers
I (+$P(TIU0,U,5)'<7) G ADDSNR
I +$P(TIU0,U,5)=3,+$P($G(TIUDPRM(0)),U,2),'+$P(TIU13,U,4) Q ; not released **175**
; If Verification required, and not verified, don't send
I +$P(TIU0,U,5)=4,+$$REQVER^TIULC(DA,+$P($G(TIUDPRM(0)),U,3)),'+$P(TIU13,U,5) Q ; **175**
; Set up for call to XQALERT
S TIUEDT=$$DATE^TIULS($P(TIU0,U,7))
S TIUESNR=$P(TIU12,U,4)
S TIUSIG=$P(TIU15,U)
S TIUECSNR=$P(TIU12,U,8),TIUCOSG=$P(TIU15,U,7)
; If author has been identified, but not Expected Signer, make
; author the expected signer
I +TIUESNR'>0,(+$P(TIU12,U,2)>0) D
. N DIE,DR
. S TIUESNR=$P(TIU12,U,2)
. S DIE=8925,DR="1204////^S X=TIUESNR" D ^DIE
; If attending has been identified, but not Expected Cosigner, make
; attending the expected cosigner
;IHS/ITSC/LJF 02/21/2003 - IHS does not always require attending to be cosigner
;I +TIUECSNR'>0,(+$P(TIU12,U,9)>0) D
;. N DIE,DR
;. S TIUECSNR=$P(TIU12,U,9)
;. S DIE=8925,DR="1208////^S X=TIUECSNR" D ^DIE
;IHS/ITSC/LJF 02/21/2003 end of commented out code
;
; If first signature required and the expected signer is authorized
; to sign this record, and the record is not yet signed
; ** Set AUTHOR as recipient
I '+$G(TIUSIG),(+TIUESNR>0),(+$P(TIUDPRM(0),U,4)>0) S XQA(TIUESNR)=""
; If the record requires cosignature, and is not yet cosigned
; ** Set Expected Cosigner as recipient
I TIUECSNR]"",(+$P(TIU0,U,5)<7),(+$G(TIUCOSG)'>0) D
. N TIUDA S TIUDA=DA
. ; For documents other than Discharge Summaries, defer alerting
. ; Expected Cosigner 'til AUTHOR has signed
. ; If current document is an addendum apply test to its parent
. I +$$ISADDNDM^TIULC1(DA) S TIUDA=$P(^TIU(8925,DA,0),U,6)
. ; If cosigner alerts are to be deferred until signature, quit
. I '+$P(TIUDPRM(0),U,20),'+$G(TIUSIG),+$P(TIUDPRM(0),U,4) Q ; **84,112/151**
. S XQA(TIUECSNR)="",ECSNRFLG=1 ; **151**
ADDSNR ; Send addendum alerts, check for additional signers
;VMP/ELR PATCH 221 DO NOT SEND AMENDMENT ALERT IF CAUSED BY A DELINQUENT ADDITIONAL SIGNER
I +$$ISADDNDM^TIULC1(DA),$G(TIUADDL)'=1 D SENDADD(DA)
; If additional signers have been designated, alert them too
I +$O(^TIU(8925.7,"B",DA,0)),(+$P(TIU0,U,5)>5) D
. N TIUXTRA,TIUI D XTRASGNR^TIULG(.TIUXTRA,DA) Q:+$D(TIUXTRA)'>9
. S TIUI=0 F S TIUI=$O(TIUXTRA(TIUI)) Q:+TIUI'>0 S XQA(TIUI)=""
Q:$D(XQA)'>9
THIRD ; **158**
I $D(TIUTMP("THIRD PARTY ALERTS")) D
. N TIUX
. S TIUX="" F S TIUX=$O(TIUXQA(TIUX)) Q:TIUX="" S XQA(TIUX)=""
; Get demographics for alert message
S TIUPNM=$E($P($G(^DPT(+$P(TIU0,U,2),0)),U),1,9)
S TIUTYP=$$PNAME^TIULC1(+$G(TIU0))
D PATVADPT^TIULV(.TIU,+$P(TIU0,U,2))
;
;S TIUSSN=$E(TIUPNM,1)_$P($G(TIU("SSN")),"-",3) ;IHS/ITSC/LJF 02/21/2003
S TIUSSN=$G(TIU("HRCN")) ;IHS/ITSC/LJF 02/21/2003
S XQAID="TIU"_+DA,STATUS=$$UP^XLFSTR($$GET1^DIQ(8925,DA,.05)) ; **175** $$STATUS^TIULC(DA))
S SIGACT=$S(STATUS="UNSIGNED":"SIGNATURE",STATUS="UNCOSIGNED":"COSIGNATURE",1:"ADD'L SIGNATURE")
I $G(ECSNRFLG),$P(TIU0,U,5)=5 S STATUS="UNSIG/UNCOS'D" ; **151**
;I STATUS="UNCOSIGNED" S STATUS="UNCOS'D"
;I $G(OVERDUE) S TIUTYP=$E(TIUTYP,1,42-$L(STATUS))
S XQAMSG=TIUPNM_" ("_TIUSSN_"): "_STATUS_" "_$S($P(TIU0,U,9)="P":"STAT ",1:"")_TIUTYP
;I +$G(OVERDUE) S XQAMSG=XQAMSG_" OVERDUE for "_SIGACT_"." G ENDMSG
I +$G(OVERDUE) D G ENDMSG ; TIU,259
. S TIUDATE=$$DATE^TIULS(+TIU13)
. S XQAMSG=XQAMSG_" Dated "_TIUDATE_" OVERDUE for "_SIGACT_"."
. ;S XQAMSG=XQAMSG_": "_TIUDATE_" OVERDUE for "_SIGACT_"."
S XQAMSG=XQAMSG_" available for "_SIGACT_"."
ENDMSG ;
S XQAROU="ACT^TIUALRT",XQADATA=+DA_U
D SETUP^XQALERT
Q
ACT ; Act on alerts
N TIUQUIK,TIUDA,TIUPRM0,TIUPRM1,TIUPRM3,RSTOK S TIUQUIK=1 K XQAKILL
S TIUDA=$P(XQADATA,U)
I '$D(^TIU(8925,+TIUDA,0)) D ALERTDEL(TIUDA) Q
S RSTOK=$$DOCCHK^TIULRR(TIUDA)
I RSTOK'>0 D Q
. W !!,$C(7),"Ok, no harm done...",! ; Echo denial message
. I $$READ^TIUU("EA","RETURN to continue...") ; pause
I $P(^TIU(8925,+TIUDA,0),U,5)'<7,'+$$ISSIGNR(TIUDA,DUZ) S XQAKILL=1
D:'$D(TIUPRM0)!'$D(TIUPRM1) SETPARM^TIULE
D EN^VALM("TIU BROWSE FOR CLINICIAN")
Q
SENDTRAN(DA) ; Generate "Send back to transcription" alert
N TIUEDT,TIU0,TIUPNM,TIUSSN,TIUTRAN,TIU,XQA,XQAMSG,TIUMSG
N TIUESNR,TIU12,TIU13,TIU14,TIU15,TIUTYP
N XQAID ;259
I '$D(TIUPRM0)!'$D(TIUPRM1) D SETPARM^TIULE
D ALERTDEL(DA)
; Don't send if notifications not enabled
I '+$P(TIUPRM1,U,7) Q
S TIU0=$G(^TIU(8925,+DA,0)),TIU12=$G(^(12)),TIU13=$G(^(13))
S TIU14=$G(^TIU(8925,+DA,14)),TIU15=$G(^(15))
S TIUPNM=$E($P($G(^DPT(+$P(TIU0,U,2),0)),U),1,9)
S TIUEDT=$$DATE^TIULS($P(TIU0,U,7))
S TIUTYP=$$PNAME^TIULC1(+$G(TIU0))
S TIUTRAN=$P(TIU13,U,2),TIUESNR=$P(TIU12,U,2) ; **175**
D PATVADPT^TIULV(.TIU,+$P(TIU0,U,2)) ;Used to get SSN. Date not important.
;
;S TIUSSN=$E(TIUPNM,1)_$P($G(TIU("SSN")),"-",3) ;IHS/ITSC/LJF 02/21/2003
S TIUSSN=$G(TIU("HRCN")) ;IHS/ITSC/LJF 02/21/2003
;I $D(^VA(200,+TIUTRAN,0)) S XQA(TIUTRAN)=""
I $$PROVIDER^XUSER(TIUTRAN) S XQA(TIUTRAN)="" ;ICR #2343 In file 200 & not terminated
Q:$D(XQA)'>9
S TIUMSG=$S(TIUTRAN=TIUESNR:" needs editing",1:" needs retranscription.")
S XQAID="TIU"_+DA
S XQAMSG=TIUPNM_" ("_TIUSSN_"): "_TIUTYP_TIUMSG
D SETUP^XQALERT
Q
SENDADD(DA) ; Generates "Addendum added" alert
N TIU12,TIU13,TIU14,TIU15,TIU0,TIUPNM,TIUSSN,TIUTRAN,TIU,TIUTITLE,TIUDPRM
N XQA,XQAMSG,XQAFLG,XQADATA,XQAROU,TIUESNR,TIUDATE,TIUESNM,TIUO0,TIUO12,TIUO13
N XQAID,TIUECSNR ;P259
I '$D(TIUPRM0)!'$D(TIUPRM1) D SETPARM^TIULE
D ADDENDEL(DA)
; Don't send if notifications not enabled
I '+$P(TIUPRM1,U,7) Q
S TIU0=$G(^TIU(8925,+DA,0))
; Only send upon completion
Q:+$P(TIU0,U,5)'>6
D DOCPRM^TIULC1(+TIU0,.TIUDPRM,DA) Q:'+$P(TIUDPRM(0),U,17)
S TIU12=$G(^TIU(8925,+DA,12)),TIU13=$G(^(13)),TIU14=$G(^(14)),TIU15=$G(^(15))
S TIUO0=$G(^TIU(8925,$P(TIU0,U,6),0)),TIUO12=$G(^(12)),TIUO13=$G(^(13))
S TIUPNM=$E($$PTNAME^TIULC1(+$P(TIU0,U,2)),1,9)
S TIUESNM=$$NAME^TIULS($$PERSNAME^TIULC1(+$P(TIU12,U,2)),"LAST,FI MI")
S TIUTITLE=$E($$PNAME^TIULC1(+TIUO0),1,20)
S TIUDATE=$S(+$P(TIUO13,U):$P(TIUO13,U),1:$G(DT))
S TIUDATE=$$DATE^TIULS(TIUDATE)
D PATVADPT^TIULV(.TIU,+$P(TIU0,U,2)) ;Used to get SSN. Date not important.
S TIUSSN=$E(TIUPNM,1)_$P($G(TIU("SSN")),"-",3)
S TIUTRAN=$P(TIU13,U,2)
;Expected Cosigner and Author of original document
S TIUECSNR=$P($G(^TIU(8925,$P(TIU0,U,6),12)),U,8),TIUESNR=$P($G(^(12)),U,4)
; Not entered by Expected Signer: SET Expected Signer as recipient
I TIUESNR'=TIUTRAN,$D(^VA(200,+TIUESNR,0)) S XQA(TIUESNR)=""
; Not entered by Expected Cosigner: SET Expected Cosigner as recipient
; VMP/RJT - *227 - If user is the expected cosigner, do not send alert
I +TIUECSNR>0,(TIUECSNR'=DUZ),(TIUECSNR'=TIUTRAN),$D(^VA(200,+TIUECSNR,0)) S XQA(TIUECSNR)=""
Q:$D(XQA)'>9
S XQAID="TIUADD"_+DA,XQADATA=+DA_U,XQAROU="ACTADD^TIUALRT"
S XQAMSG=TIUPNM_" ("_TIUSSN_"): ADDENDUM to "_TIUTITLE_" of "_TIUDATE_" by "_TIUESNM
D SETUP^XQALERT
Q
ACTADD ; Act on ADDENDUM alerts
N TIUQUIK,TIUDA,TIUPRM0,TIUPRM1,TIUPRM3 S TIUQUIK=1 K XQAKILL
S TIUDA=$P(XQADATA,U),XQAKILL=1
I '$D(^TIU(8925,+TIUDA,0)) D ADDENDEL(TIUDA) Q
W !!,"A NEW Addendum has been added to your document...",!
W:$L($P($G(XQX),U,3)) !,$P($G(XQX),U,3),!
I '+$$READ^TIUU("YAO","Do you wish to Browse the Addendum now? ","NO") Q
D:'$D(TIUPRM0)!'$D(TIUPRM1) SETPARM^TIULE
D EN^VALM("TIU BROWSE FOR CLINICIAN")
Q
ALERTDEL(DA) ; Delete alerts associated with a given document
N XQA,XQAID,XQAKILL S XQAID="TIU"_DA
D DELETEA^XQALERT
Q
ADDENDEL(DA) ; Delete alert associated with a Addendum added
N XQA,XQAID,XQAKILL S XQAID="TIUADD"_DA
D DELETEA^XQALERT
Q
ISSIGNR(DA,USER) ; Is USER an additional signer of document DA?
N TIUY,TIUSDA,TIUSD0 S (TIUY,TIUSDA)=0
S TIUSDA=+$O(^TIU(8925.7,"AE",DA,USER,0)) G:'TIUSDA ISSIGNX
S TIUSD0=$G(^TIU(8925.7,TIUSDA,0)) G:'$L(TIUSD0) ISSIGNX
I +$P(TIUSD0,U,4)'>0 S TIUY=1
ISSIGNX Q TIUY
TIUALRT ; SLC/JER,AJB - Notify Author and Attending. ;10-Mar-2014 15:28;DU
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**21,84,79,88,58,61,151,158,175,1009,221,1011,227,259,1013**;Jun 20, 1997;Build 33
+2 ;IHS/ITSC/LJF 02/21/2003
+3 ; -- changed SSN to HRCN
+4 ; -- removed code forcing attending to be cosigner
SEND(DA,OVERDUE) ; Generate "available for signature" alert
+1 ;ICR 10035 ^DPT( .01 NAME 0;1 Direct Global Read
+2 NEW TIU0,TIU12,TIU13,TIU14,TIU15,TIUDATE,TIUESNR,TIUPNM,TIUECSNR,TIUSIG,TIUDPRM
+3 NEW TIUCOSG,TIUEDT,TIUSSN,TIU,TIUTYP,XQA,XQAKILL,XQAMSG,XQAROU,XQAID
+4 NEW XQAFLG,STATUS,SIGACT,ECSNRFLG
+5 ;259
NEW XQADATA
+6 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM1)
DO SETPARM^TIULE
+7 IF '$DATA(TIUTMP("NODEL"))
DO ALERTDEL(DA)
+8 SET TIU0=$GET(^TIU(8925,+DA,0))
SET TIU12=$GET(^(12))
SET TIU13=$GET(^(13))
+9 SET TIU14=$GET(^TIU(8925,+DA,14))
SET TIU15=$GET(^(15))
+10 DO DOCPRM^TIULC1(+TIU0,.TIUDPRM,DA)
+11 ; Quit if notifications not enabled
+12 IF '$DATA(TIUDPRM(0))
QUIT
+13 ; If document is an addendum, and the original is incomplete, quit
+14 ; per NOIS DUR-0101-32087
+15 ; I +$$ISADDNDM^TIULC1(DA),($P($G(^TIU(8925,+$P(TIU0,U,6),0)),U,5)<7) Q
+16 IF '+$PIECE(TIUPRM1,U,7)!(+$PIECE(TIU12,U)<+$PIECE(TIUPRM1,U,7))
QUIT
+17 ;VMP/ELR PATCH 221 DO NOT SEND ALERTS FOR RETRACTED DOCUMENTS
+18 IF +$PIECE(TIU0,U,5)=15
QUIT
+19 ; If third party alert from TIUALFUN **158**
+20 IF $DATA(TIUTMP("THIRD PARTY ALERTS"))
GOTO THIRD
+21 ; If document is completed, jump to additional signers
+22 IF (+$PIECE(TIU0,U,5)'<7)
GOTO ADDSNR
+23 ; not released **175**
IF +$PIECE(TIU0,U,5)=3
IF +$PIECE($GET(TIUDPRM(0)),U,2)
IF '+$PIECE(TIU13,U,4)
QUIT
+24 ; If Verification required, and not verified, don't send
+25 ; **175**
IF +$PIECE(TIU0,U,5)=4
IF +$$REQVER^TIULC(DA,+$PIECE($GET(TIUDPRM(0)),U,3))
IF '+$PIECE(TIU13,U,5)
QUIT
+26 ; Set up for call to XQALERT
+27 SET TIUEDT=$$DATE^TIULS($PIECE(TIU0,U,7))
+28 SET TIUESNR=$PIECE(TIU12,U,4)
+29 SET TIUSIG=$PIECE(TIU15,U)
+30 SET TIUECSNR=$PIECE(TIU12,U,8)
SET TIUCOSG=$PIECE(TIU15,U,7)
+31 ; If author has been identified, but not Expected Signer, make
+32 ; author the expected signer
+33 IF +TIUESNR'>0
IF (+$PIECE(TIU12,U,2)>0)
Begin DoDot:1
+34 NEW DIE,DR
+35 SET TIUESNR=$PIECE(TIU12,U,2)
+36 SET DIE=8925
SET DR="1204////^S X=TIUESNR"
DO ^DIE
End DoDot:1
+37 ; If attending has been identified, but not Expected Cosigner, make
+38 ; attending the expected cosigner
+39 ;IHS/ITSC/LJF 02/21/2003 - IHS does not always require attending to be cosigner
+40 ;I +TIUECSNR'>0,(+$P(TIU12,U,9)>0) D
+41 ;. N DIE,DR
+42 ;. S TIUECSNR=$P(TIU12,U,9)
+43 ;. S DIE=8925,DR="1208////^S X=TIUECSNR" D ^DIE
+44 ;IHS/ITSC/LJF 02/21/2003 end of commented out code
+45 ;
+46 ; If first signature required and the expected signer is authorized
+47 ; to sign this record, and the record is not yet signed
+48 ; ** Set AUTHOR as recipient
+49 IF '+$GET(TIUSIG)
IF (+TIUESNR>0)
IF (+$PIECE(TIUDPRM(0),U,4)>0)
SET XQA(TIUESNR)=""
+50 ; If the record requires cosignature, and is not yet cosigned
+51 ; ** Set Expected Cosigner as recipient
+52 IF TIUECSNR]""
IF (+$PIECE(TIU0,U,5)<7)
IF (+$GET(TIUCOSG)'>0)
Begin DoDot:1
+53 NEW TIUDA
SET TIUDA=DA
+54 ; For documents other than Discharge Summaries, defer alerting
+55 ; Expected Cosigner 'til AUTHOR has signed
+56 ; If current document is an addendum apply test to its parent
+57 IF +$$ISADDNDM^TIULC1(DA)
SET TIUDA=$PIECE(^TIU(8925,DA,0),U,6)
+58 ; If cosigner alerts are to be deferred until signature, quit
+59 ; **84,112/151**
IF '+$PIECE(TIUDPRM(0),U,20)
IF '+$GET(TIUSIG)
IF +$PIECE(TIUDPRM(0),U,4)
QUIT
+60 ; **151**
SET XQA(TIUECSNR)=""
SET ECSNRFLG=1
End DoDot:1
ADDSNR ; Send addendum alerts, check for additional signers
+1 ;VMP/ELR PATCH 221 DO NOT SEND AMENDMENT ALERT IF CAUSED BY A DELINQUENT ADDITIONAL SIGNER
+2 IF +$$ISADDNDM^TIULC1(DA)
IF $GET(TIUADDL)'=1
DO SENDADD(DA)
+3 ; If additional signers have been designated, alert them too
+4 IF +$ORDER(^TIU(8925.7,"B",DA,0))
IF (+$PIECE(TIU0,U,5)>5)
Begin DoDot:1
+5 NEW TIUXTRA,TIUI
DO XTRASGNR^TIULG(.TIUXTRA,DA)
IF +$DATA(TIUXTRA)'>9
QUIT
+6 SET TIUI=0
FOR
SET TIUI=$ORDER(TIUXTRA(TIUI))
IF +TIUI'>0
QUIT
SET XQA(TIUI)=""
End DoDot:1
+7 IF $DATA(XQA)'>9
QUIT
THIRD ; **158**
+1 IF $DATA(TIUTMP("THIRD PARTY ALERTS"))
Begin DoDot:1
+2 NEW TIUX
+3 SET TIUX=""
FOR
SET TIUX=$ORDER(TIUXQA(TIUX))
IF TIUX=""
QUIT
SET XQA(TIUX)=""
End DoDot:1
+4 ; Get demographics for alert message
+5 SET TIUPNM=$EXTRACT($PIECE($GET(^DPT(+$PIECE(TIU0,U,2),0)),U),1,9)
+6 SET TIUTYP=$$PNAME^TIULC1(+$GET(TIU0))
+7 DO PATVADPT^TIULV(.TIU,+$PIECE(TIU0,U,2))
+8 ;
+9 ;S TIUSSN=$E(TIUPNM,1)_$P($G(TIU("SSN")),"-",3) ;IHS/ITSC/LJF 02/21/2003
+10 ;IHS/ITSC/LJF 02/21/2003
SET TIUSSN=$GET(TIU("HRCN"))
+11 ; **175** $$STATUS^TIULC(DA))
SET XQAID="TIU"_+DA
SET STATUS=$$UP^XLFSTR($$GET1^DIQ(8925,DA,.05))
+12 SET SIGACT=$SELECT(STATUS="UNSIGNED":"SIGNATURE",STATUS="UNCOSIGNED":"COSIGNATURE",1:"ADD'L SIGNATURE")
+13 ; **151**
IF $GET(ECSNRFLG)
IF $PIECE(TIU0,U,5)=5
SET STATUS="UNSIG/UNCOS'D"
+14 ;I STATUS="UNCOSIGNED" S STATUS="UNCOS'D"
+15 ;I $G(OVERDUE) S TIUTYP=$E(TIUTYP,1,42-$L(STATUS))
+16 SET XQAMSG=TIUPNM_" ("_TIUSSN_"): "_STATUS_" "_$SELECT($PIECE(TIU0,U,9)="P":"STAT ",1:"")_TIUTYP
+17 ;I +$G(OVERDUE) S XQAMSG=XQAMSG_" OVERDUE for "_SIGACT_"." G ENDMSG
+18 ; TIU,259
IF +$GET(OVERDUE)
Begin DoDot:1
+19 SET TIUDATE=$$DATE^TIULS(+TIU13)
+20 SET XQAMSG=XQAMSG_" Dated "_TIUDATE_" OVERDUE for "_SIGACT_"."
+21 ;S XQAMSG=XQAMSG_": "_TIUDATE_" OVERDUE for "_SIGACT_"."
End DoDot:1
GOTO ENDMSG
+22 SET XQAMSG=XQAMSG_" available for "_SIGACT_"."
ENDMSG ;
+1 SET XQAROU="ACT^TIUALRT"
SET XQADATA=+DA_U
+2 DO SETUP^XQALERT
+3 QUIT
ACT ; Act on alerts
+1 NEW TIUQUIK,TIUDA,TIUPRM0,TIUPRM1,TIUPRM3,RSTOK
SET TIUQUIK=1
KILL XQAKILL
+2 SET TIUDA=$PIECE(XQADATA,U)
+3 IF '$DATA(^TIU(8925,+TIUDA,0))
DO ALERTDEL(TIUDA)
QUIT
+4 SET RSTOK=$$DOCCHK^TIULRR(TIUDA)
+5 IF RSTOK'>0
Begin DoDot:1
+6 ; Echo denial message
WRITE !!,$CHAR(7),"Ok, no harm done...",!
+7 ; pause
IF $$READ^TIUU("EA","RETURN to continue...")
End DoDot:1
QUIT
+8 IF $PIECE(^TIU(8925,+TIUDA,0),U,5)'<7
IF '+$$ISSIGNR(TIUDA,DUZ)
SET XQAKILL=1
+9 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM1)
DO SETPARM^TIULE
+10 DO EN^VALM("TIU BROWSE FOR CLINICIAN")
+11 QUIT
SENDTRAN(DA) ; Generate "Send back to transcription" alert
+1 NEW TIUEDT,TIU0,TIUPNM,TIUSSN,TIUTRAN,TIU,XQA,XQAMSG,TIUMSG
+2 NEW TIUESNR,TIU12,TIU13,TIU14,TIU15,TIUTYP
+3 ;259
NEW XQAID
+4 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM1)
DO SETPARM^TIULE
+5 DO ALERTDEL(DA)
+6 ; Don't send if notifications not enabled
+7 IF '+$PIECE(TIUPRM1,U,7)
QUIT
+8 SET TIU0=$GET(^TIU(8925,+DA,0))
SET TIU12=$GET(^(12))
SET TIU13=$GET(^(13))
+9 SET TIU14=$GET(^TIU(8925,+DA,14))
SET TIU15=$GET(^(15))
+10 SET TIUPNM=$EXTRACT($PIECE($GET(^DPT(+$PIECE(TIU0,U,2),0)),U),1,9)
+11 SET TIUEDT=$$DATE^TIULS($PIECE(TIU0,U,7))
+12 SET TIUTYP=$$PNAME^TIULC1(+$GET(TIU0))
+13 ; **175**
SET TIUTRAN=$PIECE(TIU13,U,2)
SET TIUESNR=$PIECE(TIU12,U,2)
+14 ;Used to get SSN. Date not important.
DO PATVADPT^TIULV(.TIU,+$PIECE(TIU0,U,2))
+15 ;
+16 ;S TIUSSN=$E(TIUPNM,1)_$P($G(TIU("SSN")),"-",3) ;IHS/ITSC/LJF 02/21/2003
+17 ;IHS/ITSC/LJF 02/21/2003
SET TIUSSN=$GET(TIU("HRCN"))
+18 ;I $D(^VA(200,+TIUTRAN,0)) S XQA(TIUTRAN)=""
+19 ;ICR #2343 In file 200 & not terminated
IF $$PROVIDER^XUSER(TIUTRAN)
SET XQA(TIUTRAN)=""
+20 IF $DATA(XQA)'>9
QUIT
+21 SET TIUMSG=$SELECT(TIUTRAN=TIUESNR:" needs editing",1:" needs retranscription.")
+22 SET XQAID="TIU"_+DA
+23 SET XQAMSG=TIUPNM_" ("_TIUSSN_"): "_TIUTYP_TIUMSG
+24 DO SETUP^XQALERT
+25 QUIT
SENDADD(DA) ; Generates "Addendum added" alert
+1 NEW TIU12,TIU13,TIU14,TIU15,TIU0,TIUPNM,TIUSSN,TIUTRAN,TIU,TIUTITLE,TIUDPRM
+2 NEW XQA,XQAMSG,XQAFLG,XQADATA,XQAROU,TIUESNR,TIUDATE,TIUESNM,TIUO0,TIUO12,TIUO13
+3 ;P259
NEW XQAID,TIUECSNR
+4 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM1)
DO SETPARM^TIULE
+5 DO ADDENDEL(DA)
+6 ; Don't send if notifications not enabled
+7 IF '+$PIECE(TIUPRM1,U,7)
QUIT
+8 SET TIU0=$GET(^TIU(8925,+DA,0))
+9 ; Only send upon completion
+10 IF +$PIECE(TIU0,U,5)'>6
QUIT
+11 DO DOCPRM^TIULC1(+TIU0,.TIUDPRM,DA)
IF '+$PIECE(TIUDPRM(0),U,17)
QUIT
+12 SET TIU12=$GET(^TIU(8925,+DA,12))
SET TIU13=$GET(^(13))
SET TIU14=$GET(^(14))
SET TIU15=$GET(^(15))
+13 SET TIUO0=$GET(^TIU(8925,$PIECE(TIU0,U,6),0))
SET TIUO12=$GET(^(12))
SET TIUO13=$GET(^(13))
+14 SET TIUPNM=$EXTRACT($$PTNAME^TIULC1(+$PIECE(TIU0,U,2)),1,9)
+15 SET TIUESNM=$$NAME^TIULS($$PERSNAME^TIULC1(+$PIECE(TIU12,U,2)),"LAST,FI MI")
+16 SET TIUTITLE=$EXTRACT($$PNAME^TIULC1(+TIUO0),1,20)
+17 SET TIUDATE=$SELECT(+$PIECE(TIUO13,U):$PIECE(TIUO13,U),1:$GET(DT))
+18 SET TIUDATE=$$DATE^TIULS(TIUDATE)
+19 ;Used to get SSN. Date not important.
DO PATVADPT^TIULV(.TIU,+$PIECE(TIU0,U,2))
+20 SET TIUSSN=$EXTRACT(TIUPNM,1)_$PIECE($GET(TIU("SSN")),"-",3)
+21 SET TIUTRAN=$PIECE(TIU13,U,2)
+22 ;Expected Cosigner and Author of original document
+23 SET TIUECSNR=$PIECE($GET(^TIU(8925,$PIECE(TIU0,U,6),12)),U,8)
SET TIUESNR=$PIECE($GET(^(12)),U,4)
+24 ; Not entered by Expected Signer: SET Expected Signer as recipient
+25 IF TIUESNR'=TIUTRAN
IF $DATA(^VA(200,+TIUESNR,0))
SET XQA(TIUESNR)=""
+26 ; Not entered by Expected Cosigner: SET Expected Cosigner as recipient
+27 ; VMP/RJT - *227 - If user is the expected cosigner, do not send alert
+28 IF +TIUECSNR>0
IF (TIUECSNR'=DUZ)
IF (TIUECSNR'=TIUTRAN)
IF $DATA(^VA(200,+TIUECSNR,0))
SET XQA(TIUECSNR)=""
+29 IF $DATA(XQA)'>9
QUIT
+30 SET XQAID="TIUADD"_+DA
SET XQADATA=+DA_U
SET XQAROU="ACTADD^TIUALRT"
+31 SET XQAMSG=TIUPNM_" ("_TIUSSN_"): ADDENDUM to "_TIUTITLE_" of "_TIUDATE_" by "_TIUESNM
+32 DO SETUP^XQALERT
+33 QUIT
ACTADD ; Act on ADDENDUM alerts
+1 NEW TIUQUIK,TIUDA,TIUPRM0,TIUPRM1,TIUPRM3
SET TIUQUIK=1
KILL XQAKILL
+2 SET TIUDA=$PIECE(XQADATA,U)
SET XQAKILL=1
+3 IF '$DATA(^TIU(8925,+TIUDA,0))
DO ADDENDEL(TIUDA)
QUIT
+4 WRITE !!,"A NEW Addendum has been added to your document...",!
+5 IF $LENGTH($PIECE($GET(XQX),U,3))
WRITE !,$PIECE($GET(XQX),U,3),!
+6 IF '+$$READ^TIUU("YAO","Do you wish to Browse the Addendum now? ","NO")
QUIT
+7 IF '$DATA(TIUPRM0)!'$DATA(TIUPRM1)
DO SETPARM^TIULE
+8 DO EN^VALM("TIU BROWSE FOR CLINICIAN")
+9 QUIT
ALERTDEL(DA) ; Delete alerts associated with a given document
+1 NEW XQA,XQAID,XQAKILL
SET XQAID="TIU"_DA
+2 DO DELETEA^XQALERT
+3 QUIT
ADDENDEL(DA) ; Delete alert associated with a Addendum added
+1 NEW XQA,XQAID,XQAKILL
SET XQAID="TIUADD"_DA
+2 DO DELETEA^XQALERT
+3 QUIT
ISSIGNR(DA,USER) ; Is USER an additional signer of document DA?
+1 NEW TIUY,TIUSDA,TIUSD0
SET (TIUY,TIUSDA)=0
+2 SET TIUSDA=+$ORDER(^TIU(8925.7,"AE",DA,USER,0))
IF 'TIUSDA
GOTO ISSIGNX
+3 SET TIUSD0=$GET(^TIU(8925.7,TIUSDA,0))
IF '$LENGTH(TIUSD0)
GOTO ISSIGNX
+4 IF +$PIECE(TIUSD0,U,4)'>0
SET TIUY=1
ISSIGNX QUIT TIUY