DGQEHLNT ;ALB/RPM - VIC REPLACEMENT HL7 BUILD NTE SEGMENT ; 10/20/05
;;5.3;Registration;**679,1015**;Aug 13, 1993;Build 21
;
Q
;
NTE(DGREQ,DGFLD,DGHL) ;NTE Segment API
;This function wraps the data retrieval and segment creation APIs and
;returns a formatted NTE segment.
;
; Input:
; DGREQ - (required) VIC REQUEST data array
; DGFLD - (optional) List of comma-separated fields (sequence #'s)
; to include. Defaults to all required fields (4).
; DGHL - HL7 environment array
;
; Output:
; Function Value - NTE segment on success, "" on failure
;
N DGNTE
N DGVAL
;
S DGNTE=""
I $D(DGREQ) D
. S DGFLD=","_DGFLD_","
. I $$NTEVAL(DGFLD,.DGREQ,.DGVAL) D
. . S DGNTE=$$BLDSEG^DGQEHLUT("NTE",.DGVAL,.DGHL)
Q DGNTE
;
NTEVAL(DGFLD,DGREQ,DGVAL) ;build NTE value array
;
; Input:
; DGFLD - (required) Fields string
; DGREQ - (required) VIC REQUEST data array
;
; Output:
; Function Value - 1 on sucess, 0 on failure
; DGVAL - NTE field array [SUB1:field, SUB2:repetition,
; SUB3:component, SUB4:sub-component]
;
N DGRSLT ;function value
;
S DGRSLT=0
I $G(DGFLD)]"",+$G(DGREQ("DFN"))>0 D
. ;
. ; seq 1 Set ID
. I DGFLD[",1," D
. ;
. ; seq 2 Source of comment
. I DGFLD[",2," D
. ;
. ; seq 3 Comment
. I DGFLD[",3," D
. . N DGENRST ;enrollment status
. . S DGENRST=$$STATUS^DGENA(DGREQ("DFN"))
. . S DGVAL(3,1)="POW:"_$S($$ISENRPND^DGQEUT1(DGENRST):"P",1:$$GETPOW^DGQEUT1(DGREQ("DFN")))
. . S DGVAL(3,2)="PH:"_$$GETPH^DGQEUT1(DGREQ("DFN"))
. ;
. ; seq 4 Comment type
. I DGFLD[",4," D
. ;
. S DGRSLT=1
I 'DGRSLT K DGVAL
Q DGRSLT
DGQEHLNT ;ALB/RPM - VIC REPLACEMENT HL7 BUILD NTE SEGMENT ; 10/20/05
+1 ;;5.3;Registration;**679,1015**;Aug 13, 1993;Build 21
+2 ;
+3 QUIT
+4 ;
NTE(DGREQ,DGFLD,DGHL) ;NTE Segment API
+1 ;This function wraps the data retrieval and segment creation APIs and
+2 ;returns a formatted NTE segment.
+3 ;
+4 ; Input:
+5 ; DGREQ - (required) VIC REQUEST data array
+6 ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
+7 ; to include. Defaults to all required fields (4).
+8 ; DGHL - HL7 environment array
+9 ;
+10 ; Output:
+11 ; Function Value - NTE segment on success, "" on failure
+12 ;
+13 NEW DGNTE
+14 NEW DGVAL
+15 ;
+16 SET DGNTE=""
+17 IF $DATA(DGREQ)
Begin DoDot:1
+18 SET DGFLD=","_DGFLD_","
+19 IF $$NTEVAL(DGFLD,.DGREQ,.DGVAL)
Begin DoDot:2
+20 SET DGNTE=$$BLDSEG^DGQEHLUT("NTE",.DGVAL,.DGHL)
End DoDot:2
End DoDot:1
+21 QUIT DGNTE
+22 ;
NTEVAL(DGFLD,DGREQ,DGVAL) ;build NTE value array
+1 ;
+2 ; Input:
+3 ; DGFLD - (required) Fields string
+4 ; DGREQ - (required) VIC REQUEST data array
+5 ;
+6 ; Output:
+7 ; Function Value - 1 on sucess, 0 on failure
+8 ; DGVAL - NTE field array [SUB1:field, SUB2:repetition,
+9 ; SUB3:component, SUB4:sub-component]
+10 ;
+11 ;function value
NEW DGRSLT
+12 ;
+13 SET DGRSLT=0
+14 IF $GET(DGFLD)]""
IF +$GET(DGREQ("DFN"))>0
Begin DoDot:1
+15 ;
+16 ; seq 1 Set ID
+17 IF DGFLD[",1,"
Begin DoDot:2
End DoDot:2
+18 ;
+19 ; seq 2 Source of comment
+20 IF DGFLD[",2,"
Begin DoDot:2
End DoDot:2
+21 ;
+22 ; seq 3 Comment
+23 IF DGFLD[",3,"
Begin DoDot:2
+24 ;enrollment status
NEW DGENRST
+25 SET DGENRST=$$STATUS^DGENA(DGREQ("DFN"))
+26 SET DGVAL(3,1)="POW:"_$SELECT($$ISENRPND^DGQEUT1(DGENRST):"P",1:$$GETPOW^DGQEUT1(DGREQ("DFN")))
+27 SET DGVAL(3,2)="PH:"_$$GETPH^DGQEUT1(DGREQ("DFN"))
End DoDot:2
+28 ;
+29 ; seq 4 Comment type
+30 IF DGFLD[",4,"
Begin DoDot:2
End DoDot:2
+31 ;
+32 SET DGRSLT=1
End DoDot:1
+33 IF 'DGRSLT
KILL DGVAL
+34 QUIT DGRSLT