source: FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFCMOR.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1MPIFCMOR ;BHM/RGY-Set and broadcast CMOR changes ;FEB 20, 1998
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**1,6,11,30**;30 Apr 99
3 ;
4 ; Intergation Agreements Utilized:
5 ; EXC^RGHLLOG IA #2796
6 ; START^RGHLLOG IA #2796
7 ; STOP^RGHLLOG IA #2796
8 ; $$EN^VAFCPID IA #3015
9 ;
10BROAD(REQNO,ER) ;Broadcase CMOR change to everyone
11 N CN,RGL,HL,CNT,HLA,PDX,ICN,HOME,RGLINK,RGL,TMP,II,CLIENT,HLA,USER,N0,NDATE,RLST,SERVER,ERR,MPILK
12 S ER=0
13 S SERVER="MPIF CMOR RESULT SERVER"
14 S CLIENT="MPIF CMOR RESULT CLIENT"
15 S N0=$G(^MPIF(984.9,REQNO,0))
16 S DFN=$P(N0,"^",4)
17 S NDATE=$P(N0,"^",3)
18 N X,Y,DIC
19 S DIC="^VA(200,",DIC(0)="MZO",X="`"_+$P(N0,"^",2)
20 D ^DIC
21 I $G(Y)<1 S USER="Automatic Processing"
22 I $G(Y)>0 S USER=$G(Y(0,0))
23 S SITE=+$P($$SITE^VASITE,"^",3)
24 S ICN=$$ICN^MPIFNQ(DFN)
25 S HOME=$P($$MPINODE^MPIFAPI(DFN),"^",3)
26 S CN=+$P($$MPINODE^MPIFAPI(DFN),"^",5)
27 S HL=0,CNT=0
28 K ^XTMP("MPIFCMOR","ERR")
29 D INIT^HLFNC2(SERVER,.HL)
30 I HL S ERR=HL D Q
31 .D START^RGHLLOG()
32 .D EXC^RGHLLOG(220,"Unable to setup HL7 for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
33 .D STOP^RGHLLOG()
34 .D RESET(DFN,REQNO)
35 K HLL("LINKS")
36 S MPILK=$$MPILINK^MPIFAPI ;routing all messages through the MPI
37 I +MPILK<0 D Q
38 .D START^RGHLLOG()
39 .D EXC^RGHLLOG(224,"No MPI link found for Change CMOR Request # "_REQNO_" for ICN="_ICN,DFN)
40 .D STOP^RGHLLOG()
41 .D RESET(DFN,REQNO)
42 .S ER="-1^No Links found"
43 ;Broadcast new CMOR to MPI which will send it out to all sites
44 S HLL("LINKS",1)=CLIENT_"^"_MPILK
45 S CNT=CNT+1,HLA("HLS",CNT)="EVN"_HL("FS")_"A31"_HL("FS")_NDATE_HL("FS")_HL("FS")_""_HL("FS")_USER_HL("FS")_"NEW"
46 S CNT=CNT+1,PDX=$$EN^VAFCPID(DFN,"1,2,3,5,6,7,8,11,12,13,14,16,17,19")
47 S HLA("HLS",CNT)=PDX
48 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)
49 D GENERATE^HLMA(SERVER,"LM",1,.RLST,"",.HL)
50 I 'RLST D
51 .D START^RGHLLOG()
52 .D EXC^RGHLLOG(220,"Unable to Generate HL7 msg for Change CMOR Request # "_REQNO_" for ICN= "_ICN,DFN)
53 .D STOP^RGHLLOG()
54 .D RESET(DFN,REQNO)
55 .S ER="-1^error in HL7 sending msg"
56 Q
57RESET(DFN,REQNO) ;
58 ; reset status to pending approval and change CMOR to this site
59 N ERR
60 D RESET2^MPIFREQ(REQNO)
61 S ERR=$$CHANGE^MPIF001(DFN,+$$SITE^VASITE)
62 Q
63 ;
64SET(DFN,SITE) ;Set CMOR for patient to site
65 NEW RESULT
66 S RESULT=$$CHANGE^MPIF001(DFN,SITE)
67 Q
Note: See TracBrowser for help on using the repository browser.