source: FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFA24B.m@ 1742

Last change on this file since 1742 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1MPIFA24B ;BP/CMC-BUILD A24 ADD ME MSGS ;JULY 22, 2002
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**22,28,31,25,43,44**;30 Apr 99;Build 7
3 ;
4 ; Integration Agreements Utilized:
5 ; START, EXC, STOP^RGHLLOG - #2796
6 ; BLDEVN, BLDPD1, BLDPID^VAFCQRY - #3630
7 ;
8A24(DFN,PID2) ;BUILD AND SEND A24 **43 added PID2 as a parameter - not required.
9 ; if PID2 is defined it will contain the previous ICN data, passed by reference
10 N RESLT,CNT,MPI,EVN,TCNT,ERR,PD1,PID
11 K HLA("HLA"),HLA("HLS")
12 S CNT=1
13 D INIT^HLFNC2("MPIF ADT-A24 SERVER",.HL)
14 I $O(HL(""))="" Q "-1^"_$P(HL,"^",2)
15 S HLECH=HL("ECH"),HLFS=HL("FS"),COMP=$E(HL("ECH"),1),REP=$E(HL("ECH"),2),SUBCOMP=$E(HL("ECH"),4)
16 S ERR="",TCNT=0
17 D BLDEVN^VAFCQRY(DFN,"1,2",.EVN,.HL,"A24",.ERR)
18 Q:ERR'="" ERR
19 D BLDPID^VAFCQRY(DFN,1,"ALL",.PID,.HL,.ERR)
20 Q:ERR'="" ERR
21 D BLDPD1^VAFCQRY(DFN,"3",.PD1,.HL,.ERR)
22 Q:ERR'="" ERR
23 I '$D(PID2) D BLDPID^VAFCQRY(DFN,2,"ALL",.PID2,.HL,.ERR) ;**43 TO ONLY BUILD 2ND PID SEGMENT IF NOT PASSED
24 Q:ERR'="" ERR
25 S HLA("HLS",1)=EVN(1)
26 S HLA("HLS",3)=PD1(1)
27 S CNT=0 F S CNT=$O(PID(CNT)) Q:CNT="" D
28 .I CNT=1 S HLA("HLS",2)=PID(CNT)
29 .I CNT>1 S HLA("HLS",2,CNT-1)=PID(CNT)
30 S CNT=0 F S CNT=$O(PID2(CNT)) Q:CNT="" D
31 .I CNT=1 S HLA("HLS",4)=PID2(CNT)
32 .I CNT>1 S HLA("HLS",4,CNT-1)=PID2(CNT)
33 S HLA("HLS",5)=$$EN1^VAFHLZPD(DFN,"1,17,21,34") ;25 ;**44 Adding Pseudo SSN Reason, 1 and 21 to ZPD segment
34 K HLL("LINKS")
35 D GENERATE^HLMA("MPIF ADT-A24 SERVER","LM",1,.MPIFRSLT,"","")
36 S RESLT=$S(+MPIFRSLT:MPIFRSLT,1:$P(MPIFRSLT,"^",3))
37 I '+RESLT S ^XTMP("MPIFA24%"_DFN,0)=$$FMADD^XLFDT(DT,5)_"^"_DT_"^"_"A24 message to MPI for DFN "_DFN,^XTMP("MPIFA24%"_DFN,"MPI",0)="A"
38 K HLA,HLEID,HLL("LINKS"),COMP,REP,SUBCOMP,HLECH,HLFS,HLA("HLA"),HLA("HLS"),MPIFRSLT
39 ;**44 TRIGGER A31 TO UPDATE ANY DEMOGRAPHIC CHANGES
40 N A31 S A31=$$A31^MPIFA31B(DFN)
41 I $P(A31,"^",2)'="" D
42 .;log exception about A31 not being sent
43 .D START^RGHLLOG()
44 .D EXC^RGHLLOG(208,$P(A31,"^",2,3),"Unable to generate A31 for DFN"_DFN,DFN)
45 .D STOP^RGHLLOG(0)
46 I $P(A31,"^",2)="" S ^XTMP("MPIFA31%"_DFN,0)=$$FMADD^XLFDT(DT,5)_"^"_DT_"^"_"A31 message to MPI for DFN "_DFN,^XTMP("MPIFA31%"_DFN,"MPI",0)="A"
47 Q RESLT
48 ;
49RT ;
50 S MPI=$$MPILINK^MPIFAPI()
51 I $P($G(MPI),"^")=-1 D START^RGHLLOG(),EXC^RGHLLOG(224,"No logical link defined for the MPI",$G(DFN)),STOP^RGHLLOG() Q
52 S HLL("LINKS",1)="MPIF ADT-A24 CLIENT^"_MPI
53 Q
54RES ;
55 N NXT,DFN
56 F NXT=1:1 X HLNEXT Q:HLQUIT'>0 D
57 .I $E(HLNODE,1,3)="MSA" S DFN=$P($P(HLNODE,HL("FS"),7),"=",2)
58 .I $E(HLNODE,1,3)="MSA"&($P(HLNODE,HL("FS"),4)'="") D
59 ..; ERROR RETURNED IN MSA - LOG EXCEPTION --**44 stopped logging exception as MPI has already logged it.
60 ..;D START^RGHLLOG(HLMTIEN,"","")
61 ..;D EXC^RGHLLOG(208,$P(HLNODE,HL("FS"),4)_" for HL msg# "_HLMTIEN,DFN)
62 ..;D STOP^RGHLLOG(0)
63 K ^XTMP("MPIFA24%"_DFN)
64 Q
Note: See TracBrowser for help on using the repository browser.