source: WorldVistAEHR/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFQUE5.m@ 1396

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1MPIFQUE5 ;SF/TNV-Process the RESULT from CMOR COMPARISON request ;FEB 20, 1998
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**1,6,11**;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 ;
10 ; This routine will process the message from the CMOR site to change
11 ; the CMOR as a result of a change cmor request
12 ;
13EN ; Entry point for process the update of CMOR
14 N U,LINE,IKI,ERROR,RGL,RGLOG
15 S U="^"
16 D START^RGHLLOG()
17 ;
18 N MPII,U,LINE,ERROR,PARENT,COUNT,NDATE,IKI,MPIFFS,MPIFSFS,MPIFREAP,RGLOG
19 F MPII=1:1 X HLNEXT Q:HLQUIT'>0 D
20 . S LINE=HLNODE
21 . I $P(LINE,HL("FS"))["MSH" D MSH
22 . I $P(LINE,HL("FS"))["PV1" D PV1
23 . I $P(LINE,HL("FS"))["PID" D PID
24 I $G(ERROR)]"" D ACK Q ; Any problems before changing the CMOR
25 I ($G(SITE)]"")&($G(DFN)]"") D CHANGE
26 I $G(SITE)=""!($G(DFN)="") D
27 .S ERROR="Missing new CMOR or Patient to be changed"
28 .D EXC^RGHLLOG(219,ERROR_" for change CMOR request HL7 msg "_$G(HL("MID")))
29 D ACK
30 Q
31 ;
32MSH ; Process MSH segment
33 I $P(LINE,HL("FS"),16)="AL" S ACK="YES"
34 I $P(LINE,HL("FS"),16)="ER" S ACK="ERROR"
35 Q
36 ;
37PV1 ; Process PV1 segment
38 S SITE=$P(LINE,HL("FS"),4)
39 I SITE="" S ERROR="Missing CMOR site number in Change CMOR message for ICN "_ICN_" HL7 msg# "_$G(HL("MID")) D EXC^RGHLLOG(221,ERROR)
40 Q
41NTE ; Process NTE segment
42 S SITE=$P(LINE,HL("FS"),8)
43 I SITE="" S ERROR="Missing CMOR site number in Change CMOR message for ICN "_ICN_" HL7 msg# "_$G(HL("MID")) D EXC^RGHLLOG(221,ERROR)
44 Q
45 ;
46PID ; Process PID segment
47 S ICN=+$P(LINE,HL("FS"),3) ; get ICN out.
48 I ICN<1 S ERROR="Missing Patient ICN in Change CMOR message HL7 msg# "_$G(HL("MID")) D EXC^RGHLLOG(219,ERROR) Q
49 S DFN=$$IEN^MPIFNQ(ICN) ; get DFN of this patient
50 I DFN="" S ERROR="ICN "_ICN_" not found from Change CMOR message HL7 msg# "_$G(HL("MID")) D EXC^RGHLLOG(219,ERROR) Q
51 Q
52 ;
53CHANGE ; Process the change CMOR to the new CMOR site (YOUR SITE NOW)
54 S DIC="^DIC(4,",DIC(0)="QMOZX",X=SITE D ^DIC K DIC ; Figure out
55 I Y=-1 S ERROR="CMOR Site name is not on file for Station Number "_SITE_" processing Change CMOR msg for ICN "_ICN D EXC^RGHLLOG(211,ERROR,DFN) Q ; the CMOR site
56 S CHANGE=$$CHANGE^MPIF001(+DFN,+Y) ; name and change
57 I +CHANGE=-1 S ERROR="Unable to update CMOR for site "_SITE_". For DFN "_DFN_" Processing CHANGE CMOR message "_HLMTIEN D EXC^RGHLLOG(211,ERROR,DFN)
58 Q
59 ;
60ACK ; Clean up the partition.
61 ;
62 D STOP^RGHLLOG()
63 K X,Y,DFN,ICN,SITE,MPIFREAP,ACK,PARENT,CHANGE
64 Q
Note: See TracBrowser for help on using the repository browser.