46 lines
1.7 KiB
Mathematica
46 lines
1.7 KiB
Mathematica
MPIFA28 ;BP/CMC-BUILD A28 ADD ME MSGS ;MARCH 4, 2002
|
|
;;1.0; MASTER PATIENT INDEX VISTA ;**22,31,25,35,44**;30 Apr 99;Build 7
|
|
;
|
|
; Integration Agreements Utilized:
|
|
; START, EXC, STOP^RGHLLOG - #2796
|
|
; BLDEVN, BLDPD1, BLDPID^VAFCQRY - #3630
|
|
;
|
|
A28(DFN) ;BUILD AND SEND A28
|
|
N RESLT,CNT,MPI,EVN,TCNT,ERR,PD1,PID
|
|
K HLA("HLA"),HLA("HLS")
|
|
S CNT=1
|
|
D INIT^HLFNC2("MPIF ADT-A28 SERVER",.HL)
|
|
I $O(HL(""))="" Q "-1^"_$P(HL,"^",2)
|
|
S HLECH=HL("ECH"),HLFS=HL("FS"),COMP=$E(HL("ECH"),1),REP=$E(HL("ECH"),2),SUBCOMP=$E(HL("ECH"),4)
|
|
S ERR="",TCNT=0
|
|
D BLDEVN^VAFCQRY(DFN,"1,2",.EVN,.HL,"A28",.ERR)
|
|
Q:ERR'="" ERR
|
|
D BLDPID^VAFCQRY(DFN,1,"ALL",.PID,.HL,.ERR)
|
|
Q:ERR'="" ERR
|
|
D BLDPD1^VAFCQRY(DFN,"3",.PD1,.HL,.ERR)
|
|
Q:ERR'="" ERR
|
|
S HLA("HLS",1)=EVN(1)
|
|
S HLA("HLS",3)=PD1(1)
|
|
S CNT=0 F S CNT=$O(PID(CNT)) Q:CNT="" D
|
|
.I CNT=1 S HLA("HLS",2)=PID(CNT)
|
|
.I CNT>1 S HLA("HLS",2,CNT-1)=PID(CNT)
|
|
S HLA("HLS",4)=$$EN1^VAFHLZPD(DFN,"1,17,21,34") ;25 ;**44 ADDED PSEUDO SSN REASON, 1 and 21 TO ZPD SEGMENT
|
|
S MPI=$$MPILINK^MPIFAPI()
|
|
Q:$P($G(MPI),"^")=-1 "-1^No logical link defined for the MPI"
|
|
S HLL("LINKS",1)="MPIF ADT-A28 CLIENT^"_MPI
|
|
D GENERATE^HLMA("MPIF ADT-A28 SERVER","LM",1,.MPIFRSLT,"","")
|
|
S RESLT=$S(+MPIFRSLT:MPIFRSLT,1:$P(MPIFRSLT,"^",3))
|
|
I +RESLT S ^XTMP("MPIFA28%"_DFN,0)=$$FMADD^XLFDT(DT,5)_"^"_DT_"^"_"A28 message to MPI for DFN "_DFN,^XTMP("MPIFA28%"_DFN,"MPI",0)="A"
|
|
I $D(^DPT("AICNL",1,DFN)) D
|
|
.I $G(^DPT("AICNL",1,DFN))="" S ^DPT("AICNL",1,DFN)="2^"_DT
|
|
.; **35
|
|
K HLA,HLEID,HLL("LINKS"),COMP,REP,SUBCOMP,HLECH,HLFS,HLA("HLA"),HLA("HLS"),MPIFRSLT
|
|
Q RESLT
|
|
;
|
|
RES ;
|
|
N NXT,DFN
|
|
F NXT=1:1 X HLNEXT Q:HLQUIT'>0 D
|
|
.I $E(HLNODE,1,3)="MSA" S DFN=$P($P(HLNODE,HL("FS"),7),"=",2)
|
|
K ^XTMP("MPIFA28%"_DFN)
|
|
Q
|