MHV7B1B ;WAS/GPM - HL7 message builder RTB^K13 Rx Profile ; 10/13/05 7:52pm [12/24/07 5:39pm]
;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
RDF(MSGROOT,CNT,LEN,HL) ; Build RDF segment for Rx Profile data
;
; Input:
; MSGROOT - Root of array holding the message
; CNT - Current message line counter
; LEN - Current message length
; HL - HL7 package array variable
;
; Output:
; - Populated message array
; - Updated LEN and CNT
;
N RDF
S RDF(0)="RDF"
S RDF(1)=20
S RDF(2,1,1)="Prescription Number",RDF(2,1,2)="ST",RDF(2,1,3)=20
S RDF(2,2,1)="IEN",RDF(2,2,2)="NM",RDF(2,2,3)=30
S RDF(2,3,1)="Drug Name",RDF(2,3,2)="ST",RDF(2,3,3)=40
S RDF(2,4,1)="Issue Date/Time",RDF(2,4,2)="TS",RDF(2,4,3)=26
S RDF(2,5,1)="Last Fill Date",RDF(2,5,2)="TS",RDF(2,5,3)=26
S RDF(2,6,1)="Release Date/Time",RDF(2,6,2)="TS",RDF(2,6,3)=26
S RDF(2,7,1)="Expiration or Cancel Date",RDF(2,7,2)="TS",RDF(2,7,3)=26
S RDF(2,8,1)="Status",RDF(2,8,2)="ST",RDF(2,8,3)=25
S RDF(2,9,1)="Quantity",RDF(2,9,2)="NM",RDF(2,9,3)=11
S RDF(2,10,1)="Days Supply",RDF(2,10,2)="NM",RDF(2,10,3)=3
S RDF(2,11,1)="Number of Refills",RDF(2,11,2)="NM",RDF(2,11,3)=3
S RDF(2,12,1)="Provider",RDF(2,12,2)="XCN",RDF(2,12,3)=150
S RDF(2,13,1)="Placer Order Number",RDF(2,13,2)="ST",RDF(2,13,3)=30
S RDF(2,14,1)="Mail/Window",RDF(2,14,2)="ST",RDF(2,14,3)=1
S RDF(2,15,1)="Division",RDF(2,15,2)="NM",RDF(2,15,3)=3
S RDF(2,16,1)="Division Name",RDF(2,16,2)="ST",RDF(2,16,3)=20
S RDF(2,17,1)="MHV Request Status",RDF(2,17,2)="NM",RDF(2,17,3)=3
S RDF(2,18,1)="MHV Request Status Date",RDF(2,18,2)="TS",RDF(2,18,3)=26
S RDF(2,19,1)="Remarks",RDF(2,19,2)="ST",RDF(2,19,3)=75
S RDF(2,20,1)="SIG",RDF(2,20,2)="TX",RDF(2,20,3)=1024
;
S CNT=CNT+1
S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.RDF,.HL)
S LEN=LEN+$L(@MSGROOT@(CNT))
Q
;
RDT(MSGROOT,DATAROOT,CNT,LEN,HL) ; Build RDT segments for Rx Profile data
;
; Walks data in DATAROOT to populate MSGROOT with RDT segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
; 3065 : HLNAME^XLFNAME
;
; Input:
; MSGROOT - Root of array holding the message
; DATAROOT - Root of array to hold extract data
; CNT - Current message line counter
; LEN - Current message length
; HL - HL7 package array variable
;
; Output:
; - Populated message array
; - Updated LEN and CNT
;
N I,RX,RX0,RXP,RXN,RXD,RDT,SIG,SEG,PIEN,NAME,WPLEN
D LOG^MHVUL2("MHV7B1B","BEGIN RDT","S","TRACE")
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S RX=@DATAROOT@(I)
. S RX0=@DATAROOT@(I,0)
. S RXP=@DATAROOT@(I,"P")
. S PIEN=+RXP
. S RXN=@DATAROOT@(I,"RXN")
. S RXD=@DATAROOT@(I,"DIV")
. K SIG M SIG=@DATAROOT@(I,"SIG")
. S RDT(0)="RDT"
. S RDT(1)=$P(RX,"^") ;Rx Number
. S RDT(2)=$P(RXN,"^",9) ;Rx IEN
. S RDT(3)=$$ESCAPE^MHV7U($P(RX,"^",2),.HL) ;Drug Name
. S RDT(4)=$$FMTHL7^XLFDT($P(RX0,"^",5)) ;Issue Date/Time
. S RDT(5)=$$FMTHL7^XLFDT($P(RX0,"^",12)) ;Last Fill Date
. S RDT(6)=$$FMTHL7^XLFDT($P(RXN,"^",2)) ;Release Date/Time
. S RDT(7)=$$FMTHL7^XLFDT($P(RX0,"^",3)) ;Expiration/Cancel Date
. S RDT(8)=$$ESCAPE^MHV7U($P(RX0,"^",6),.HL) ;Status
. S RDT(9)=$P(RX0,"^",8) ;Quantity
. S RDT(10)=$P(RX0,"^",7) ;Days Supply
. S RDT(11)=$P(RX0,"^",4) ;Number of Refills
. I PIEN D
.. D FMTNAME2^MHV7BU(PIEN,200,.NAME,.HL,"XCN")
.. M RDT(12,1)=NAME
.. S RDT(12,1,1)=PIEN ;Provider IEN
.. Q
. S RDT(13)=$$ESCAPE^MHV7U($P(RX0,"^",11),.HL) ;Placer Order Number
. S RDT(14)=$P(RXN,"^",3) ;Mail/Window
. S RDT(15)=$P(RXD,"^") ;Division
. S RDT(16)=$$ESCAPE^MHV7U($P(RXD,"^",2),.HL) ;Division Name
. S RDT(17)=$P(RX,"^",3) ;MHV status
. S RDT(18)=$$FMTHL7^XLFDT($P(RX,"^",4)) ;MHV status date
. S RDT(19)=$$ESCAPE^MHV7U($P(RXN,"^",4),.HL) ;Remarks
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.RDT,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q:'SIG(0)
. K SEG,WPLEN
. D BLDWP^MHV7U(.SIG,.SEG,1024,0,.WPLEN,.HL)
. M @MSGROOT@(CNT)=SEG
. S LEN=LEN+WPLEN
. Q
D LOG^MHVUL2("MHV7B1B","END RDT","S","TRACE")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV7B1B 4513 printed Dec 13, 2024@02:15:39 Page 2
MHV7B1B ;WAS/GPM - HL7 message builder RTB^K13 Rx Profile ; 10/13/05 7:52pm [12/24/07 5:39pm]
+1 ;;1.0;My HealtheVet;**2**;Aug 23, 2005;Build 22
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
RDF(MSGROOT,CNT,LEN,HL) ; Build RDF segment for Rx Profile data
+1 ;
+2 ; Input:
+3 ; MSGROOT - Root of array holding the message
+4 ; CNT - Current message line counter
+5 ; LEN - Current message length
+6 ; HL - HL7 package array variable
+7 ;
+8 ; Output:
+9 ; - Populated message array
+10 ; - Updated LEN and CNT
+11 ;
+12 NEW RDF
+13 SET RDF(0)="RDF"
+14 SET RDF(1)=20
+15 SET RDF(2,1,1)="Prescription Number"
SET RDF(2,1,2)="ST"
SET RDF(2,1,3)=20
+16 SET RDF(2,2,1)="IEN"
SET RDF(2,2,2)="NM"
SET RDF(2,2,3)=30
+17 SET RDF(2,3,1)="Drug Name"
SET RDF(2,3,2)="ST"
SET RDF(2,3,3)=40
+18 SET RDF(2,4,1)="Issue Date/Time"
SET RDF(2,4,2)="TS"
SET RDF(2,4,3)=26
+19 SET RDF(2,5,1)="Last Fill Date"
SET RDF(2,5,2)="TS"
SET RDF(2,5,3)=26
+20 SET RDF(2,6,1)="Release Date/Time"
SET RDF(2,6,2)="TS"
SET RDF(2,6,3)=26
+21 SET RDF(2,7,1)="Expiration or Cancel Date"
SET RDF(2,7,2)="TS"
SET RDF(2,7,3)=26
+22 SET RDF(2,8,1)="Status"
SET RDF(2,8,2)="ST"
SET RDF(2,8,3)=25
+23 SET RDF(2,9,1)="Quantity"
SET RDF(2,9,2)="NM"
SET RDF(2,9,3)=11
+24 SET RDF(2,10,1)="Days Supply"
SET RDF(2,10,2)="NM"
SET RDF(2,10,3)=3
+25 SET RDF(2,11,1)="Number of Refills"
SET RDF(2,11,2)="NM"
SET RDF(2,11,3)=3
+26 SET RDF(2,12,1)="Provider"
SET RDF(2,12,2)="XCN"
SET RDF(2,12,3)=150
+27 SET RDF(2,13,1)="Placer Order Number"
SET RDF(2,13,2)="ST"
SET RDF(2,13,3)=30
+28 SET RDF(2,14,1)="Mail/Window"
SET RDF(2,14,2)="ST"
SET RDF(2,14,3)=1
+29 SET RDF(2,15,1)="Division"
SET RDF(2,15,2)="NM"
SET RDF(2,15,3)=3
+30 SET RDF(2,16,1)="Division Name"
SET RDF(2,16,2)="ST"
SET RDF(2,16,3)=20
+31 SET RDF(2,17,1)="MHV Request Status"
SET RDF(2,17,2)="NM"
SET RDF(2,17,3)=3
+32 SET RDF(2,18,1)="MHV Request Status Date"
SET RDF(2,18,2)="TS"
SET RDF(2,18,3)=26
+33 SET RDF(2,19,1)="Remarks"
SET RDF(2,19,2)="ST"
SET RDF(2,19,3)=75
+34 SET RDF(2,20,1)="SIG"
SET RDF(2,20,2)="TX"
SET RDF(2,20,3)=1024
+35 ;
+36 SET CNT=CNT+1
+37 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.RDF,.HL)
+38 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+39 QUIT
+40 ;
RDT(MSGROOT,DATAROOT,CNT,LEN,HL) ; Build RDT segments for Rx Profile data
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with RDT segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ; 3065 : HLNAME^XLFNAME
+8 ;
+9 ; Input:
+10 ; MSGROOT - Root of array holding the message
+11 ; DATAROOT - Root of array to hold extract data
+12 ; CNT - Current message line counter
+13 ; LEN - Current message length
+14 ; HL - HL7 package array variable
+15 ;
+16 ; Output:
+17 ; - Populated message array
+18 ; - Updated LEN and CNT
+19 ;
+20 NEW I,RX,RX0,RXP,RXN,RXD,RDT,SIG,SEG,PIEN,NAME,WPLEN
+21 DO LOG^MHVUL2("MHV7B1B","BEGIN RDT","S","TRACE")
+22 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+23 SET RX=@DATAROOT@(I)
+24 SET RX0=@DATAROOT@(I,0)
+25 SET RXP=@DATAROOT@(I,"P")
+26 SET PIEN=+RXP
+27 SET RXN=@DATAROOT@(I,"RXN")
+28 SET RXD=@DATAROOT@(I,"DIV")
+29 KILL SIG
MERGE SIG=@DATAROOT@(I,"SIG")
+30 SET RDT(0)="RDT"
+31 ;Rx Number
SET RDT(1)=$PIECE(RX,"^")
+32 ;Rx IEN
SET RDT(2)=$PIECE(RXN,"^",9)
+33 ;Drug Name
SET RDT(3)=$$ESCAPE^MHV7U($PIECE(RX,"^",2),.HL)
+34 ;Issue Date/Time
SET RDT(4)=$$FMTHL7^XLFDT($PIECE(RX0,"^",5))
+35 ;Last Fill Date
SET RDT(5)=$$FMTHL7^XLFDT($PIECE(RX0,"^",12))
+36 ;Release Date/Time
SET RDT(6)=$$FMTHL7^XLFDT($PIECE(RXN,"^",2))
+37 ;Expiration/Cancel Date
SET RDT(7)=$$FMTHL7^XLFDT($PIECE(RX0,"^",3))
+38 ;Status
SET RDT(8)=$$ESCAPE^MHV7U($PIECE(RX0,"^",6),.HL)
+39 ;Quantity
SET RDT(9)=$PIECE(RX0,"^",8)
+40 ;Days Supply
SET RDT(10)=$PIECE(RX0,"^",7)
+41 ;Number of Refills
SET RDT(11)=$PIECE(RX0,"^",4)
+42 IF PIEN
Begin DoDot:2
+43 DO FMTNAME2^MHV7BU(PIEN,200,.NAME,.HL,"XCN")
+44 MERGE RDT(12,1)=NAME
+45 ;Provider IEN
SET RDT(12,1,1)=PIEN
+46 QUIT
End DoDot:2
+47 ;Placer Order Number
SET RDT(13)=$$ESCAPE^MHV7U($PIECE(RX0,"^",11),.HL)
+48 ;Mail/Window
SET RDT(14)=$PIECE(RXN,"^",3)
+49 ;Division
SET RDT(15)=$PIECE(RXD,"^")
+50 ;Division Name
SET RDT(16)=$$ESCAPE^MHV7U($PIECE(RXD,"^",2),.HL)
+51 ;MHV status
SET RDT(17)=$PIECE(RX,"^",3)
+52 ;MHV status date
SET RDT(18)=$$FMTHL7^XLFDT($PIECE(RX,"^",4))
+53 ;Remarks
SET RDT(19)=$$ESCAPE^MHV7U($PIECE(RXN,"^",4),.HL)
+54 SET CNT=CNT+1
+55 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.RDT,.HL)
+56 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+57 if 'SIG(0)
QUIT
+58 KILL SEG,WPLEN
+59 DO BLDWP^MHV7U(.SIG,.SEG,1024,0,.WPLEN,.HL)
+60 MERGE @MSGROOT@(CNT)=SEG
+61 SET LEN=LEN+WPLEN
+62 QUIT
End DoDot:1
+63 DO LOG^MHVUL2("MHV7B1B","END RDT","S","TRACE")
+64 QUIT
+65 ;