source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGDHLE.m@ 1796

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1MAGDHLE ;WOIFO/SRR - PACS INTERFACE PID TRIGGERS ; [ 06/20/2001 08:56 ]
2 ;;3.0;IMAGING;;Mar 01, 2002
3 ;; +---------------------------------------------------------------+
4 ;; | Property of the US Government. |
5 ;; | No permission to copy or redistribute this software is given. |
6 ;; | Use of unreleased versions of this software requires the user |
7 ;; | to execute a written test agreement with the VistA Imaging |
8 ;; | Development Office of the Department of Veterans Affairs, |
9 ;; | telephone (301) 734-0100. |
10 ;; | |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18SET ;Set Logic from MUMPS x-ref on fields .01,.03,.09 of ^DD(2 (^DPT)
19 ;Kill logic: S MAGKPID=X for all 3 fields
20 ;IN - MAGKPID = old value
21 ; - MAGKTYP = Message type (from field)
22 Q:'$G(^MAG(2006.1,"APACS"))
23 Q
24 G EX:'$D(MAGKPID),EX:MAGKPID=X
25 S DFN=DA,MAGKTYP=8,MAGDPTCL="Pt. Demo."
26 G TSK
27 ;
28KIL ;Kill logic "AKn" cross references
29 Q:'$G(^MAG(2006.1,"APACS"))
30 Q
31 S MAGKPID=X
32 Q
33 ;
34ADT ;ADT EVENTS ;From EVENT driver
35 ;Protocol = MAGK DHCP-PACS ADT EVENTS
36 ;IN ;DFN
37 ;DGPMDA = IFN Primary Movement
38 ;DGPMA = 0th node Primary Movement AFTER movement
39 ;DGPMP = 0th node PRIOR to movement
40 ;^UTILITY("DGPM",$J,TRANSACTION (1,2,3,6),MOVEMENT (IFN),"P"/"A")
41 ;
42 K MAGKTYP F I=1,2,3 I $D(^UTILITY("DGPM",$J,I,DGPMDA)) S MAGKTYP=I
43 Q:'$D(MAGKTYP) I MAGKTYP=2,$P(^UTILITY("DGPM",$J,2,DGPMDA,"A"),U,6)=$P(^("P"),U,6) G EX
44TSK ;CREATE TASK to make HL7 messages
45 S ZTSAVE("MAGKTYP")="",ZTSAVE("MAGDPTCL")=""
46 S ZTSAVE("DFN")="",ZTDTH=$H,ZTIO=""
47 S ZTRTN="HL7^MAGDHLE",ZTDESC=$S(MAGKTYP=8:"PID",1:"ADT")_" HL7 PACS MESSAGE"
48 W !?5,"*** HL7 TASK FOR PACS ***" D ^%ZTLOAD G EX
49 ;
50HL7 ;Create HL7 message
51 Q:'$D(^DPT(DFN,0))
52 S N0=^DPT(DFN,0),HLNDAP="PACS GATEWAY",HLMTN="ADT"
53 D INIT^HLTRANS
54 D EVN,PID,NK1,PV1 K N0,N1 D EN^MAGDHL7T,KILL^HLTRANS
55 ;D EN^HLTRANS,KILL^HLTRANS
56EX ;EXIT
57 K ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE
58 K MAGKPID,MAGKTYP
59 Q
60 ;
61EVN ;EVENT SEGMENT
62 S HLSDATA(2)="EVN^"_$P($T(ETYP+MAGKTYP),";",3)_"^"_$$HLDATE^HLFNC(DT)
63 Q
64PID ;PID SEGMENT
65 I '$P(N0,U,9) S NO=^DPT(DFN,0)
66 S $P(N1,U,1,7)="PID^^^"_$$M11^HLFNC(DFN)_"^^"_$$HLNAME^HLFNC($P(N0,U))_"^^"_$$HLDATE^HLFNC($P(N0,U,3))_"^"_$P(N0,U,2)
67 S $P(N1,U,20)=$P(N0,U,9),HLSDATA(3)=N1
68 Q
69 ;
70NK1 ;NEXT OF KIN
71 S HLSDATA(4)="NK1^"
72 Q
73PV1 ;PV1 SEGMENT
74 S HLSDATA(5)="PV1^^"_$S($D(^DPT(DFN,.1)):"I",1:"O")_"^"_$G(^DPT(DFN,.1))
75 Q
76 ;
77ETYP ;EVENT TYPE; for later possible use
78 ;;A01;ADMIT
79 ;;A02;TRANSFER
80 ;;A03;DISCHARGE
81 ;;A04;REGISTER
82 ;;A05;PRE-ADMIT
83 ;;A06;TRANSFER OUT/IN
84 ;;A07;TRANSFER IN/OUT
85 ;;A08;UPDATE PATIENT INFORMATION
86 Q
87HLDT1 ;TEMP FIX FOR HLTRANS UNDEF
88 Q
89FIX ;D NOW^%DTC S HLDT=%,HLDT1=$$HLDATE^HLFNC(HLDT)
90 Q
Note: See TracBrowser for help on using the repository browser.