GMRCIAC1 ;SLC/JFR - FILE IFC ACTIVITIES cont'd ;2/11/02 16:11
;;3.0;CONSULT/REQUEST TRACKING;**22**;DEC 27, 1997
Q
COMP(GMRCAR) ;process partial result, clin complete and admin complete
;
N GMRCDA,GMRCFDA,GMRCORC,GMRCLAT,GMRCACT,FDA
N GMRCRES,GMRCERR,GMRCSTS,GMRCREAS
M ^TMP("GMRCIN",$J)=@GMRCAR
S GMRCORC=^TMP("GMRCIN",$J,"ORC")
S GMRCREAS=$P($P(GMRCORC,"|",16),U)
S GMRCDA=$$GETDA^GMRCIAC2(GMRCORC)
S GMRCSTS=$P(^GMR(123,GMRCDA,0),U,12)
I '$$LOCKREC^GMRCUTL1(GMRCDA) D Q ;couldn't lock record
. D APPACK^GMRCIAC2(GMRCDA,"AR",901) ;send app. ACK
. K ^TMP("GMRCIN",$J) Q
;
S GMRCFDA(8)=$S($P(GMRCORC,"|",5)="CM":2,GMRCSTS=2:2,1:9) ;comp or pr
S GMRCLAT=$S($P(GMRCORC,"|",5)="A":9,GMRCREAS="A":13,1:10)
S GMRCFDA(9)=GMRCLAT ;complete/upd or incomplete rpt
I $D(^TMP("GMRCIN",$J,"OBX",6,1)) D
. S GMRCFDA(15)=$P(^TMP("GMRCIN",$J,"OBX",6,1),"|",5)
; v-- check to see if a duplicate transmission
I $$DUPACT^GMRCIAC2(GMRCDA,GMRCLAT,GMRCORC,$S(GMRCLAT=13:"",1:$G(^TMP("GMRCIN",$J,"OBX",4,1)))) Q
M FDA(1,123,GMRCDA_",")=GMRCFDA
D UPDATE^DIE("","FDA(1)",,"GMRCERR") ;file last action and status
; check GMRCERR and act if error
K GMRCERR
K GMRCFDA,FDA
D FILEACT^GMRCIAC2(GMRCDA,GMRCLAT,,$NA(^TMP("GMRCIN",$J)))
; ^--- file result and activities
I $D(^TMP("GMRCIN",$J,"OBX",4,1)) D ;file result if there
. I GMRCLAT=13 Q ; addendum carries the result that it's addending
. I GMRCLAT=9 Q ; don't file result on inc. report
. I $P(^GMR(123,GMRCDA,12),U,5)="F" Q ;no comp coming from placer
. D FILRES^GMRCIAC2(GMRCDA,^TMP("GMRCIN",$J,"OBX",4,1))
D ;send notifications
. I GMRCLAT=9 Q
. I $P(^GMR(123,GMRCDA,12),U,5)="F" Q ;filler only gets historical comp
. N GMRCORTX S GMRCORTX=""
. I $O(^GMR(123,GMRCDA,51," "),-1)>1 D
.. S GMRCORTX="New remote result added to "
. I GMRCLAT=13 S GMRCORTX="Addendum added to "
. S GMRCORTX=GMRCORTX_"Remote Complete Consult: "_$$ORTX^GMRCAU(+GMRCDA)
. D MSG^GMRCP($P(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,23,,1)
D ;send appl ACK
. D APPACK^GMRCIAC2(GMRCDA,"AA")
;
K ^TMP("GMRCIN",$J)
Q
;
FWD(GMRCAR) ;file forward action from a remote site
;Input:
; GMRCAR = array name containing message
; e.g. ^TMP("GMRCIF",$J)
;
N GMRCFDA,GMRCDA,GMRCFWSR,GMRCFROM,GMRCORC,GMRCTIFC,GMRCLAC,GMRCROL
M ^TMP("GMRCIN",$J)=@GMRCAR
I '$D(^TMP("GMRCIN",$J,"OBR")) Q
S GMRCORC=^TMP("GMRCIN",$J,"ORC")
S GMRCTIFC=$S($P($P(GMRCORC,"|",16),U)="F":0,1:1)
S GMRCDA=$$GETDA^GMRCIAC2(GMRCORC)
I '$$LOCKREC^GMRCUTL1(GMRCDA) D Q ;couldn't lock record
. D APPACK^GMRCIAC2(GMRCDA,"AR",901) ;send app. ACK
. K ^TMP("GMRCIN",$J) Q
S GMRCROL=$P(^GMR(123,GMRCDA,12),U,5)
I 'GMRCTIFC D
. S GMRCFDA(9)=17,GMRCLAC=17
. I GMRCROL="F" D Q
.. S GMRCFROM=$P($P(^TMP("GMRCIN",$J,"OBR"),"|",4),U,2)
. S GMRCFDA(.131)=$P($P(^TMP("GMRCIN",$J,"OBR"),"|",4),U,2)
. S GMRCFROM=$P($G(^GMR(123,GMRCDA,13)),U)
I GMRCTIFC D
. S GMRCFROM=$P($P(^TMP("GMRCIN",$J,"OBR"),"|",4),U,2)
. S GMRCFDA(9)=25,GMRCLAC=25
;
S GMRCFDA(8)=5
D ;get urgency to file
. N URG
. S URG=$$URG^GMRCHL7A($P($P(^TMP("GMRCIN",$J,"ORC"),"|",7),U,6))
. S GMRCFDA(5)=$$FIND1^DIC(101,"","X","GMRCURGENCY - "_URG)
; v-- chk to see if activity is a dup transmission
I $$DUPACT^GMRCIAC2(GMRCDA,GMRCLAC,GMRCORC) Q
;
M FDA(1,123,GMRCDA_",")=GMRCFDA
D UPDATE^DIE("","FDA(1)",,"GMRCERR")
K GMRCFDA
;
; file activity tracking
D FILEACT^GMRCIAC2(GMRCDA,GMRCLAC,GMRCFROM,$NA(^TMP("GMRCIN",$J)))
;
; send alerts
I GMRCROL="F" D
. I GMRCLAC'=25 Q ; filler alerts only on FWD 2 IFC
. N GMRCTX
. S GMRCTX="New remote Consult: "_$$ORTX^GMRCAU(GMRCDA)
. D MSG^GMRCP($P(^GMR(123,GMRCDA,0),U,2),GMRCTX,GMRCDA,27,,1)
. Q
I GMRCROL="P" D
. N GMRCTX
. S GMRCTX="Updated Remote Consult: "_$$ORTX^GMRCAU(GMRCDA)
. D MSG^GMRCP($P(^GMR(123,GMRCDA,0),U,2),GMRCTX,GMRCDA,63,,1)
. Q
;
; print if FWD to IFC
I GMRCROL="F" D
. I GMRCLAC'=25 Q
. D PRNT^GMRCUTL1("",GMRCDA)
;
D ;send app. ACK and unlock record
. D APPACK^GMRCIAC2(GMRCDA,"AA")
K ^TMP("GMRCIN",$J)
Q
;
SF(GMRCAR) ;add significant findings
; Input:
; GMRCAR = array name containing message
; e.g. ^TMP("GMRCIF",$J)
;
N FDA,GMRCERR,GMRCOSF,GMRCISF
M ^TMP("GMRCIS",$J)=@GMRCAR
I '$D(^TMP("GMRCIS",$J,"OBX",6,1)) Q ;no SF flag sent ;-(
S GMRCDA=$$GETDA^GMRCIAC2(^TMP("GMRCIS",$J,"ORC"))
I '$$LOCKREC^GMRCUTL1(GMRCDA) D Q ;couldn't lock record
. D APPACK^GMRCIAC2(GMRCDA,"AR",901) ;send app. ACK
. K ^TMP("GMRCIN",$J) Q
;
S GMRCOSF=$P(^GMR(123,GMRCDA,0),U,19)
S GMRCISF=$P(^TMP("GMRCIS",$J,"OBX",6,1),"|",5)
S FDA(1,123,GMRCDA_",",15)=GMRCISF
S FDA(1,123,GMRCDA_",",9)=4
; v-- quit if a duplicate activity
I $$DUPACT^GMRCIAC2(GMRCDA,4,^TMP("GMRCIS",$J,"ORC")) Q
;
D UPDATE^DIE("","FDA(1)",,"GMRCERR") ;file last action and SF
D FILEACT^GMRCIAC2(GMRCDA,4,,$NA(^TMP("GMRCIS",$J))) ;activity track
D ;send notifications
. I $P(^GMR(123,GMRCDA,12),U,5)="F" Q ;filler only gets hist. SF
. N GMRCORTX
. S GMRCORTX=$S(GMRCISF="N":"No ",GMRCISF="Y":"",1:"Unknown ")
. S GMRCORTX=GMRCORTX_"Sig Findings for "_$$ORTX^GMRCAU(+GMRCDA)
. D MSG^GMRCP($P(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,23,,1)
D ;send appl ACK and unlock record
. D APPACK^GMRCIAC2(GMRCDA,"AA")
K ^TMP("GMRCIS",$J)
Q
;
RESUB(GMRCAR) ;resubmit a cancelled, remote consult
; Input:
; GMRCAR - array name containing message
; e.g. ^TMP("GMRCIF",$J)
;
K ^TMP("GMRCIN",$J)
M ^TMP("GMRCIN",$J)=@GMRCAR
N GMRCDA,GMRCFDA,FDA
S GMRCDA=$$GETDA^GMRCIAC2(^TMP("GMRCIN",$J,"ORC"))
I '$$LOCKREC^GMRCUTL1(GMRCDA) D Q ;couldn't lock record
. D APPACK^GMRCIAC2(GMRCDA,"AR",901) ; send app. ACK
. K ^TMP("GMRCIN",$J) Q
;
S GMRCFDA(8)=5,GMRCFDA(9)=11 ;status and last action
;
I $D(^TMP("GMRCIN",$J,"OBR")) D ; has INPATIENT or OUTPATIENT changed?
. N GMRCION
. S GMRCION=$P(^TMP("GMRCIN",$J,"OBR"),"|",18)
. I GMRCION'=$P(^GMR(123,GMRCDA,0),U,18) S GMRCFDA(14)=GMRCION
. Q
D ; check for change in urgency
. N GMRCURG
. S GMRCURG=$P($P(^TMP("GMRCIN",$J,"ORC"),"|",7),U,6)
. I '$L(GMRCURG) Q
. S GMRCURG=$$URG^GMRCHL7A(GMRCURG)
. S GMRCURG=$$FIND1^DIC(101,"","X","GMRCURGENCY - "_GMRCURG)
. I GMRCURG'>1 Q
. I GMRCURG=$P(^GMR(123,GMRCDA,0),U,9) Q ;no change
. S GMRCFDA(5)=GMRCURG
. Q
I $D(^TMP("GMRCIN",$J,"OBX",2)) D ; change in Prov. DX?
. N PROVDX
. S PROVDX=$P($P(^TMP("GMRCIN",$J,"OBX",2,1),"|",5),U,2)
. I '$L(PROVDX) Q
. I PROVDX=$G(^GMR(123,GMRCDA,30)) Q ; no change
. S GMRCFDA(30)=PROVDX
. S GMRCFDA(30.1)=$P($P(^TMP("GMRCIN",$J,"OBX",2,1),"|",5),U)
. Q
; v-- QUIT if a duplicate transmission
I $$DUPACT^GMRCIAC2(GMRCDA,11,^TMP("GMRCIN",$J,"ORC")) Q
;
M FDA(1,123,GMRCDA_",")=GMRCFDA
D UPDATE^DIE("","FDA(1)",,"GMRCERR") ;file edits
K GMRCFDA,FDA
;
I $D(^TMP("GMRCIN",$J,"OBX",1)) D ; reason for request change?
. D TRIMWP^GMRCIUTL($NA(^TMP("GMRCIN",$J,"OBX",1)),5)
. N DIFF S DIFF=0
. D I 'DIFF Q
.. I $O(^TMP("GMRCIN",$J,"OBX",1," "),-1)'=$O(^GMR(123,GMRCDA,20," "),-1) S DIFF=1 Q ; diff # of lines in new and existing
.. N LN S LN=0 F S LN=$O(^GMR(123,GMRCDA,20,LN)) Q:'LN!(DIFF) D
... I $G(^GMR(123,GMRCDA,20,LN,0))=$G(^TMP("GMRCIN",$J,"OBX",1,LN)) Q
... S DIFF=1 ;if the lines aren't the same, set DIFF and Q
. D WP^DIE(123,GMRCDA_",",20,"K",$NA(^TMP("GMRCIN",$J,"OBX",1)))
. Q
D ;file activity tracking
. D FILEACT^GMRCIAC2(GMRCDA,11,,$NA(^TMP("GMRCIN",$J)))
N GMRCNTIF
D ;determine if part of a FWD to IFC
. I $P(^GMR(123,GMRCDA,40,1,0),U,2)'=24 S GMRCNTIF=1 Q
. N ACT S ACT=1
. S GMRCNTIF=0
. F S ACT=$O(^GMR(123,GMRCDA,40,ACT)) Q:'ACT!($G(GMRCNTIF)) D
.. I $P(^GMR(123,GMRCDA,40,ACT,0),U,2)=25,$O(^(40,ACT)) S GMRCNTIF=1
;
D ;print SF-513 & send notifications
. I '$G(GMRCNTIF) Q ;part of a FWD to IFC
. D PRNT^GMRCUTL1("",GMRCDA)
. N GMRCORTX
. S GMRCORTX="New remotely re-submitted consult "
. S GMRCORTX=GMRCORTX_$$ORTX^GMRCAU(+GMRCDA)
. D MSG^GMRCP($P(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,27,,1)
;
D ;send appl ACK and unlock record
. D APPACK^GMRCIAC2(GMRCDA,"AA")
;
K ^TMP("GMRCIN",$J)
Q
;
GMRCIAC1 ;SLC/JFR - FILE IFC ACTIVITIES cont'd ;2/11/02 16:11
+1 ;;3.0;CONSULT/REQUEST TRACKING;**22**;DEC 27, 1997
+2 QUIT
COMP(GMRCAR) ;process partial result, clin complete and admin complete
+1 ;
+2 NEW GMRCDA,GMRCFDA,GMRCORC,GMRCLAT,GMRCACT,FDA
+3 NEW GMRCRES,GMRCERR,GMRCSTS,GMRCREAS
+4 MERGE ^TMP("GMRCIN",$JOB)=@GMRCAR
+5 SET GMRCORC=^TMP("GMRCIN",$JOB,"ORC")
+6 SET GMRCREAS=$PIECE($PIECE(GMRCORC,"|",16),U)
+7 SET GMRCDA=$$GETDA^GMRCIAC2(GMRCORC)
+8 SET GMRCSTS=$PIECE(^GMR(123,GMRCDA,0),U,12)
+9 ;couldn't lock record
IF '$$LOCKREC^GMRCUTL1(GMRCDA)
Begin DoDot:1
+10 ;send app. ACK
DO APPACK^GMRCIAC2(GMRCDA,"AR",901)
+11 KILL ^TMP("GMRCIN",$JOB)
QUIT
End DoDot:1
QUIT
+12 ;
+13 ;comp or pr
SET GMRCFDA(8)=$SELECT($PIECE(GMRCORC,"|",5)="CM":2,GMRCSTS=2:2,1:9)
+14 SET GMRCLAT=$SELECT($PIECE(GMRCORC,"|",5)="A":9,GMRCREAS="A":13,1:10)
+15 ;complete/upd or incomplete rpt
SET GMRCFDA(9)=GMRCLAT
+16 IF $DATA(^TMP("GMRCIN",$JOB,"OBX",6,1))
Begin DoDot:1
+17 SET GMRCFDA(15)=$PIECE(^TMP("GMRCIN",$JOB,"OBX",6,1),"|",5)
End DoDot:1
+18 ; v-- check to see if a duplicate transmission
+19 IF $$DUPACT^GMRCIAC2(GMRCDA,GMRCLAT,GMRCORC,$SELECT(GMRCLAT=13:"",1:$GET(^TMP("GMRCIN",$JOB,"OBX",4,1))))
QUIT
+20 MERGE FDA(1,123,GMRCDA_",")=GMRCFDA
+21 ;file last action and status
DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
+22 ; check GMRCERR and act if error
+23 KILL GMRCERR
+24 KILL GMRCFDA,FDA
+25 DO FILEACT^GMRCIAC2(GMRCDA,GMRCLAT,,$NAME(^TMP("GMRCIN",$JOB)))
+26 ; ^--- file result and activities
+27 ;file result if there
IF $DATA(^TMP("GMRCIN",$JOB,"OBX",4,1))
Begin DoDot:1
+28 ; addendum carries the result that it's addending
IF GMRCLAT=13
QUIT
+29 ; don't file result on inc. report
IF GMRCLAT=9
QUIT
+30 ;no comp coming from placer
IF $PIECE(^GMR(123,GMRCDA,12),U,5)="F"
QUIT
+31 DO FILRES^GMRCIAC2(GMRCDA,^TMP("GMRCIN",$JOB,"OBX",4,1))
End DoDot:1
+32 ;send notifications
Begin DoDot:1
+33 IF GMRCLAT=9
QUIT
+34 ;filler only gets historical comp
IF $PIECE(^GMR(123,GMRCDA,12),U,5)="F"
QUIT
+35 NEW GMRCORTX
SET GMRCORTX=""
+36 IF $ORDER(^GMR(123,GMRCDA,51," "),-1)>1
Begin DoDot:2
+37 SET GMRCORTX="New remote result added to "
End DoDot:2
+38 IF GMRCLAT=13
SET GMRCORTX="Addendum added to "
+39 SET GMRCORTX=GMRCORTX_"Remote Complete Consult: "_$$ORTX^GMRCAU(+GMRCDA)
+40 DO MSG^GMRCP($PIECE(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,23,,1)
End DoDot:1
+41 ;send appl ACK
Begin DoDot:1
+42 DO APPACK^GMRCIAC2(GMRCDA,"AA")
End DoDot:1
+43 ;
+44 KILL ^TMP("GMRCIN",$JOB)
+45 QUIT
+46 ;
FWD(GMRCAR) ;file forward action from a remote site
+1 ;Input:
+2 ; GMRCAR = array name containing message
+3 ; e.g. ^TMP("GMRCIF",$J)
+4 ;
+5 NEW GMRCFDA,GMRCDA,GMRCFWSR,GMRCFROM,GMRCORC,GMRCTIFC,GMRCLAC,GMRCROL
+6 MERGE ^TMP("GMRCIN",$JOB)=@GMRCAR
+7 IF '$DATA(^TMP("GMRCIN",$JOB,"OBR"))
QUIT
+8 SET GMRCORC=^TMP("GMRCIN",$JOB,"ORC")
+9 SET GMRCTIFC=$SELECT($PIECE($PIECE(GMRCORC,"|",16),U)="F":0,1:1)
+10 SET GMRCDA=$$GETDA^GMRCIAC2(GMRCORC)
+11 ;couldn't lock record
IF '$$LOCKREC^GMRCUTL1(GMRCDA)
Begin DoDot:1
+12 ;send app. ACK
DO APPACK^GMRCIAC2(GMRCDA,"AR",901)
+13 KILL ^TMP("GMRCIN",$JOB)
QUIT
End DoDot:1
QUIT
+14 SET GMRCROL=$PIECE(^GMR(123,GMRCDA,12),U,5)
+15 IF 'GMRCTIFC
Begin DoDot:1
+16 SET GMRCFDA(9)=17
SET GMRCLAC=17
+17 IF GMRCROL="F"
Begin DoDot:2
+18 SET GMRCFROM=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"OBR"),"|",4),U,2)
End DoDot:2
QUIT
+19 SET GMRCFDA(.131)=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"OBR"),"|",4),U,2)
+20 SET GMRCFROM=$PIECE($GET(^GMR(123,GMRCDA,13)),U)
End DoDot:1
+21 IF GMRCTIFC
Begin DoDot:1
+22 SET GMRCFROM=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"OBR"),"|",4),U,2)
+23 SET GMRCFDA(9)=25
SET GMRCLAC=25
End DoDot:1
+24 ;
+25 SET GMRCFDA(8)=5
+26 ;get urgency to file
Begin DoDot:1
+27 NEW URG
+28 SET URG=$$URG^GMRCHL7A($PIECE($PIECE(^TMP("GMRCIN",$JOB,"ORC"),"|",7),U,6))
+29 SET GMRCFDA(5)=$$FIND1^DIC(101,"","X","GMRCURGENCY - "_URG)
End DoDot:1
+30 ; v-- chk to see if activity is a dup transmission
+31 IF $$DUPACT^GMRCIAC2(GMRCDA,GMRCLAC,GMRCORC)
QUIT
+32 ;
+33 MERGE FDA(1,123,GMRCDA_",")=GMRCFDA
+34 DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
+35 KILL GMRCFDA
+36 ;
+37 ; file activity tracking
+38 DO FILEACT^GMRCIAC2(GMRCDA,GMRCLAC,GMRCFROM,$NAME(^TMP("GMRCIN",$JOB)))
+39 ;
+40 ; send alerts
+41 IF GMRCROL="F"
Begin DoDot:1
+42 ; filler alerts only on FWD 2 IFC
IF GMRCLAC'=25
QUIT
+43 NEW GMRCTX
+44 SET GMRCTX="New remote Consult: "_$$ORTX^GMRCAU(GMRCDA)
+45 DO MSG^GMRCP($PIECE(^GMR(123,GMRCDA,0),U,2),GMRCTX,GMRCDA,27,,1)
+46 QUIT
End DoDot:1
+47 IF GMRCROL="P"
Begin DoDot:1
+48 NEW GMRCTX
+49 SET GMRCTX="Updated Remote Consult: "_$$ORTX^GMRCAU(GMRCDA)
+50 DO MSG^GMRCP($PIECE(^GMR(123,GMRCDA,0),U,2),GMRCTX,GMRCDA,63,,1)
+51 QUIT
End DoDot:1
+52 ;
+53 ; print if FWD to IFC
+54 IF GMRCROL="F"
Begin DoDot:1
+55 IF GMRCLAC'=25
QUIT
+56 DO PRNT^GMRCUTL1("",GMRCDA)
End DoDot:1
+57 ;
+58 ;send app. ACK and unlock record
Begin DoDot:1
+59 DO APPACK^GMRCIAC2(GMRCDA,"AA")
End DoDot:1
+60 KILL ^TMP("GMRCIN",$JOB)
+61 QUIT
+62 ;
SF(GMRCAR) ;add significant findings
+1 ; Input:
+2 ; GMRCAR = array name containing message
+3 ; e.g. ^TMP("GMRCIF",$J)
+4 ;
+5 NEW FDA,GMRCERR,GMRCOSF,GMRCISF
+6 MERGE ^TMP("GMRCIS",$JOB)=@GMRCAR
+7 ;no SF flag sent ;-(
IF '$DATA(^TMP("GMRCIS",$JOB,"OBX",6,1))
QUIT
+8 SET GMRCDA=$$GETDA^GMRCIAC2(^TMP("GMRCIS",$JOB,"ORC"))
+9 ;couldn't lock record
IF '$$LOCKREC^GMRCUTL1(GMRCDA)
Begin DoDot:1
+10 ;send app. ACK
DO APPACK^GMRCIAC2(GMRCDA,"AR",901)
+11 KILL ^TMP("GMRCIN",$JOB)
QUIT
End DoDot:1
QUIT
+12 ;
+13 SET GMRCOSF=$PIECE(^GMR(123,GMRCDA,0),U,19)
+14 SET GMRCISF=$PIECE(^TMP("GMRCIS",$JOB,"OBX",6,1),"|",5)
+15 SET FDA(1,123,GMRCDA_",",15)=GMRCISF
+16 SET FDA(1,123,GMRCDA_",",9)=4
+17 ; v-- quit if a duplicate activity
+18 IF $$DUPACT^GMRCIAC2(GMRCDA,4,^TMP("GMRCIS",$JOB,"ORC"))
QUIT
+19 ;
+20 ;file last action and SF
DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
+21 ;activity track
DO FILEACT^GMRCIAC2(GMRCDA,4,,$NAME(^TMP("GMRCIS",$JOB)))
+22 ;send notifications
Begin DoDot:1
+23 ;filler only gets hist. SF
IF $PIECE(^GMR(123,GMRCDA,12),U,5)="F"
QUIT
+24 NEW GMRCORTX
+25 SET GMRCORTX=$SELECT(GMRCISF="N":"No ",GMRCISF="Y":"",1:"Unknown ")
+26 SET GMRCORTX=GMRCORTX_"Sig Findings for "_$$ORTX^GMRCAU(+GMRCDA)
+27 DO MSG^GMRCP($PIECE(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,23,,1)
End DoDot:1
+28 ;send appl ACK and unlock record
Begin DoDot:1
+29 DO APPACK^GMRCIAC2(GMRCDA,"AA")
End DoDot:1
+30 KILL ^TMP("GMRCIS",$JOB)
+31 QUIT
+32 ;
RESUB(GMRCAR) ;resubmit a cancelled, remote consult
+1 ; Input:
+2 ; GMRCAR - array name containing message
+3 ; e.g. ^TMP("GMRCIF",$J)
+4 ;
+5 KILL ^TMP("GMRCIN",$JOB)
+6 MERGE ^TMP("GMRCIN",$JOB)=@GMRCAR
+7 NEW GMRCDA,GMRCFDA,FDA
+8 SET GMRCDA=$$GETDA^GMRCIAC2(^TMP("GMRCIN",$JOB,"ORC"))
+9 ;couldn't lock record
IF '$$LOCKREC^GMRCUTL1(GMRCDA)
Begin DoDot:1
+10 ; send app. ACK
DO APPACK^GMRCIAC2(GMRCDA,"AR",901)
+11 KILL ^TMP("GMRCIN",$JOB)
QUIT
End DoDot:1
QUIT
+12 ;
+13 ;status and last action
SET GMRCFDA(8)=5
SET GMRCFDA(9)=11
+14 ;
+15 ; has INPATIENT or OUTPATIENT changed?
IF $DATA(^TMP("GMRCIN",$JOB,"OBR"))
Begin DoDot:1
+16 NEW GMRCION
+17 SET GMRCION=$PIECE(^TMP("GMRCIN",$JOB,"OBR"),"|",18)
+18 IF GMRCION'=$PIECE(^GMR(123,GMRCDA,0),U,18)
SET GMRCFDA(14)=GMRCION
+19 QUIT
End DoDot:1
+20 ; check for change in urgency
Begin DoDot:1
+21 NEW GMRCURG
+22 SET GMRCURG=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"ORC"),"|",7),U,6)
+23 IF '$LENGTH(GMRCURG)
QUIT
+24 SET GMRCURG=$$URG^GMRCHL7A(GMRCURG)
+25 SET GMRCURG=$$FIND1^DIC(101,"","X","GMRCURGENCY - "_GMRCURG)
+26 IF GMRCURG'>1
QUIT
+27 ;no change
IF GMRCURG=$PIECE(^GMR(123,GMRCDA,0),U,9)
QUIT
+28 SET GMRCFDA(5)=GMRCURG
+29 QUIT
End DoDot:1
+30 ; change in Prov. DX?
IF $DATA(^TMP("GMRCIN",$JOB,"OBX",2))
Begin DoDot:1
+31 NEW PROVDX
+32 SET PROVDX=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"OBX",2,1),"|",5),U,2)
+33 IF '$LENGTH(PROVDX)
QUIT
+34 ; no change
IF PROVDX=$GET(^GMR(123,GMRCDA,30))
QUIT
+35 SET GMRCFDA(30)=PROVDX
+36 SET GMRCFDA(30.1)=$PIECE($PIECE(^TMP("GMRCIN",$JOB,"OBX",2,1),"|",5),U)
+37 QUIT
End DoDot:1
+38 ; v-- QUIT if a duplicate transmission
+39 IF $$DUPACT^GMRCIAC2(GMRCDA,11,^TMP("GMRCIN",$JOB,"ORC"))
QUIT
+40 ;
+41 MERGE FDA(1,123,GMRCDA_",")=GMRCFDA
+42 ;file edits
DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
+43 KILL GMRCFDA,FDA
+44 ;
+45 ; reason for request change?
IF $DATA(^TMP("GMRCIN",$JOB,"OBX",1))
Begin DoDot:1
+46 DO TRIMWP^GMRCIUTL($NAME(^TMP("GMRCIN",$JOB,"OBX",1)),5)
+47 NEW DIFF
SET DIFF=0
+48 Begin DoDot:2
+49 ; diff # of lines in new and existing
IF $ORDER(^TMP("GMRCIN",$JOB,"OBX",1," "),-1)'=$ORDER(^GMR(123,GMRCDA,20," "),-1)
SET DIFF=1
QUIT
+50 NEW LN
SET LN=0
FOR
SET LN=$ORDER(^GMR(123,GMRCDA,20,LN))
IF 'LN!(DIFF)
QUIT
Begin DoDot:3
+51 IF $GET(^GMR(123,GMRCDA,20,LN,0))=$GET(^TMP("GMRCIN",$JOB,"OBX",1,LN))
QUIT
+52 ;if the lines aren't the same, set DIFF and Q
SET DIFF=1
End DoDot:3
End DoDot:2
IF 'DIFF
QUIT
+53 DO WP^DIE(123,GMRCDA_",",20,"K",$NAME(^TMP("GMRCIN",$JOB,"OBX",1)))
+54 QUIT
End DoDot:1
+55 ;file activity tracking
Begin DoDot:1
+56 DO FILEACT^GMRCIAC2(GMRCDA,11,,$NAME(^TMP("GMRCIN",$JOB)))
End DoDot:1
+57 NEW GMRCNTIF
+58 ;determine if part of a FWD to IFC
Begin DoDot:1
+59 IF $PIECE(^GMR(123,GMRCDA,40,1,0),U,2)'=24
SET GMRCNTIF=1
QUIT
+60 NEW ACT
SET ACT=1
+61 SET GMRCNTIF=0
+62 FOR
SET ACT=$ORDER(^GMR(123,GMRCDA,40,ACT))
IF 'ACT!($GET(GMRCNTIF))
QUIT
Begin DoDot:2
+63 IF $PIECE(^GMR(123,GMRCDA,40,ACT,0),U,2)=25
IF $ORDER(^(40,ACT))
SET GMRCNTIF=1
End DoDot:2
End DoDot:1
+64 ;
+65 ;print SF-513 & send notifications
Begin DoDot:1
+66 ;part of a FWD to IFC
IF '$GET(GMRCNTIF)
QUIT
+67 DO PRNT^GMRCUTL1("",GMRCDA)
+68 NEW GMRCORTX
+69 SET GMRCORTX="New remotely re-submitted consult "
+70 SET GMRCORTX=GMRCORTX_$$ORTX^GMRCAU(+GMRCDA)
+71 DO MSG^GMRCP($PIECE(^GMR(123,GMRCDA,0),U,2),GMRCORTX,GMRCDA,27,,1)
End DoDot:1
+72 ;
+73 ;send appl ACK and unlock record
Begin DoDot:1
+74 DO APPACK^GMRCIAC2(GMRCDA,"AA")
End DoDot:1
+75 ;
+76 KILL ^TMP("GMRCIN",$JOB)
+77 QUIT
+78 ;