GMRCIAC2 ;SLC/JFR - FILE IFC ACTIVITIES CONT'D ;07/08/03 11:30
;;3.0;CONSULT/REQUEST TRACKING;**22,28,35**;DEC 27, 1997
Q ;can't start here
FILRES(GMRCO,GMRCOBX) ;file or delete results
N GMRCRES,GMRCFIL,GMRCSITE,GMRCROOT,RESIEN,GMRCERR
S GMRCRES=+$P(GMRCOBX,"|",5)
S GMRCFIL=$P($P(GMRCOBX,"|",3),U,3)
S GMRCROOT=$S($P($P(GMRCOBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
S GMRCFIL=$P(GMRCFIL,"VA",2)
S GMRCRES=GMRCRES_";"_GMRCROOT_GMRCFIL
S GMRCSITE=$$IEN^XUAF4($P($P(GMRCOBX,"|",5),U,3))
I $P(GMRCOBX,"|",11)'="D" D ;add new result
. S FDA(1,123.051,"+1,"_GMRCO_",",.01)=$$NOW^XLFDT
. S FDA(1,123.051,"+1,"_GMRCO_",",.02)=GMRCRES
. S FDA(1,123.051,"+1,"_GMRCO_",",.03)=GMRCSITE
I $P(GMRCOBX,"|",11)="D" D ; find and delete result
. N RESIEN
. S RESIEN=$O(^GMR(123,GMRCO,51,"AR",GMRCRES,GMRCSITE,0))
. I 'RESIEN Q
. S FDA(1,123.051,RESIEN_","_GMRCO_",",.01)="@"
I '$D(FDA) Q
D UPDATE^DIE("","FDA(1)",,"GMRCERR")
Q
;
UPDORD(GMRCDA,GMRC40) ; update CPRS order if action on placer order.
; Input:
; GMRCDA = ien from file 123
; GMRC40 = ien of activity in 40 multiple
;
N GMRCDFN,GMRCAD,AC,GMRCOC,GMRCMT
S GMRCDFN=$P(^GMR(123,GMRCDA,0),U,2)
I $O(^GMR(123,GMRCDA,40,GMRC40,1,0)) D
. S GMRCMT=1,GMRCMT(0)=GMRC40
S GMRCAD=$P(^GMR(123,GMRCDA,40,GMRC40,0),U,3)
S AC=$P(^GMR(123,GMRCDA,40,GMRC40,0),U,2)
S GMRCOC=$S(AC=6:"OD",AC=19:"OC",AC=10:"RE",AC=9:"RE",AC=8:"ZC",1:"SC")
D EN^GMRCHL7(GMRCDFN,GMRCDA,"","",GMRCOC,"","",.GMRCMT,,GMRCAD)
Q
FILEACT(GMRCO,GMRCLAST,GMRCFR,GMRCAR) ;file REQUEST PROCESSING ACTIVITY
; Input:
; GMRCO = ien from file 123
; GMRCLAST = last action taken on request
; GMRCFR = service that consult was forwarded from
; GMRCAR = name of the array containing the message
;
N GMRCORC,GMRCFDA,GMRCRP,GMRCEP,GMRCACT,GMRCERR,FDA
M ^TMP("GMRCFIL",$J)=@GMRCAR
S GMRCORC=^TMP("GMRCFIL",$J,"ORC")
S GMRCFDA(.01)=$$NOW^XLFDT
S GMRCFDA(.25)=$$HL7TFM^XLFDT($P(GMRCORC,"|",9))
S GMRCFDA(1)=GMRCLAST
S GMRCFDA(2)=$$HL7TFM^XLFDT($P(GMRCORC,"|",15))
D ;get entering and responsible persons
. D UNHLNAME^GMRCIUTL($P(GMRCORC,"|",10),.GMRCEP,0,U)
. D UNHLNAME^GMRCIUTL($P(GMRCORC,"|",12),.GMRCRP,0,U)
S GMRCFDA(.21)=GMRCEP
S GMRCFDA(.22)=GMRCRP
S GMRCFDA(.23)=$P($G(^TMP("GMRCFIL",$J,"OBX",5,1)),"|",5)
I $D(GMRCFR) S GMRCFDA(.31)=GMRCFR
I $D(^TMP("GMRCFIL",$J,"OBX",4)) D
. N RFIL,RSLT,DESC,GMRCOBX,ROOT,RSITE
. S GMRCOBX=^TMP("GMRCFIL",$J,"OBX",4,1)
. S RFIL=$P($P(GMRCOBX,"|",3),U,3),RFIL=$P(RFIL,"VA",2)
. S RSLT=+$P(GMRCOBX,"|",5)
. S RSITE=$$IEN^XUAF4($P($P(GMRCOBX,"|",5),U,3))
. S ROOT=$S($P($P(GMRCOBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
. S DESC=$P($P(GMRCOBX,"|",5),U,2)
. S GMRCFDA(.24)=RSLT_";"_ROOT_RFIL_";"_DESC_";"_RSITE
I GMRCLAST=10 D ; overwite inc. report in last action?
. N GMRCLACT
. S GMRCLACT=$O(^GMR(123,GMRCO,40," "),-1)
. I '$G(GMRCLACT) Q
. I $P($G(^GMR(123,GMRCO,40,GMRCLACT,0)),U,2)'=9 Q
. I $$FMDIFF^XLFDT($$NOW^XLFDT,+^GMR(123,GMRCO,40,GMRCLACT,0),2)>900 Q
. I $P($G(^GMR(123,GMRCO,40,GMRCLACT,2)),U,4)=GMRCFDA(.24) D
.. S GMRCACT(1)=GMRCLACT
.. M FDA(1,123.02,GMRCACT(1)_","_GMRCO_",")=GMRCFDA
.. D UPDATE^DIE("","FDA(1)",,"GMRCERR")
. Q
I '$D(GMRCACT(1)) D ; need to create new activity
. M FDA(1,123.02,"+1,"_GMRCO_",")=GMRCFDA
. D UPDATE^DIE("","FDA(1)","GMRCACT","GMRCERR")
K GMRCFDA,FDA
D ; file comments if present
. I $D(^TMP("GMRCFIL",$J,"OBX",3)) D ; general comments
.. N TMPARR
.. S TMPARR=$NA(^TMP("GMRCFIL",$J,"OBX",3))
.. D TRIMWP^GMRCIUTL(TMPARR,5)
.. D WP^DIE(123.02,GMRCACT(1)_","_GMRCO_",",5,"K",TMPARR)
. I $D(^TMP("GMRCFIL",$J,"NTE")) D ; DC or cancel comments
.. N TMPARR
.. S TMPARR=$NA(^TMP("GMRCFIL",$J,"NTE"))
.. D TRIMWP^GMRCIUTL(TMPARR,3)
.. D WP^DIE(123.02,GMRCACT(1)_","_GMRCO_",",5,"K",TMPARR)
.. Q
D ; update order if necessary
. I $P($G(^GMR(123,GMRCO,12)),U,5)="F" Q ; fillers have no order
. I GMRCLAST=11!(GMRCLAST=13)!(GMRCLAST=14) Q ;no status chg
. I GMRCLAST=4!(GMRCLAST=20) Q ;no status chg
. D UPDORD(GMRCO,GMRCACT(1))
K ^TMP("GMRCFIL",$J)
Q
;
TST(ARRAY) ;process test message and check item ordered
;Input:
; ARRAY = name of array containing message parts
;
N GMRCFDA,GMRCORC,GMRCDA,GMRCITM,GMRCITER
K ^TMP("GMRCIN",$J)
M ^TMP("GMRCIN",$J)=@ARRAY
D ;get ordered item and service
. S GMRCITM=$P(^TMP("GMRCIN",$J,"OBR"),"|",4)
. I GMRCITM["VA1233" D ; proc
.. N PROC
.. S PROC=$$GETPROC^GMRCIUTL(GMRCITM)
.. I +PROC'>0!('$P(PROC,U,2)) S GMRCITER=$P(PROC,U,3) Q
. I GMRCITM["VA1235" D
.. N SERV
.. S SERV=$$GETSERV^GMRCIUTL(GMRCITM) ;consult
.. I +SERV'>0 S GMRCITER=$P(SERV,U,3)
I $D(GMRCITER) D ;error in procedure or service, reject new order
. N GMRCRSLT
. D RESP^GMRCIUTL("AR",HL("MID"),,,GMRCITER) ;build HLA(
. D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
I '$D(GMRCITER) D
. N GMRCRSLT
. D RESP^GMRCIUTL("AA",HL("MID")) ;build HLA(
. D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
K ^TMP("GMRCIN",$J)
Q
;
GETDA(GMRCORC) ; determine what local Consult ien to work on
; Input:
; GMRCORC = ORC seg from incoming message
; Output:
; ien from file 123
;
N GMRCORC2,GMRCORC3
S GMRCORC2=$P(GMRCORC,"|",2),GMRCORC3=$P(GMRCORC,"|",3)
I $$IEN^XUAF4($P(GMRCORC2,U,2))=$$KSP^XUPARAM("INST") Q +GMRCORC2
Q +GMRCORC3
;
DUPACT(GMRCO,ACTVT,ORC,OBX) ;check to see if activity is a dup transmission
;Input:
; GMRCO = ien of consult
; ACTVT = ien of activity from file 123.1
; ORC = ORC segment from message
; OBX = OBX segment containing result
;
;Output:
; 0 = activity is not a duplicate of one on file already
; 1 = duplicate, activity already on file
;
N GMRCIADT,GMRCIFDT,DUP
S GMRCIFDT=+$$HL7TFM^XLFDT($P(ORC,"|",9))
S GMRCIADT=+$$HL7TFM^XLFDT($P(ORC,"|",15))
S DUP=0
I $D(^GMR(123,GMRCO,40,"AC",ACTVT,GMRCIFDT,GMRCIADT)) D Q DUP ;dupl.
. N RSLT,RFIL,RSITE,ROOT
. I $L($G(OBX)) D Q:'$G(DUP)
.. S RFIL=$P($P(OBX,"|",3),U,3),RFIL=$P(RFIL,"VA",2)
.. S RSLT=+$P(OBX,"|",5)
.. S RSITE=$$IEN^XUAF4($P($P(OBX,"|",5),U,3))
.. S ROOT=$S($P($P(OBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
.. S RSLT=RSLT_";"_ROOT_RFIL
.. I ACTVT=12,$D(^GMR(123,GMRCO,51,"AR",RSLT,RSITE)) Q ;no dup
.. I ACTVT'=12,'$D(^GMR(123,GMRCO,51,"AR",RSLT,RSITE)) Q ;no dup
.. S DUP=1
. S DUP=1
. D APPACK(GMRCO,"AR",802) ;send app. ACK and unlock record
Q 0
;
APPACK(GMRCO,ACK,ERR) ;send application acknowledgement for all cases
;Input:
; GMRCO = ien from file 123
; ACK = ACK code to include ("AA"=accept or "AR"=reject)
; ERR = error code to return if there is one (optional)
;
; Output: none
;
;send appl ACK
N GMRCRSLT
I '$G(ERR) S ERR=""
D RESP^GMRCIUTL(ACK,HL("MID"),,,ERR) ;build HLA("HLA", array
D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
;
D UNLKREC^GMRCUTL1(GMRCO) ;unlock record
Q
GMRCIAC2 ;SLC/JFR - FILE IFC ACTIVITIES CONT'D ;07/08/03 11:30
+1 ;;3.0;CONSULT/REQUEST TRACKING;**22,28,35**;DEC 27, 1997
+2 ;can't start here
QUIT
FILRES(GMRCO,GMRCOBX) ;file or delete results
+1 NEW GMRCRES,GMRCFIL,GMRCSITE,GMRCROOT,RESIEN,GMRCERR
+2 SET GMRCRES=+$PIECE(GMRCOBX,"|",5)
+3 SET GMRCFIL=$PIECE($PIECE(GMRCOBX,"|",3),U,3)
+4 SET GMRCROOT=$SELECT($PIECE($PIECE(GMRCOBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
+5 SET GMRCFIL=$PIECE(GMRCFIL,"VA",2)
+6 SET GMRCRES=GMRCRES_";"_GMRCROOT_GMRCFIL
+7 SET GMRCSITE=$$IEN^XUAF4($PIECE($PIECE(GMRCOBX,"|",5),U,3))
+8 ;add new result
IF $PIECE(GMRCOBX,"|",11)'="D"
Begin DoDot:1
+9 SET FDA(1,123.051,"+1,"_GMRCO_",",.01)=$$NOW^XLFDT
+10 SET FDA(1,123.051,"+1,"_GMRCO_",",.02)=GMRCRES
+11 SET FDA(1,123.051,"+1,"_GMRCO_",",.03)=GMRCSITE
End DoDot:1
+12 ; find and delete result
IF $PIECE(GMRCOBX,"|",11)="D"
Begin DoDot:1
+13 NEW RESIEN
+14 SET RESIEN=$ORDER(^GMR(123,GMRCO,51,"AR",GMRCRES,GMRCSITE,0))
+15 IF 'RESIEN
QUIT
+16 SET FDA(1,123.051,RESIEN_","_GMRCO_",",.01)="@"
End DoDot:1
+17 IF '$DATA(FDA)
QUIT
+18 DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
+19 QUIT
+20 ;
UPDORD(GMRCDA,GMRC40) ; update CPRS order if action on placer order.
+1 ; Input:
+2 ; GMRCDA = ien from file 123
+3 ; GMRC40 = ien of activity in 40 multiple
+4 ;
+5 NEW GMRCDFN,GMRCAD,AC,GMRCOC,GMRCMT
+6 SET GMRCDFN=$PIECE(^GMR(123,GMRCDA,0),U,2)
+7 IF $ORDER(^GMR(123,GMRCDA,40,GMRC40,1,0))
Begin DoDot:1
+8 SET GMRCMT=1
SET GMRCMT(0)=GMRC40
End DoDot:1
+9 SET GMRCAD=$PIECE(^GMR(123,GMRCDA,40,GMRC40,0),U,3)
+10 SET AC=$PIECE(^GMR(123,GMRCDA,40,GMRC40,0),U,2)
+11 SET GMRCOC=$SELECT(AC=6:"OD",AC=19:"OC",AC=10:"RE",AC=9:"RE",AC=8:"ZC",1:"SC")
+12 DO EN^GMRCHL7(GMRCDFN,GMRCDA,"","",GMRCOC,"","",.GMRCMT,,GMRCAD)
+13 QUIT
FILEACT(GMRCO,GMRCLAST,GMRCFR,GMRCAR) ;file REQUEST PROCESSING ACTIVITY
+1 ; Input:
+2 ; GMRCO = ien from file 123
+3 ; GMRCLAST = last action taken on request
+4 ; GMRCFR = service that consult was forwarded from
+5 ; GMRCAR = name of the array containing the message
+6 ;
+7 NEW GMRCORC,GMRCFDA,GMRCRP,GMRCEP,GMRCACT,GMRCERR,FDA
+8 MERGE ^TMP("GMRCFIL",$JOB)=@GMRCAR
+9 SET GMRCORC=^TMP("GMRCFIL",$JOB,"ORC")
+10 SET GMRCFDA(.01)=$$NOW^XLFDT
+11 SET GMRCFDA(.25)=$$HL7TFM^XLFDT($PIECE(GMRCORC,"|",9))
+12 SET GMRCFDA(1)=GMRCLAST
+13 SET GMRCFDA(2)=$$HL7TFM^XLFDT($PIECE(GMRCORC,"|",15))
+14 ;get entering and responsible persons
Begin DoDot:1
+15 DO UNHLNAME^GMRCIUTL($PIECE(GMRCORC,"|",10),.GMRCEP,0,U)
+16 DO UNHLNAME^GMRCIUTL($PIECE(GMRCORC,"|",12),.GMRCRP,0,U)
End DoDot:1
+17 SET GMRCFDA(.21)=GMRCEP
+18 SET GMRCFDA(.22)=GMRCRP
+19 SET GMRCFDA(.23)=$PIECE($GET(^TMP("GMRCFIL",$JOB,"OBX",5,1)),"|",5)
+20 IF $DATA(GMRCFR)
SET GMRCFDA(.31)=GMRCFR
+21 IF $DATA(^TMP("GMRCFIL",$JOB,"OBX",4))
Begin DoDot:1
+22 NEW RFIL,RSLT,DESC,GMRCOBX,ROOT,RSITE
+23 SET GMRCOBX=^TMP("GMRCFIL",$JOB,"OBX",4,1)
+24 SET RFIL=$PIECE($PIECE(GMRCOBX,"|",3),U,3)
SET RFIL=$PIECE(RFIL,"VA",2)
+25 SET RSLT=+$PIECE(GMRCOBX,"|",5)
+26 SET RSITE=$$IEN^XUAF4($PIECE($PIECE(GMRCOBX,"|",5),U,3))
+27 SET ROOT=$SELECT($PIECE($PIECE(GMRCOBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
+28 SET DESC=$PIECE($PIECE(GMRCOBX,"|",5),U,2)
+29 SET GMRCFDA(.24)=RSLT_";"_ROOT_RFIL_";"_DESC_";"_RSITE
End DoDot:1
+30 ; overwite inc. report in last action?
IF GMRCLAST=10
Begin DoDot:1
+31 NEW GMRCLACT
+32 SET GMRCLACT=$ORDER(^GMR(123,GMRCO,40," "),-1)
+33 IF '$GET(GMRCLACT)
QUIT
+34 IF $PIECE($GET(^GMR(123,GMRCO,40,GMRCLACT,0)),U,2)'=9
QUIT
+35 IF $$FMDIFF^XLFDT($$NOW^XLFDT,+^GMR(123,GMRCO,40,GMRCLACT,0),2)>900
QUIT
+36 IF $PIECE($GET(^GMR(123,GMRCO,40,GMRCLACT,2)),U,4)=GMRCFDA(.24)
Begin DoDot:2
+37 SET GMRCACT(1)=GMRCLACT
+38 MERGE FDA(1,123.02,GMRCACT(1)_","_GMRCO_",")=GMRCFDA
+39 DO UPDATE^DIE("","FDA(1)",,"GMRCERR")
End DoDot:2
+40 QUIT
End DoDot:1
+41 ; need to create new activity
IF '$DATA(GMRCACT(1))
Begin DoDot:1
+42 MERGE FDA(1,123.02,"+1,"_GMRCO_",")=GMRCFDA
+43 DO UPDATE^DIE("","FDA(1)","GMRCACT","GMRCERR")
End DoDot:1
+44 KILL GMRCFDA,FDA
+45 ; file comments if present
Begin DoDot:1
+46 ; general comments
IF $DATA(^TMP("GMRCFIL",$JOB,"OBX",3))
Begin DoDot:2
+47 NEW TMPARR
+48 SET TMPARR=$NAME(^TMP("GMRCFIL",$JOB,"OBX",3))
+49 DO TRIMWP^GMRCIUTL(TMPARR,5)
+50 DO WP^DIE(123.02,GMRCACT(1)_","_GMRCO_",",5,"K",TMPARR)
End DoDot:2
+51 ; DC or cancel comments
IF $DATA(^TMP("GMRCFIL",$JOB,"NTE"))
Begin DoDot:2
+52 NEW TMPARR
+53 SET TMPARR=$NAME(^TMP("GMRCFIL",$JOB,"NTE"))
+54 DO TRIMWP^GMRCIUTL(TMPARR,3)
+55 DO WP^DIE(123.02,GMRCACT(1)_","_GMRCO_",",5,"K",TMPARR)
+56 QUIT
End DoDot:2
End DoDot:1
+57 ; update order if necessary
Begin DoDot:1
+58 ; fillers have no order
IF $PIECE($GET(^GMR(123,GMRCO,12)),U,5)="F"
QUIT
+59 ;no status chg
IF GMRCLAST=11!(GMRCLAST=13)!(GMRCLAST=14)
QUIT
+60 ;no status chg
IF GMRCLAST=4!(GMRCLAST=20)
QUIT
+61 DO UPDORD(GMRCO,GMRCACT(1))
End DoDot:1
+62 KILL ^TMP("GMRCFIL",$JOB)
+63 QUIT
+64 ;
TST(ARRAY) ;process test message and check item ordered
+1 ;Input:
+2 ; ARRAY = name of array containing message parts
+3 ;
+4 NEW GMRCFDA,GMRCORC,GMRCDA,GMRCITM,GMRCITER
+5 KILL ^TMP("GMRCIN",$JOB)
+6 MERGE ^TMP("GMRCIN",$JOB)=@ARRAY
+7 ;get ordered item and service
Begin DoDot:1
+8 SET GMRCITM=$PIECE(^TMP("GMRCIN",$JOB,"OBR"),"|",4)
+9 ; proc
IF GMRCITM["VA1233"
Begin DoDot:2
+10 NEW PROC
+11 SET PROC=$$GETPROC^GMRCIUTL(GMRCITM)
+12 IF +PROC'>0!('$PIECE(PROC,U,2))
SET GMRCITER=$PIECE(PROC,U,3)
QUIT
End DoDot:2
+13 IF GMRCITM["VA1235"
Begin DoDot:2
+14 NEW SERV
+15 ;consult
SET SERV=$$GETSERV^GMRCIUTL(GMRCITM)
+16 IF +SERV'>0
SET GMRCITER=$PIECE(SERV,U,3)
End DoDot:2
End DoDot:1
+17 ;error in procedure or service, reject new order
IF $DATA(GMRCITER)
Begin DoDot:1
+18 NEW GMRCRSLT
+19 ;build HLA(
DO RESP^GMRCIUTL("AR",HL("MID"),,,GMRCITER)
+20 DO GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
End DoDot:1
+21 IF '$DATA(GMRCITER)
Begin DoDot:1
+22 NEW GMRCRSLT
+23 ;build HLA(
DO RESP^GMRCIUTL("AA",HL("MID"))
+24 DO GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
End DoDot:1
+25 KILL ^TMP("GMRCIN",$JOB)
+26 QUIT
+27 ;
GETDA(GMRCORC) ; determine what local Consult ien to work on
+1 ; Input:
+2 ; GMRCORC = ORC seg from incoming message
+3 ; Output:
+4 ; ien from file 123
+5 ;
+6 NEW GMRCORC2,GMRCORC3
+7 SET GMRCORC2=$PIECE(GMRCORC,"|",2)
SET GMRCORC3=$PIECE(GMRCORC,"|",3)
+8 IF $$IEN^XUAF4($PIECE(GMRCORC2,U,2))=$$KSP^XUPARAM("INST")
QUIT +GMRCORC2
+9 QUIT +GMRCORC3
+10 ;
DUPACT(GMRCO,ACTVT,ORC,OBX) ;check to see if activity is a dup transmission
+1 ;Input:
+2 ; GMRCO = ien of consult
+3 ; ACTVT = ien of activity from file 123.1
+4 ; ORC = ORC segment from message
+5 ; OBX = OBX segment containing result
+6 ;
+7 ;Output:
+8 ; 0 = activity is not a duplicate of one on file already
+9 ; 1 = duplicate, activity already on file
+10 ;
+11 NEW GMRCIADT,GMRCIFDT,DUP
+12 SET GMRCIFDT=+$$HL7TFM^XLFDT($PIECE(ORC,"|",9))
+13 SET GMRCIADT=+$$HL7TFM^XLFDT($PIECE(ORC,"|",15))
+14 SET DUP=0
+15 ;dupl.
IF $DATA(^GMR(123,GMRCO,40,"AC",ACTVT,GMRCIFDT,GMRCIADT))
Begin DoDot:1
+16 NEW RSLT,RFIL,RSITE,ROOT
+17 IF $LENGTH($GET(OBX))
Begin DoDot:2
+18 SET RFIL=$PIECE($PIECE(OBX,"|",3),U,3)
SET RFIL=$PIECE(RFIL,"VA",2)
+19 SET RSLT=+$PIECE(OBX,"|",5)
+20 SET RSITE=$$IEN^XUAF4($PIECE($PIECE(OBX,"|",5),U,3))
+21 SET ROOT=$SELECT($PIECE($PIECE(OBX,"|",3),U,2)["TIU":"TIU(",1:"MCAR(")
+22 SET RSLT=RSLT_";"_ROOT_RFIL
+23 ;no dup
IF ACTVT=12
IF $DATA(^GMR(123,GMRCO,51,"AR",RSLT,RSITE))
QUIT
+24 ;no dup
IF ACTVT'=12
IF '$DATA(^GMR(123,GMRCO,51,"AR",RSLT,RSITE))
QUIT
+25 SET DUP=1
End DoDot:2
IF '$GET(DUP)
QUIT
+26 SET DUP=1
+27 ;send app. ACK and unlock record
DO APPACK(GMRCO,"AR",802)
End DoDot:1
QUIT DUP
+28 QUIT 0
+29 ;
APPACK(GMRCO,ACK,ERR) ;send application acknowledgement for all cases
+1 ;Input:
+2 ; GMRCO = ien from file 123
+3 ; ACK = ACK code to include ("AA"=accept or "AR"=reject)
+4 ; ERR = error code to return if there is one (optional)
+5 ;
+6 ; Output: none
+7 ;
+8 ;send appl ACK
+9 NEW GMRCRSLT
+10 IF '$GET(ERR)
SET ERR=""
+11 ;build HLA("HLA", array
DO RESP^GMRCIUTL(ACK,HL("MID"),,,ERR)
+12 DO GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"LM",1,.GMRCRSLT)
+13 ;
+14 ;unlock record
DO UNLKREC^GMRCUTL1(GMRCO)
+15 QUIT