MPIFCMOR ;BHM/RGY-Set and broadcast CMOR changes ;FEB 20, 1998
;;1.0; MASTER PATIENT INDEX VISTA ;**1,6,11,30**;30 Apr 99
;
; Intergation Agreements Utilized:
; EXC^RGHLLOG IA #2796
; START^RGHLLOG IA #2796
; STOP^RGHLLOG IA #2796
; $$EN^VAFCPID IA #3015
;
BROAD(REQNO,ER) ;Broadcase CMOR change to everyone
N CN,RGL,HL,CNT,HLA,PDX,ICN,HOME,RGLINK,RGL,TMP,II,CLIENT,HLA,USER,N0,NDATE,RLST,SERVER,ERR,MPILK
S ER=0
S SERVER="MPIF CMOR RESULT SERVER"
S CLIENT="MPIF CMOR RESULT CLIENT"
S N0=$G(^MPIF(984.9,REQNO,0))
S DFN=$P(N0,"^",4)
S NDATE=$P(N0,"^",3)
N X,Y,DIC
S DIC="^VA(200,",DIC(0)="MZO",X="`"_+$P(N0,"^",2)
D ^DIC
I $G(Y)<1 S USER="Automatic Processing"
I $G(Y)>0 S USER=$G(Y(0,0))
S SITE=+$P($$SITE^VASITE,"^",3)
S ICN=$$ICN^MPIFNQ(DFN)
S HOME=$P($$MPINODE^MPIFAPI(DFN),"^",3)
S CN=+$P($$MPINODE^MPIFAPI(DFN),"^",5)
S HL=0,CNT=0
K ^XTMP("MPIFCMOR","ERR")
D INIT^HLFNC2(SERVER,.HL)
I HL S ERR=HL D Q
.D START^RGHLLOG()
.D EXC^RGHLLOG(220,"Unable to setup HL7 for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
.D STOP^RGHLLOG()
.D RESET(DFN,REQNO)
K HLL("LINKS")
S MPILK=$$MPILINK^MPIFAPI ;routing all messages through the MPI
I +MPILK<0 D Q
.D START^RGHLLOG()
.D EXC^RGHLLOG(224,"No MPI link found for Change CMOR Request # "_REQNO_" for ICN="_ICN,DFN)
.D STOP^RGHLLOG()
.D RESET(DFN,REQNO)
.S ER="-1^No Links found"
;Broadcast new CMOR to MPI which will send it out to all sites
S HLL("LINKS",1)=CLIENT_"^"_MPILK
S CNT=CNT+1,HLA("HLS",CNT)="EVN"_HL("FS")_"A31"_HL("FS")_NDATE_HL("FS")_HL("FS")_""_HL("FS")_USER_HL("FS")_"NEW"
S CNT=CNT+1,PDX=$$EN^VAFCPID(DFN,"1,2,3,5,6,7,8,11,12,13,14,16,17,19")
S HLA("HLS",CNT)=PDX
S CNT=CNT+1,HLA("HLS",CNT)="PV1"_HL("FS")_HL("FS")_HL("FS")_$P($$NNT^XUAF4(+$P(N0,"^",7)),"^",2)_HL("FS")_HL("FS")_HL("FS")_$P($$SITE^VASITE,"^",3)
D GENERATE^HLMA(SERVER,"LM",1,.RLST,"",.HL)
I 'RLST D
.D START^RGHLLOG()
.D EXC^RGHLLOG(220,"Unable to Generate HL7 msg for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
.D STOP^RGHLLOG()
.D RESET(DFN,REQNO)
.S ER="-1^error in HL7 sending msg"
Q
RESET(DFN,REQNO) ;
; reset status to pending approval and change CMOR to this site
N ERR
D RESET2^MPIFREQ(REQNO)
S ERR=$$CHANGE^MPIF001(DFN,+$$SITE^VASITE)
Q
;
SET(DFN,SITE) ;Set CMOR for patient to site
NEW RESULT
S RESULT=$$CHANGE^MPIF001(DFN,SITE)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFCMOR 2432 printed Oct 16, 2024@18:11:43 Page 2
MPIFCMOR ;BHM/RGY-Set and broadcast CMOR changes ;FEB 20, 1998
+1 ;;1.0; MASTER PATIENT INDEX VISTA ;**1,6,11,30**;30 Apr 99
+2 ;
+3 ; Intergation Agreements Utilized:
+4 ; EXC^RGHLLOG IA #2796
+5 ; START^RGHLLOG IA #2796
+6 ; STOP^RGHLLOG IA #2796
+7 ; $$EN^VAFCPID IA #3015
+8 ;
BROAD(REQNO,ER) ;Broadcase CMOR change to everyone
+1 NEW CN,RGL,HL,CNT,HLA,PDX,ICN,HOME,RGLINK,RGL,TMP,II,CLIENT,HLA,USER,N0,NDATE,RLST,SERVER,ERR,MPILK
+2 SET ER=0
+3 SET SERVER="MPIF CMOR RESULT SERVER"
+4 SET CLIENT="MPIF CMOR RESULT CLIENT"
+5 SET N0=$GET(^MPIF(984.9,REQNO,0))
+6 SET DFN=$PIECE(N0,"^",4)
+7 SET NDATE=$PIECE(N0,"^",3)
+8 NEW X,Y,DIC
+9 SET DIC="^VA(200,"
SET DIC(0)="MZO"
SET X="`"_+$PIECE(N0,"^",2)
+10 DO ^DIC
+11 IF $GET(Y)<1
SET USER="Automatic Processing"
+12 IF $GET(Y)>0
SET USER=$GET(Y(0,0))
+13 SET SITE=+$PIECE($$SITE^VASITE,"^",3)
+14 SET ICN=$$ICN^MPIFNQ(DFN)
+15 SET HOME=$PIECE($$MPINODE^MPIFAPI(DFN),"^",3)
+16 SET CN=+$PIECE($$MPINODE^MPIFAPI(DFN),"^",5)
+17 SET HL=0
SET CNT=0
+18 KILL ^XTMP("MPIFCMOR","ERR")
+19 DO INIT^HLFNC2(SERVER,.HL)
+20 IF HL
SET ERR=HL
Begin DoDot:1
+21 DO START^RGHLLOG()
+22 DO EXC^RGHLLOG(220,"Unable to setup HL7 for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
+23 DO STOP^RGHLLOG()
+24 DO RESET(DFN,REQNO)
End DoDot:1
QUIT
+25 KILL HLL("LINKS")
+26 ;routing all messages through the MPI
SET MPILK=$$MPILINK^MPIFAPI
+27 IF +MPILK<0
Begin DoDot:1
+28 DO START^RGHLLOG()
+29 DO EXC^RGHLLOG(224,"No MPI link found for Change CMOR Request # "_REQNO_" for ICN="_ICN,DFN)
+30 DO STOP^RGHLLOG()
+31 DO RESET(DFN,REQNO)
+32 SET ER="-1^No Links found"
End DoDot:1
QUIT
+33 ;Broadcast new CMOR to MPI which will send it out to all sites
+34 SET HLL("LINKS",1)=CLIENT_"^"_MPILK
+35 SET CNT=CNT+1
SET HLA("HLS",CNT)="EVN"_HL("FS")_"A31"_HL("FS")_NDATE_HL("FS")_HL("FS")_""_HL("FS")_USER_HL("FS")_"NEW"
+36 SET CNT=CNT+1
SET PDX=$$EN^VAFCPID(DFN,"1,2,3,5,6,7,8,11,12,13,14,16,17,19")
+37 SET HLA("HLS",CNT)=PDX
+38 SET CNT=CNT+1
SET HLA("HLS",CNT)="PV1"_HL("FS")_HL("FS")_HL("FS")_$PIECE($$NNT^XUAF4(+$PIECE(N0,"^",7)),"^",2)_HL("FS")_HL("FS")_HL("FS")_$PIECE($$SITE^VASITE,"^",3)
+39 DO GENERATE^HLMA(SERVER,"LM",1,.RLST,"",.HL)
+40 IF 'RLST
Begin DoDot:1
+41 DO START^RGHLLOG()
+42 DO EXC^RGHLLOG(220,"Unable to Generate HL7 msg for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
+43 DO STOP^RGHLLOG()
+44 DO RESET(DFN,REQNO)
+45 SET ER="-1^error in HL7 sending msg"
End DoDot:1
+46 QUIT
RESET(DFN,REQNO) ;
+1 ; reset status to pending approval and change CMOR to this site
+2 NEW ERR
+3 DO RESET2^MPIFREQ(REQNO)
+4 SET ERR=$$CHANGE^MPIF001(DFN,+$$SITE^VASITE)
+5 QUIT
+6 ;
SET(DFN,SITE) ;Set CMOR for patient to site
+1 NEW RESULT
+2 SET RESULT=$$CHANGE^MPIF001(DFN,SITE)
+3 QUIT