VAFCMS02 ;BP-CIOFO/JRP-PIVOT FILE RETRANSMISSION ;8/3/1998
;;5.3;Registration;**209,149**;Aug 13, 1993
;
PATIENT ;Transmit demographic data for user selected entry in PATIENT file (#2)
;Input : None
;Output : None
;Notes : Creates entry in ADT/HL7 PIVOT file (#391.71) and flags
; for transmission
;
N DFN,PIVOTNUM,PIVOTPTR,VPTR
F W !! S DFN=$$GETDFN^VAFCMS01() Q:(DFN<1) D
.;Create entry in ADT/HL7 PIVOT file (returns pivot number)
.S VPTR=DFN_";DPT("
.S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$$NOW^XLFDT(),4,VPTR)
.I ('PIVOTNUM) D Q
..W !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
..W !," UNABLE TO CREATE ENTRY IN ADT/HL7 PIVOT FILE"
..W !!
..H 2
.;Convert pivot number to pointer
.S PIVOTPTR=+$O(^VAT(391.71,"D",PIVOTNUM,0))
.I ('PIVOTPTR) D Q
..W !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
..W !," UNABLE TO PROPERLY CREATE ENTRY IN ADT/HL7 PIVOT FILE"
..W !!
..H 2
.;Transmit
.D DEMO(PIVOTPTR)
.W !,"Demographic data queued for transmission"
Q
;
PIVOT ;Retransmit user selected entry in ADT/HL7 PIVOT file (#391.71)
;Input : None
;Output : None
;
N PIVOT
F W !! S PIVOT=$$GETPIVOT() Q:(PIVOT<1) D
.D RETRAN(PIVOT)
.W !,"Selected entry queued for retransmission"
Q
;
GETPIVOT() ;Get pointer to ADT/HL7 PIVOT file (#391.71)
;Input : None
;Output : Pointer to ADT/HL7 PIVOT file
; -1 returned if no selection made
;Notes : Pivot file entry must point to a valid patient
; : Selection of event types 2 (outpatient) and 5 (treating
; facility update) are not supported/allowed
;
N DIC,X,Y,DTOUT,DUOUT
S DIC="^VAT(391.71,"
S DIC(0)="AEMNQ"
S DIC("S")="I "",1,3,4,""[+$P(^(0),""^"",4) I $D(^DPT(+$P(^(0),""^"",3),0))"
D ^DIC
Q +Y
;
RETRAN(PIVOT) ;Retransmit entry in ADT/HL7 PIVOT file (#391.71)
;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
;Output : None
;Notes : Support for pivot event types 2 (outpatient) and 5
; (treating facility update) not implemented
;
;
N NODE,TYPE
;Get event type out of pivot file
S NODE=$G(^VAT(391.71,PIVOT,0))
S TYPE=+$P(NODE,"^",4)
;Inpatient (A/D/T)
I TYPE=1 D Q
.N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
.S ZTRTN="ADT^VAFCMS02("_PIVOT_")"
.S ZTDESC="Retransmit admission history message(s) via HL7"
.S ZTDTH=$H
.S ZTIO=""
.D ^%ZTLOAD
;Register
I TYPE=3 D Q
.N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
.S ZTRTN="REG^VAFCMS02("_PIVOT_")"
.S ZTDESC="Retransmit registration message via HL7"
.S ZTDTH=$H
.S ZTIO=""
.D ^%ZTLOAD
;Demographic update
I TYPE=4 D DEMO(PIVOT) Q
Q
;
ADT(PIVOT) ;Transmit Admit/Discharge/Transfer entry in pivot file
;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
;Output : None
;
N NODE,DFN,ADMSSN,HISTORY
;Clean up HL7 variables
K ^TMP("HLS",$J) D KILL^HLTRANS
;Get required info out of pivot file
S NODE=$G(^VAT(391.71,PIVOT,0))
S DFN=+$P(NODE,"^",3)
S ADMSSN=+$P(NODE,"^",5)
;Build list of A/D/T events (i.e. movements) for related admission
D BLDHIST^VAFCADT3(DFN,ADMSSN,"HISTORY")
;Transmit A/D/T history for related admission
D ENTIRE^VAFCADT4(PIVOT)
;Clean up HL7 variables
K ^TMP("HLS",$J) D KILL^HLTRANS
S:($D(ZTQUEUED)) ZTREQ="@"
Q
REG(PIVOT) ;Transmit Registration entry in pivot file
;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
;Output : None
;
N NODE,DFN,DATE,RESULT
;Clean up HL7 variables
K ^TMP("HLS",$J) D KILL^HLTRANS
;Get required info out of pivot file
S NODE=$G(^VAT(391.71,PIVOT,0))
S DFN=+$P(NODE,"^",3),USER=+$P(NODE,"^",9)
S DATE=+NODE
;Generate/send message
S RESULT=$$EN^VAFCA04(DFN,DATE,USER,PIVOT)
;Clean up HL7 variables
K ^TMP("HLS",$J) D KILL^HLTRANS
S:($D(ZTQUEUED)) ZTREQ="@"
Q
DEMO(PIVOT) ;Transmit Demographic Update entry in pivot file
;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
;Output : None
;
;Flag entry in pivot file for transmission (let background job send it)
D XMITFLAG^VAFCDD01(PIVOT)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFCMS02 4067 printed Dec 13, 2024@03:01:57 Page 2
VAFCMS02 ;BP-CIOFO/JRP-PIVOT FILE RETRANSMISSION ;8/3/1998
+1 ;;5.3;Registration;**209,149**;Aug 13, 1993
+2 ;
PATIENT ;Transmit demographic data for user selected entry in PATIENT file (#2)
+1 ;Input : None
+2 ;Output : None
+3 ;Notes : Creates entry in ADT/HL7 PIVOT file (#391.71) and flags
+4 ; for transmission
+5 ;
+6 NEW DFN,PIVOTNUM,PIVOTPTR,VPTR
+7 FOR
WRITE !!
SET DFN=$$GETDFN^VAFCMS01()
if (DFN<1)
QUIT
Begin DoDot:1
+8 ;Create entry in ADT/HL7 PIVOT file (returns pivot number)
+9 SET VPTR=DFN_";DPT("
+10 SET PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$$NOW^XLFDT(),4,VPTR)
+11 IF ('PIVOTNUM)
Begin DoDot:2
+12 WRITE !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
+13 WRITE !," UNABLE TO CREATE ENTRY IN ADT/HL7 PIVOT FILE"
+14 WRITE !!
+15 HANG 2
End DoDot:2
QUIT
+16 ;Convert pivot number to pointer
+17 SET PIVOTPTR=+$ORDER(^VAT(391.71,"D",PIVOTNUM,0))
+18 IF ('PIVOTPTR)
Begin DoDot:2
+19 WRITE !!,"** UNABLE TO TRANSMIT DEMOGRAPHIC DATA **"
+20 WRITE !," UNABLE TO PROPERLY CREATE ENTRY IN ADT/HL7 PIVOT FILE"
+21 WRITE !!
+22 HANG 2
End DoDot:2
QUIT
+23 ;Transmit
+24 DO DEMO(PIVOTPTR)
+25 WRITE !,"Demographic data queued for transmission"
End DoDot:1
+26 QUIT
+27 ;
PIVOT ;Retransmit user selected entry in ADT/HL7 PIVOT file (#391.71)
+1 ;Input : None
+2 ;Output : None
+3 ;
+4 NEW PIVOT
+5 FOR
WRITE !!
SET PIVOT=$$GETPIVOT()
if (PIVOT<1)
QUIT
Begin DoDot:1
+6 DO RETRAN(PIVOT)
+7 WRITE !,"Selected entry queued for retransmission"
End DoDot:1
+8 QUIT
+9 ;
GETPIVOT() ;Get pointer to ADT/HL7 PIVOT file (#391.71)
+1 ;Input : None
+2 ;Output : Pointer to ADT/HL7 PIVOT file
+3 ; -1 returned if no selection made
+4 ;Notes : Pivot file entry must point to a valid patient
+5 ; : Selection of event types 2 (outpatient) and 5 (treating
+6 ; facility update) are not supported/allowed
+7 ;
+8 NEW DIC,X,Y,DTOUT,DUOUT
+9 SET DIC="^VAT(391.71,"
+10 SET DIC(0)="AEMNQ"
+11 SET DIC("S")="I "",1,3,4,""[+$P(^(0),""^"",4) I $D(^DPT(+$P(^(0),""^"",3),0))"
+12 DO ^DIC
+13 QUIT +Y
+14 ;
RETRAN(PIVOT) ;Retransmit entry in ADT/HL7 PIVOT file (#391.71)
+1 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
+2 ;Output : None
+3 ;Notes : Support for pivot event types 2 (outpatient) and 5
+4 ; (treating facility update) not implemented
+5 ;
+6 ;
+7 NEW NODE,TYPE
+8 ;Get event type out of pivot file
+9 SET NODE=$GET(^VAT(391.71,PIVOT,0))
+10 SET TYPE=+$PIECE(NODE,"^",4)
+11 ;Inpatient (A/D/T)
+12 IF TYPE=1
Begin DoDot:1
+13 NEW ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
+14 SET ZTRTN="ADT^VAFCMS02("_PIVOT_")"
+15 SET ZTDESC="Retransmit admission history message(s) via HL7"
+16 SET ZTDTH=$HOROLOG
+17 SET ZTIO=""
+18 DO ^%ZTLOAD
End DoDot:1
QUIT
+19 ;Register
+20 IF TYPE=3
Begin DoDot:1
+21 NEW ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK
+22 SET ZTRTN="REG^VAFCMS02("_PIVOT_")"
+23 SET ZTDESC="Retransmit registration message via HL7"
+24 SET ZTDTH=$HOROLOG
+25 SET ZTIO=""
+26 DO ^%ZTLOAD
End DoDot:1
QUIT
+27 ;Demographic update
+28 IF TYPE=4
DO DEMO(PIVOT)
QUIT
+29 QUIT
+30 ;
ADT(PIVOT) ;Transmit Admit/Discharge/Transfer entry in pivot file
+1 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
+2 ;Output : None
+3 ;
+4 NEW NODE,DFN,ADMSSN,HISTORY
+5 ;Clean up HL7 variables
+6 KILL ^TMP("HLS",$JOB)
DO KILL^HLTRANS
+7 ;Get required info out of pivot file
+8 SET NODE=$GET(^VAT(391.71,PIVOT,0))
+9 SET DFN=+$PIECE(NODE,"^",3)
+10 SET ADMSSN=+$PIECE(NODE,"^",5)
+11 ;Build list of A/D/T events (i.e. movements) for related admission
+12 DO BLDHIST^VAFCADT3(DFN,ADMSSN,"HISTORY")
+13 ;Transmit A/D/T history for related admission
+14 DO ENTIRE^VAFCADT4(PIVOT)
+15 ;Clean up HL7 variables
+16 KILL ^TMP("HLS",$JOB)
DO KILL^HLTRANS
+17 if ($DATA(ZTQUEUED))
SET ZTREQ="@"
+18 QUIT
REG(PIVOT) ;Transmit Registration entry in pivot file
+1 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
+2 ;Output : None
+3 ;
+4 NEW NODE,DFN,DATE,RESULT
+5 ;Clean up HL7 variables
+6 KILL ^TMP("HLS",$JOB)
DO KILL^HLTRANS
+7 ;Get required info out of pivot file
+8 SET NODE=$GET(^VAT(391.71,PIVOT,0))
+9 SET DFN=+$PIECE(NODE,"^",3)
SET USER=+$PIECE(NODE,"^",9)
+10 SET DATE=+NODE
+11 ;Generate/send message
+12 SET RESULT=$$EN^VAFCA04(DFN,DATE,USER,PIVOT)
+13 ;Clean up HL7 variables
+14 KILL ^TMP("HLS",$JOB)
DO KILL^HLTRANS
+15 if ($DATA(ZTQUEUED))
SET ZTREQ="@"
+16 QUIT
DEMO(PIVOT) ;Transmit Demographic Update entry in pivot file
+1 ;Input : PIVOT - Pointer to entry in ADT/HL7 PIVOT file (#391.71)
+2 ;Output : None
+3 ;
+4 ;Flag entry in pivot file for transmission (let background job send it)
+5 DO XMITFLAG^VAFCDD01(PIVOT)
+6 QUIT