source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCMS02.m@ 1306

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1VAFCMS02 ;BP-CIOFO/JRP-PIVOT FILE RETRANSMISSION ;8/3/1998
2 ;;5.3;Registration;**209,149**;Aug 13, 1993
3 ;
4PATIENT ;Transmit demographic data for user selected entry in PATIENT file (#2)
5 ;Input : None
6 ;Output : None
7 ;Notes : Creates entry in ADT/HL7 PIVOT file (#391.71) and flags
8 ; for transmission
9 ;
10 N DFN,PIVOTNUM,PIVOTPTR,VPTR
11 F W !! S DFN=$$GETDFN^VAFCMS01() Q:(DFN<1) D
12 .;Create entry in ADT/HL7 PIVOT file (returns pivot number)
13 .S VPTR=DFN_";DPT("
14 .S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$$NOW^XLFDT(),4,VPTR)
15 .I ('PIVOTNUM) D Q
16 ..W !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
17 ..W !," UNABLE TO CREATE ENTRY IN ADT/HL7 PIVOT FILE"
18 ..W !!
19 ..H 2
20 .;Convert pivot number to pointer
21 .S PIVOTPTR=+$O(^VAT(391.71,"D",PIVOTNUM,0))
22 .I ('PIVOTPTR) D Q
23 ..W !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
24 ..W !," UNABLE TO PROPERLY CREATE ENTRY IN ADT/HL7 PIVOT FILE"
25 ..W !!
26 ..H 2
27 .;Transmit
28 .D DEMO(PIVOTPTR)
29 .W !,"Demographic data queued for transmission"
30 Q
31 ;
32PIVOT ;Retransmit user selected entry in ADT/HL7 PIVOT file (#391.71)
33 ;Input : None
34 ;Output : None
35 ;
36 N PIVOT
37 F W !! S PIVOT=$$GETPIVOT() Q:(PIVOT<1) D
38 .D RETRAN(PIVOT)
39 .W !,"Selected entry queued for retransmission"
40 Q
41 ;
42GETPIVOT() ;Get pointer to ADT/HL7 PIVOT file (#391.71)
43 ;Input : None
44 ;Output : Pointer to ADT/HL7 PIVOT file
45 ; -1 returned if no selection made
46 ;Notes : Pivot file entry must point to a valid patient
47 ; : Selection of event types 2 (outpatient) and 5 (treating
48 ; facility update) are not supported/allowed
49 ;
50 N DIC,X,Y,DTOUT,DUOUT
51 S DIC="^VAT(391.71,"
52 S DIC(0)="AEMNQ"
53 S DIC("S")="I "",1,3,4,""[+$P(^(0),""^"",4) I $D(^DPT(+$P(^(0),""^"",3),0))"
54 D ^DIC
55 Q +Y
56 ;
57RETRAN(PIVOT) ;Retransmit entry in ADT/HL7 PIVOT file (#391.71)
58 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
59 ;Output : None
60 ;Notes : Support for pivot event types 2 (outpatient) and 5
61 ; (treating facility update) not implemented
62 ;
63 ;
64 N NODE,TYPE
65 ;Get event type out of pivot file
66 S NODE=$G(^VAT(391.71,PIVOT,0))
67 S TYPE=+$P(NODE,"^",4)
68 ;Inpatient (A/D/T)
69 I TYPE=1 D Q
70 .N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
71 .S ZTRTN="ADT^VAFCMS02("_PIVOT_")"
72 .S ZTDESC="Retransmit admission history message(s) via HL7"
73 .S ZTDTH=$H
74 .S ZTIO=""
75 .D ^%ZTLOAD
76 ;Register
77 I TYPE=3 D Q
78 .N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
79 .S ZTRTN="REG^VAFCMS02("_PIVOT_")"
80 .S ZTDESC="Retransmit registration message via HL7"
81 .S ZTDTH=$H
82 .S ZTIO=""
83 .D ^%ZTLOAD
84 ;Demographic update
85 I TYPE=4 D DEMO(PIVOT) Q
86 Q
87 ;
88ADT(PIVOT) ;Transmit Admit/Discharge/Transfer entry in pivot file
89 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
90 ;Output : None
91 ;
92 N NODE,DFN,ADMSSN,HISTORY
93 ;Clean up HL7 variables
94 K ^TMP("HLS",$J) D KILL^HLTRANS
95 ;Get required info out of pivot file
96 S NODE=$G(^VAT(391.71,PIVOT,0))
97 S DFN=+$P(NODE,"^",3)
98 S ADMSSN=+$P(NODE,"^",5)
99 ;Build list of A/D/T events (i.e. movements) for related admission
100 D BLDHIST^VAFCADT3(DFN,ADMSSN,"HISTORY")
101 ;Transmit A/D/T history for related admission
102 D ENTIRE^VAFCADT4(PIVOT)
103 ;Clean up HL7 variables
104 K ^TMP("HLS",$J) D KILL^HLTRANS
105 S:($D(ZTQUEUED)) ZTREQ="@"
106 Q
107REG(PIVOT) ;Transmit Registration entry in pivot file
108 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
109 ;Output : None
110 ;
111 N NODE,DFN,DATE,RESULT
112 ;Clean up HL7 variables
113 K ^TMP("HLS",$J) D KILL^HLTRANS
114 ;Get required info out of pivot file
115 S NODE=$G(^VAT(391.71,PIVOT,0))
116 S DFN=+$P(NODE,"^",3),USER=+$P(NODE,"^",9)
117 S DATE=+NODE
118 ;Generate/send message
119 S RESULT=$$EN^VAFCA04(DFN,DATE,USER,PIVOT)
120 ;Clean up HL7 variables
121 K ^TMP("HLS",$J) D KILL^HLTRANS
122 S:($D(ZTQUEUED)) ZTREQ="@"
123 Q
124DEMO(PIVOT) ;Transmit Demographic Update entry in pivot file
125 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
126 ;Output : None
127 ;
128 ;Flag entry in pivot file for transmission (let background job send it)
129 D XMITFLAG^VAFCDD01(PIVOT)
130 Q
Note: See TracBrowser for help on using the repository browser.