source: WorldVistAEHR/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFRESS.m@ 623

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1MPIFRESS ;BHM/RGY-Process a CMOR result ;FEB 27, 1998
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**1,6,11,30**;30 Apr 99
3 ;
4 ; Integration Agreements Utilized:
5 ;
6 ; EXC^RGHLLOG IA #2796
7 ; START^RGHLLOG IA #2796
8 ; STOP^RGHLLOG IA #2796
9 ; $$EN^VAFCPID IA #3015
10 ;
11EN(REQNO) ;
12 N RGL,ID,COMMENTS,STATUS,NDATE,PHONE,REVIEWER,N0,CNT,HL,HLA,XX,ERROR
13 S CNT=0,HL=0
14 S N0=$G(^MPIF(984.9,REQNO,0))
15 I N0="" D Q
16 .D START^RGHLLOG()
17 .D EXC^RGHLLOG(210,"CMOR Request # "_REQNO_" Does Not Exist attempting to generate approved/not approved msg")
18 .D STOP^RGHLLOG()
19 S ID=$P(N0,"^")
20 S STATUS=$P(N0,"^",6)
21 S COMMENTS=$P($G(^MPIF(984.9,REQNO,3)),"^",2)
22 I $P($G(^MPIF(984.9,REQNO,3)),"^")]"" S REVIEWER=$P(^(3),"^")
23 I $P($G(^MPIF(984.9,REQNO,3)),"^")']"" D
24 .N DIC,X,Y
25 .S DIC="^VA(200,",DIC(0)="ZMO",X="`"_+$P(^MPIF(984.9,REQNO,2),"^")
26 .D ^DIC
27 .I $G(Y)>1 S REVIEWER=$G(Y(0,0))
28 .I $G(Y)<1 S REVIEWER=""
29 S NDATE=$P($G(^MPIF(984.9,REQNO,2)),"^",2)
30 S PHONE=$P($G(^MPIF(984.9,REQNO,2)),"^",3)
31 S COMMENTS=$P($G(^MPIF(984.9,REQNO,3)),"^",2)
32 K HLA
33 D INIT^HLFNC2("MPIF CMOR APPROVE/DISAPPROVE",.HL)
34 I HL S ERROR=HL D Q
35 .D START^RGHLLOG()
36 .D EXC^RGHLLOG(220,"Unable to setup HL7 for Change CMOR Request # "_REQNO_" for Approved/Not Approved msg HL Error"_HL,$P(N0,"^",4))
37 .D STOP^RGHLLOG()
38 K HLL("LINKS") N MPILK
39 S MPILK=$$MPILINK^MPIFAPI ;routing all messages through the MPI
40 I +MPILK<0 D Q
41 .D START^RGHLLOG()
42 .D EXC^RGHLLOG(224,"No MPI link found for Change CMOR Request # "_REQNO_" for ICN="_ICN,DFN)
43 .D STOP^RGHLLOG()
44 .S ERROR="-1^LINK FOR MPI NOT FOUND"
45 ;Broadcast MSG to MPI which will send it to the requestor site
46 S HLL("LINKS",1)="MPIF CMOR APP/DIS^"_MPILK
47 S CNT=CNT+1,HLA("HLS",CNT)="EVN"_HL("FS")_"A31"_HL("FS")_NDATE_HL("FS")_HL("FS")_""_HL("FS")_REVIEWER
48 S CNT=CNT+1,HLA("HLS",CNT)="NTE"_HL("FS")_HL("FS")_"P"_HL("FS")_PHONE_HL("FS")_COMMENTS_HL("FS")_STATUS_HL("FS")_ID
49 S CNT=CNT+1,HLA("HLS",CNT)=$$EN^VAFCPID(+$P(N0,"^",4),"1,2,4,5,6,7,8,11,12,13,14,16,17,19")
50 N RLST
51 D GENERATE^HLMA("MPIF CMOR APPROVE/DISAPPROVE","LM",1,.RLST,"",.HL)
52 I 'RLST S ERROR=RLST D START^RGHLLOG(),EXC^RGHLLOG(220,"Error Generating HL7 msg for Approve/Not Approved CMOR Request # "_REQNO,$P(N0,"^",4))
53 Q
54 ;
55IN ;
56 ; Processing approve/not approve msg to update Request in 984.9 file
57 N DFN,ENT,XMY,XMDUZ,XMTEXT,MPIF,XMSUB,FSITE,CMOR,PHONE,RESULT,REVIEWER,COMMENTS,NDATE,II,ICN
58 S (HLQUIT,ID,COMMENTS,PHONE,REVIEWER)=""
59 F II=1:1 X HLNEXT Q:HLQUIT'>0 D
60 .I $P(HLNODE,HL("FS"),1)="NTE" D
61 ..S ID=$P(HLNODE,HL("FS"),7),RESULT=$P(HLNODE,HL("FS"),6)
62 ..S PHONE=$P(HLNODE,HL("FS"),4)
63 ..S COMMENTS=$P(HLNODE,HL("FS"),5)
64 .I $P(HLNODE,HL("FS"),1)="EVN" D
65 ..S NDATE=$P(HLNODE,HL("FS"),3)
66 ..S REVIEWER=$P(HLNODE,HL("FS"),6)
67 .I $P(HLNODE,HL("FS"),1)="PID" D
68 ..S ICN=+$P(HLNODE,HL("FS"),3)
69 S ENT=$O(^MPIF(984.9,"B",ID,0))
70 ;; CHANGE FOR NOIS MAD-0900-42526
71 I ENT="" D
72 .D START^RGHLLOG()
73 .D EXC^RGHLLOG(210,"CMOR Request # "_ID_" Does Not Exist CMORs may be out of sync for ICN "_ICN_". HL7 msg# "_HL("MID"))
74 .D STOP^RGHLLOG()
75 Q:ENT=""
76 Q:'$D(^MPIF(984.9,ENT,0))
77 S DFN=$P($G(^MPIF(984.9,ENT,0)),"^",4),FSITE=$P($G(^(0)),"^",7)
78 S DIC="^DIC(4,",DIC(0)="MXNZ",X=FSITE D ^DIC
79 I $G(Y)>0 S FSITE=$P(Y,"^",2)
80 K Y,X,DIC
81 S DIE="^MPIF(984.9,",DA=ENT,DR="[MPIF RESULT INCOMING]" D ^DIE K DIE,DA,DR
82 S XMDUZ="MPI VISTA Package"
83 S XMSUB="Request "_ID_" is "_$S(RESULT=4:"approved",1:"disapproved")
84 N REQR S REQR=$P($G(^MPIF(984.9,ENT,0)),"^",2) I REQR="" S REQR="AUTO"
85 S XMY(REQR)="",XMTEXT="MPIF(1,"
86 S MPIF(1,1)=FSITE_" received CMOR request for "_$P($G(^DPT(+$P(^MPIF(984.9,ENT,0),"^",4),0)),"^")_" ("_$E($P(^(0),"^",9),6,9)_")."
87 S MPIF(1,2)=XMSUB_"."
88 S MPIF(1,3)="Processed by: "_$G(REVIEWER)
89 S MPIF(1,4)="Phone: "_$G(PHONE)
90 S MPIF(1,5)="Comments: "_$G(COMMENTS)
91 D ^XMD
92 Q
Note: See TracBrowser for help on using the repository browser.