MHV7B9A ;WAS/DLF/KUM - HL7 message builder secure messaging ; 9/25/08 4:08pm
;;1.0;My HealtheVet;**6,10,29**;July 10, 2017;Build 73
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
PTREL(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG, STF, and AIP segments
D ORG(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
S DATAROOT=$P(DATAROOT,",",1,3)
S DATAROOT=$TR(DATAROOT,")","")_","_"""PROVIDERS"""_")"
D STF(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
D AIP(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
Q
PID(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build PID segments for user data
;
; Walks data in DATAROOT to populate MSGROOT with PID segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
;
; 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,USR,PID,NMARR,PNAME
D LOG^MHVUL2("MHV7B9A","BEGIN PID","S","TRACE")
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S PID(0)="PID"
. ; IEN+ICN+SSN
. S PID(3,1,1)=$P(USR,"^")
. S PID(3,2,1)=$P(USR,"^",4)
. S PID(3,3,1)=$P(USR,"^",5)
. S PNAME=$P(USR,"^",3)
. D FMTNAME^MHV7BU(PNAME,.NMARR,.HL,"XPN")
. S PID(5,1,1)=NMARR(1)
. S PID(5,1,2)=NMARR(2)
. S PID(5,1,3)=NMARR(3) ;Name in HL7 Format
. D LOG^MHVUL2("MHV7B9A",PNAME,"S","TRACE")
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.PID,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END PID","S","TRACE")
Q
STF(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build STF segments for provider data
;
; Walks data in DATAROOT to populate MSGROOT with STF segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
;
; 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,USR,STF,NMARR,PNAME
N J,DIV,DIVS
D LOG^MHVUL2("MHV7B9A","BEGIN STF","S","TRACE")
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S STF(0)="STF"
. S STF(2)=$P(USR,"^",1) ;IEN
. S PNAME=$P(USR,"^",2) ;Provider name
. ;JAZZ#409966-Fix Names with Space in SM queries;and more User Fields
. ;D FMTNAME^MHV7BU(PNAME,.NMARR,.HL,"XPN")- CHANGE THE CALL TO the HL7 formatting API
. D FMTNAME3^MHV7BU(STF(2),200,.NMARR,.HL,"XPN")
. ;-----------------------------------------------------------------------------------
. ;USR=USRIEN_U_USRNAME_U_PRV_U_PRVCLS_U_PROVSPEC_U_REQSIG_U_PPHONE_U_SSECTION_U_TTITLE
. ;
. ; (1) (2) (3) (4) (5) (6) (7) (8) (9)
. ;_U_NETWKID PERSCLS_U_PCEFDT_U_PCEXDT_U_PROVDIVS*
. ; (10) (11) (12) (13) (14) . ; * Multiples;
. ;-----------------------------------------------------------------------------------
. S STF(3,1,1)=$G(NMARR(1)) ;Last (Family)Name in HL7 Format
. S STF(3,1,2)=$G(NMARR(2)) ;Given(First)Name in HL7 Format
. S STF(3,1,3)=$G(NMARR(3)) ;Middle Name in HL7 Format
. S STF(3,1,4)=$G(NMARR(4)) ;Name Suffix in HL7 Format - ;JAZZ#409966
. S STF(3,1,5)=$G(NMARR(5)) ;Name Prefix in HL7 Format - ;JAZZ#409966
. S STF(3,1,6)=$G(NMARR(6)) ;Degree in HL7 Format - ;JAZZ#409966
. S STF(3,1,9,4)=$P(USR,"^",10) ;NETWKID - StaffName.namecontext.alternateidentifie;JAZZ#409966
. S STF(4,1)=$P(USR,"^",3) ;Staff type 1 -IF PROVIDER KEY exists='PROVIDER'-JAZZ#409966
. S STF(4,3)=$P(USR,"^",6) ;Staff type 3 -REQSIG-JAZZ#409966
. S STF(7)=+$$ACTIVE^XUSER($P(USR,"^",1)) ;Active/Inactive Flag-(lb)-JAZZ#409966
. ;S STF(8)=$P(USR,"^",8) ;Section/Department
. S STF(8,1)=$P(USR,"^",8) ;Section/Department-use 1st piece -JAZZ#409966
. S STF(8,2)=$P(USR,"^",5) ;Staff type 2-PROVSPEC -JAZZ#409966
. S STF(8,5)=$P(USR,"^",11) ;JobClass- PERSCLS-Current active- JAZZ#409966
. S DIV="",DIVS=$P(USR,"^",14) ;DIVISIONS -JAZZ#409966
. I $G(DIVS)'="" F J=1:1 Q:$P(DIVS,"_",J)="" D
. . S STF(9,J,2)=$P($P(DIVS,"_",J),"~",1) ;HospitalService - DIVISONS
. . S STF(9,J,5)=$P($P(DIVS,"_",J),"~",2) ;HospitalService - DIVISONS-Default=yes/no/null
. S STF(10)=$P(USR,"^",7) ;Office Phone
. S STF(12)="",STF(13)=""
. ;InstitutionActivationDate -PCEFDT
. I +($P(USR,"^",12))>0 S STF(12)=$$FMTHL7^MHV7BU($P(USR,"^",12))
. ;InstitutionInactivationDate -PCEXDT
. I +($P(USR,"^",13))>0 S STF(13)=$$FMTHL7^MHV7BU($P(USR,"^",13))
. S STF(18)=$P(USR,"^",9) ;Job Title -JAZZ#409966
. S STF(20,2)=$P(USR,"^",4) ;EmploymentStatusCode -PRVCLS-JAZZ#409966
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.STF,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END STF","S","TRACE")
Q
AIP(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build AIP segments for team
;
; Walks data in DATAROOT to populate MSGROOT with AIP segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
;
; 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,USR,AIP
S DATAROOT=$P(DATAROOT,",",1,3)
S DATAROOT=$TR(DATAROOT,")","")_","_"""TEAMS"""_")"
D LOG^MHVUL2("MHV7B9A","BEGIN AIP","S","TRACE")
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S AIP(0)="AIP"
. S AIP(3)=$P(USR,"^",1) ;IEN
. S AIP(5)=$$ESCAPE^MHV7U($P(USR,"^",2),.HL) ;TEAM NAME
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.AIP,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END AIP","S","TRACE")
Q
ORG(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG segments for clinics
;
; Walks data in DATAROOT to populate MSGROOT with ORG segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
;
; 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,USR,ORG
D LOG^MHVUL2("MHV7B9A","BEGIN ORG","S","TRACE")
S DATAROOT=$P(DATAROOT,",",1,3)
S DATAROOT=$TR(DATAROOT,")","")_","_"""CLINICS"""_")"
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S ORG(0)="ORG"
. S ORG(2,1,1)=$P(USR,"^",1)
. S ORG(2,1,2)=$$ESCAPE^MHV7U($P(USR,"^",2),.HL)
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.ORG,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END ORG","S","TRACE")
Q
SMORG(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG segments for clinics
;
; Walks data in DATAROOT to populate MSGROOT with ORG segments
; sequentially numbered starting at CNT
;
; 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,USR,ORG
D LOG^MHVUL2("MHV7B9A","BEGIN ORG","S","TRACE")
S DATAROOT=$P(DATAROOT,",",1,3)
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S ORG(0)="ORG"
. S ORG(2,1,1)=$P(USR,"^",1)
. S ORG(2,1,2)=$$ESCAPE^MHV7U($P(USR,"^",2),.HL)
. I $P($G(USR),"^",3)'="" S ORG(3,1,1)=$$ESCAPE^MHV7U($P(USR,"^",3),.HL)
. I $P($G(USR),"^",4)'="" S ORG(3,1,2)=$$ESCAPE^MHV7U($P(USR,"^",4),.HL)
. I $P($G(USR),"^",5)'="" S ORG(3,1,5)=$$ESCAPE^MHV7U($P(USR,"^",5),.HL)
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.ORG,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END ORG","S","TRACE")
Q
PRA(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build PRA segments for providers
;
; Walks data in DATAROOT to populate MSGROOT with PRA segments
; sequentially numbered starting at CNT
;
; Integration Agreements:
; 10103 : FMTHL7^XLFDT
;
; 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,USR,PRA
D LOG^MHVUL2("MHV7B9A","BEGIN PRA","S","TRACE")
S DATAROOT=$P(DATAROOT,",",1,3)
S DATAROOT=$TR(DATAROOT,")","")_","_"""PROVIDERS"""_")"
F I=1:1 Q:'$D(@DATAROOT@(I)) D
. S USR=@DATAROOT@(I)
. S PRA(0)="PRA"
. S PRA(2,1,1)=$P(USR,"^",1) ;IEN
. S PRA(2,1,2)=$P(USR,"^",2) ;NAME
. S CNT=CNT+1
. S @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.PRA,.HL)
. S LEN=LEN+$L(@MSGROOT@(CNT))
. Q
D LOG^MHVUL2("MHV7B9A","END PRA","S","TRACE")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV7B9A 9460 printed Oct 16, 2024@18:16:34 Page 2
MHV7B9A ;WAS/DLF/KUM - HL7 message builder secure messaging ; 9/25/08 4:08pm
+1 ;;1.0;My HealtheVet;**6,10,29**;July 10, 2017;Build 73
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
PTREL(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG, STF, and AIP segments
+1 DO ORG(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
+2 SET DATAROOT=$PIECE(DATAROOT,",",1,3)
+3 SET DATAROOT=$TRANSLATE(DATAROOT,")","")_","_"""PROVIDERS"""_")"
+4 DO STF(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
+5 DO AIP(MSGROOT,DATAROOT,.CNT,.LEN,.HL)
+6 QUIT
PID(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build PID segments for user data
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with PID segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ;
+8 ; Input:
+9 ; MSGROOT - Root of array holding the message
+10 ; DATAROOT - Root of array to hold extract data
+11 ; CNT - Current message line counter
+12 ; LEN - Current message length
+13 ; HL - HL7 package array variable
+14 ;
+15 ; Output:
+16 ; - Populated message array
+17 ; - Updated LEN and CNT
+18 ;
+19 NEW I,USR,PID,NMARR,PNAME
+20 DO LOG^MHVUL2("MHV7B9A","BEGIN PID","S","TRACE")
+21 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+22 SET USR=@DATAROOT@(I)
+23 SET PID(0)="PID"
+24 ; IEN+ICN+SSN
+25 SET PID(3,1,1)=$PIECE(USR,"^")
+26 SET PID(3,2,1)=$PIECE(USR,"^",4)
+27 SET PID(3,3,1)=$PIECE(USR,"^",5)
+28 SET PNAME=$PIECE(USR,"^",3)
+29 DO FMTNAME^MHV7BU(PNAME,.NMARR,.HL,"XPN")
+30 SET PID(5,1,1)=NMARR(1)
+31 SET PID(5,1,2)=NMARR(2)
+32 ;Name in HL7 Format
SET PID(5,1,3)=NMARR(3)
+33 DO LOG^MHVUL2("MHV7B9A",PNAME,"S","TRACE")
+34 SET CNT=CNT+1
+35 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.PID,.HL)
+36 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+37 QUIT
End DoDot:1
+38 DO LOG^MHVUL2("MHV7B9A","END PID","S","TRACE")
+39 QUIT
STF(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build STF segments for provider data
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with STF segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ;
+8 ; Input:
+9 ; MSGROOT - Root of array holding the message
+10 ; DATAROOT - Root of array to hold extract data
+11 ; CNT - Current message line counter
+12 ; LEN - Current message length
+13 ; HL - HL7 package array variable
+14 ;
+15 ; Output:
+16 ; - Populated message array
+17 ; - Updated LEN and CNT
+18 ;
+19 NEW I,USR,STF,NMARR,PNAME
+20 NEW J,DIV,DIVS
+21 DO LOG^MHVUL2("MHV7B9A","BEGIN STF","S","TRACE")
+22 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+23 SET USR=@DATAROOT@(I)
+24 SET STF(0)="STF"
+25 ;IEN
SET STF(2)=$PIECE(USR,"^",1)
+26 ;Provider name
SET PNAME=$PIECE(USR,"^",2)
+27 ;JAZZ#409966-Fix Names with Space in SM queries;and more User Fields
+28 ;D FMTNAME^MHV7BU(PNAME,.NMARR,.HL,"XPN")- CHANGE THE CALL TO the HL7 formatting API
+29 DO FMTNAME3^MHV7BU(STF(2),200,.NMARR,.HL,"XPN")
+30 ;-----------------------------------------------------------------------------------
+31 ;USR=USRIEN_U_USRNAME_U_PRV_U_PRVCLS_U_PROVSPEC_U_REQSIG_U_PPHONE_U_SSECTION_U_TTITLE
+32 ;
+33 ; (1) (2) (3) (4) (5) (6) (7) (8) (9)
+34 ;_U_NETWKID PERSCLS_U_PCEFDT_U_PCEXDT_U_PROVDIVS*
+35 ; (10) (11) (12) (13) (14) . ; * Multiples;
+36 ;-----------------------------------------------------------------------------------
+37 ;Last (Family)Name in HL7 Format
SET STF(3,1,1)=$GET(NMARR(1))
+38 ;Given(First)Name in HL7 Format
SET STF(3,1,2)=$GET(NMARR(2))
+39 ;Middle Name in HL7 Format
SET STF(3,1,3)=$GET(NMARR(3))
+40 ;Name Suffix in HL7 Format - ;JAZZ#409966
SET STF(3,1,4)=$GET(NMARR(4))
+41 ;Name Prefix in HL7 Format - ;JAZZ#409966
SET STF(3,1,5)=$GET(NMARR(5))
+42 ;Degree in HL7 Format - ;JAZZ#409966
SET STF(3,1,6)=$GET(NMARR(6))
+43 ;NETWKID - StaffName.namecontext.alternateidentifie;JAZZ#409966
SET STF(3,1,9,4)=$PIECE(USR,"^",10)
+44 ;Staff type 1 -IF PROVIDER KEY exists='PROVIDER'-JAZZ#409966
SET STF(4,1)=$PIECE(USR,"^",3)
+45 ;Staff type 3 -REQSIG-JAZZ#409966
SET STF(4,3)=$PIECE(USR,"^",6)
+46 ;Active/Inactive Flag-(lb)-JAZZ#409966
SET STF(7)=+$$ACTIVE^XUSER($PIECE(USR,"^",1))
+47 ;S STF(8)=$P(USR,"^",8) ;Section/Department
+48 ;Section/Department-use 1st piece -JAZZ#409966
SET STF(8,1)=$PIECE(USR,"^",8)
+49 ;Staff type 2-PROVSPEC -JAZZ#409966
SET STF(8,2)=$PIECE(USR,"^",5)
+50 ;JobClass- PERSCLS-Current active- JAZZ#409966
SET STF(8,5)=$PIECE(USR,"^",11)
+51 ;DIVISIONS -JAZZ#409966
SET DIV=""
SET DIVS=$PIECE(USR,"^",14)
+52 IF $GET(DIVS)'=""
FOR J=1:1
if $PIECE(DIVS,"_",J)=""
QUIT
Begin DoDot:2
+53 ;HospitalService - DIVISONS
SET STF(9,J,2)=$PIECE($PIECE(DIVS,"_",J),"~",1)
+54 ;HospitalService - DIVISONS-Default=yes/no/null
SET STF(9,J,5)=$PIECE($PIECE(DIVS,"_",J),"~",2)
End DoDot:2
+55 ;Office Phone
SET STF(10)=$PIECE(USR,"^",7)
+56 SET STF(12)=""
SET STF(13)=""
+57 ;InstitutionActivationDate -PCEFDT
+58 IF +($PIECE(USR,"^",12))>0
SET STF(12)=$$FMTHL7^MHV7BU($PIECE(USR,"^",12))
+59 ;InstitutionInactivationDate -PCEXDT
+60 IF +($PIECE(USR,"^",13))>0
SET STF(13)=$$FMTHL7^MHV7BU($PIECE(USR,"^",13))
+61 ;Job Title -JAZZ#409966
SET STF(18)=$PIECE(USR,"^",9)
+62 ;EmploymentStatusCode -PRVCLS-JAZZ#409966
SET STF(20,2)=$PIECE(USR,"^",4)
+63 SET CNT=CNT+1
+64 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.STF,.HL)
+65 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+66 QUIT
End DoDot:1
+67 DO LOG^MHVUL2("MHV7B9A","END STF","S","TRACE")
+68 QUIT
AIP(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build AIP segments for team
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with AIP segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ;
+8 ; Input:
+9 ; MSGROOT - Root of array holding the message
+10 ; DATAROOT - Root of array to hold extract data
+11 ; CNT - Current message line counter
+12 ; LEN - Current message length
+13 ; HL - HL7 package array variable
+14 ;
+15 ; Output:
+16 ; - Populated message array
+17 ; - Updated LEN and CNT
+18 ;
+19 NEW I,USR,AIP
+20 SET DATAROOT=$PIECE(DATAROOT,",",1,3)
+21 SET DATAROOT=$TRANSLATE(DATAROOT,")","")_","_"""TEAMS"""_")"
+22 DO LOG^MHVUL2("MHV7B9A","BEGIN AIP","S","TRACE")
+23 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+24 SET USR=@DATAROOT@(I)
+25 SET AIP(0)="AIP"
+26 ;IEN
SET AIP(3)=$PIECE(USR,"^",1)
+27 ;TEAM NAME
SET AIP(5)=$$ESCAPE^MHV7U($PIECE(USR,"^",2),.HL)
+28 SET CNT=CNT+1
+29 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.AIP,.HL)
+30 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+31 QUIT
End DoDot:1
+32 DO LOG^MHVUL2("MHV7B9A","END AIP","S","TRACE")
+33 QUIT
ORG(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG segments for clinics
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with ORG segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ;
+8 ; Input:
+9 ; MSGROOT - Root of array holding the message
+10 ; DATAROOT - Root of array to hold extract data
+11 ; CNT - Current message line counter
+12 ; LEN - Current message length
+13 ; HL - HL7 package array variable
+14 ;
+15 ; Output:
+16 ; - Populated message array
+17 ; - Updated LEN and CNT
+18 ;
+19 NEW I,USR,ORG
+20 DO LOG^MHVUL2("MHV7B9A","BEGIN ORG","S","TRACE")
+21 SET DATAROOT=$PIECE(DATAROOT,",",1,3)
+22 SET DATAROOT=$TRANSLATE(DATAROOT,")","")_","_"""CLINICS"""_")"
+23 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+24 SET USR=@DATAROOT@(I)
+25 SET ORG(0)="ORG"
+26 SET ORG(2,1,1)=$PIECE(USR,"^",1)
+27 SET ORG(2,1,2)=$$ESCAPE^MHV7U($PIECE(USR,"^",2),.HL)
+28 SET CNT=CNT+1
+29 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.ORG,.HL)
+30 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+31 QUIT
End DoDot:1
+32 DO LOG^MHVUL2("MHV7B9A","END ORG","S","TRACE")
+33 QUIT
SMORG(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build ORG segments for clinics
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with ORG segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Input:
+6 ; MSGROOT - Root of array holding the message
+7 ; DATAROOT - Root of array to hold extract data
+8 ; CNT - Current message line counter
+9 ; LEN - Current message length
+10 ; HL - HL7 package array variable
+11 ;
+12 ; Output:
+13 ; - Populated message array
+14 ; - Updated LEN and CNT
+15 ;
+16 NEW I,USR,ORG
+17 DO LOG^MHVUL2("MHV7B9A","BEGIN ORG","S","TRACE")
+18 SET DATAROOT=$PIECE(DATAROOT,",",1,3)
+19 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+20 SET USR=@DATAROOT@(I)
+21 SET ORG(0)="ORG"
+22 SET ORG(2,1,1)=$PIECE(USR,"^",1)
+23 SET ORG(2,1,2)=$$ESCAPE^MHV7U($PIECE(USR,"^",2),.HL)
+24 IF $PIECE($GET(USR),"^",3)'=""
SET ORG(3,1,1)=$$ESCAPE^MHV7U($PIECE(USR,"^",3),.HL)
+25 IF $PIECE($GET(USR),"^",4)'=""
SET ORG(3,1,2)=$$ESCAPE^MHV7U($PIECE(USR,"^",4),.HL)
+26 IF $PIECE($GET(USR),"^",5)'=""
SET ORG(3,1,5)=$$ESCAPE^MHV7U($PIECE(USR,"^",5),.HL)
+27 SET CNT=CNT+1
+28 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.ORG,.HL)
+29 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+30 QUIT
End DoDot:1
+31 DO LOG^MHVUL2("MHV7B9A","END ORG","S","TRACE")
+32 QUIT
PRA(MSGROOT,DATAROOT,CNT,LEN,HL) ;Build PRA segments for providers
+1 ;
+2 ; Walks data in DATAROOT to populate MSGROOT with PRA segments
+3 ; sequentially numbered starting at CNT
+4 ;
+5 ; Integration Agreements:
+6 ; 10103 : FMTHL7^XLFDT
+7 ;
+8 ; Input:
+9 ; MSGROOT - Root of array holding the message
+10 ; DATAROOT - Root of array to hold extract data
+11 ; CNT - Current message line counter
+12 ; LEN - Current message length
+13 ; HL - HL7 package array variable
+14 ;
+15 ; Output:
+16 ; - Populated message array
+17 ; - Updated LEN and CNT
+18 ;
+19 NEW I,USR,PRA
+20 DO LOG^MHVUL2("MHV7B9A","BEGIN PRA","S","TRACE")
+21 SET DATAROOT=$PIECE(DATAROOT,",",1,3)
+22 SET DATAROOT=$TRANSLATE(DATAROOT,")","")_","_"""PROVIDERS"""_")"
+23 FOR I=1:1
if '$DATA(@DATAROOT@(I))
QUIT
Begin DoDot:1
+24 SET USR=@DATAROOT@(I)
+25 SET PRA(0)="PRA"
+26 ;IEN
SET PRA(2,1,1)=$PIECE(USR,"^",1)
+27 ;NAME
SET PRA(2,1,2)=$PIECE(USR,"^",2)
+28 SET CNT=CNT+1
+29 SET @MSGROOT@(CNT)=$$BLDSEG^MHV7U(.PRA,.HL)
+30 SET LEN=LEN+$LENGTH(@MSGROOT@(CNT))
+31 QUIT
End DoDot:1
+32 DO LOG^MHVUL2("MHV7B9A","END PRA","S","TRACE")
+33 QUIT