DGNTUT ;ALB/RPM - Utility functions for N/T Radium Treatments ; 7/16/01 3:04pm
;;5.3;Registration;**397,1015**;Aug 13, 1993;Build 21
Q
;
CHANGE(DGDFN,DGNTN,DGENR) ;Did the answers change?
; Input
; DGDFN - Patients DFN
; DGNTN("HNC") - Head/Neck Cancer Diagnosis "Y,N"
; DGNTN("NTR") - NTR Status code, "Y,N,U"
; DGNTN("AVI") - Aviator code, "Y,N"
; DGNTN("SUB") - Sub Training code, "Y,N"
; DGNTN("VER") - Verification method, "S,M,N"
; DGENR - Enrollment Z11 update [optional default=0]
;
; Output
; Returns 0 if no status change
; 1 if status changed
;
N DGCHG ;change flag
N DGIEN ;IEN of existing NTR record
N DGNTO ;original values from $$GETCUR
N DGX ;generic index
;
I +$G(DGDFN)'>0 Q 0
S DGNTN("HNC")=$G(DGNTN("HNC"))
S DGNTN("NTR")=$G(DGNTN("NTR"))
S DGNTN("AVI")=$G(DGNTN("AVI"))
S DGNTN("SUB")=$G(DGNTN("SUB"))
S DGNTN("VER")=$G(DGNTN("VER"))
S DGENR=+$G(DGENR)
S DGCHG=0
S DGIEN=+$$GETCUR^DGNTAPI(DGDFN,"DGNTO")
I DGIEN>0 D
. ;if this is an Enrollment update don't overlay a "M"ilitary Medical
. ;Record verified record with a "S"ervice Record verified record.
. I DGENR,$P($G(DGNTO("VER")),"^")="M",DGNTN("VER")="S" Q
. F DGX="HNC","NTR","AVI","SUB","VER" D Q:DGCHG
. . I $P($G(DGNTO(DGX)),"^")'=DGNTN(DGX) S DGCHG=1
I DGIEN=0 S DGCHG=1 ;new record
CHNGQ Q DGCHG
;
SITE(DGSITE) ;Convert a station number into a pointer to the
; INSTITUTION file (#4). If called with a null parameter then
; the pointer to the INSTITUTION file (#4) of the primary site
; will be returned.
;
; Input
; DGSITE - Station number (optional)
;
; Output
; Return Site IEN to INSTITUTION file (#4)
;
S DGSITE=$G(DGSITE)
I DGSITE]"",$D(^DIC(4,"D",DGSITE)) D
. S DGSITE=$O(^DIC(4,"D",DGSITE,0))
E D
. S DGSITE=$P($$SITE^VASITE,U)
I +DGSITE'>0 S DGSITE=""
Q DGSITE
;
INTERP(DGINTR) ;Create external status interpretation
;
; Input
; DGINTR - NTR record values array
;
; Output
; DGINTRP - function return
; NO
; YES,PENDING BOTH DOCUMENTATION AND DIAGNOSIS
; YES,PENDING DIAGNOSIS
; YES,VERIFIED
;
N DGINTRP ;interpretation
N DGX ;generic index
N DGINT ;temp array
F DGX="HNC","NTR","VER" S DGINT(DGX)=$P($G(@DGINTR@(DGX)),"^")
S DGINTRP="NO"
I DGINT("NTR")="Y"!(DGINT("NTR")="U") D
. I DGINT("VER")="" D
. . S DGINTRP="YES,PENDING BOTH DOCUMENTATION AND DIAGNOSIS"
. . I DGINT("HNC")="Y" D
. . . S DGINTRP="YES,PENDING DOCUMENTATION"
. I DGINT("VER")="M"!(DGINT("VER")="S") D
. . S DGINTRP="YES,PENDING DIAGNOSIS"
. . I DGINT("HNC")="Y" D
. . . S DGINTRP="YES,VERIFIED"
Q DGINTRP
;
STATUS(DGARR) ;Determine if screening status is complete
; Input
; DGARR - result array of $$GETCUR^DGNTAPI
;
; Output - function result
; 0 - incomplete
; 1 - complete
;
N DGRSLT
N DGST ;temp array
S DGRSLT=0
S DGST("NTR")=$P($G(DGARR("NTR")),"^")
S DGST("HNC")=$P($G(DGARR("HNC")),"^")
S DGST("VER")=$P($G(DGARR("VER")),"^")
I DGST("NTR")="N" S DGRSLT=1
I DGST("NTR")="Y"!(DGST("NTR")="U") D
. S DGRSLT=2
. I ",S,M,"[(","_DGST("VER")_",") D
. . S DGRSLT=3
. . I DGST("HNC")="Y" D
. . . S DGRSLT=$S(DGST("VER")="M":4,1:5)
. I DGST("VER")="N" S DGRSLT=6
Q DGRSLT
DGNTUT ;ALB/RPM - Utility functions for N/T Radium Treatments ; 7/16/01 3:04pm
+1 ;;5.3;Registration;**397,1015**;Aug 13, 1993;Build 21
+2 QUIT
+3 ;
CHANGE(DGDFN,DGNTN,DGENR) ;Did the answers change?
+1 ; Input
+2 ; DGDFN - Patients DFN
+3 ; DGNTN("HNC") - Head/Neck Cancer Diagnosis "Y,N"
+4 ; DGNTN("NTR") - NTR Status code, "Y,N,U"
+5 ; DGNTN("AVI") - Aviator code, "Y,N"
+6 ; DGNTN("SUB") - Sub Training code, "Y,N"
+7 ; DGNTN("VER") - Verification method, "S,M,N"
+8 ; DGENR - Enrollment Z11 update [optional default=0]
+9 ;
+10 ; Output
+11 ; Returns 0 if no status change
+12 ; 1 if status changed
+13 ;
+14 ;change flag
NEW DGCHG
+15 ;IEN of existing NTR record
NEW DGIEN
+16 ;original values from $$GETCUR
NEW DGNTO
+17 ;generic index
NEW DGX
+18 ;
+19 IF +$GET(DGDFN)'>0
QUIT 0
+20 SET DGNTN("HNC")=$GET(DGNTN("HNC"))
+21 SET DGNTN("NTR")=$GET(DGNTN("NTR"))
+22 SET DGNTN("AVI")=$GET(DGNTN("AVI"))
+23 SET DGNTN("SUB")=$GET(DGNTN("SUB"))
+24 SET DGNTN("VER")=$GET(DGNTN("VER"))
+25 SET DGENR=+$GET(DGENR)
+26 SET DGCHG=0
+27 SET DGIEN=+$$GETCUR^DGNTAPI(DGDFN,"DGNTO")
+28 IF DGIEN>0
Begin DoDot:1
+29 ;if this is an Enrollment update don't overlay a "M"ilitary Medical
+30 ;Record verified record with a "S"ervice Record verified record.
+31 IF DGENR
IF $PIECE($GET(DGNTO("VER")),"^")="M"
IF DGNTN("VER")="S"
QUIT
+32 FOR DGX="HNC","NTR","AVI","SUB","VER"
Begin DoDot:2
+33 IF $PIECE($GET(DGNTO(DGX)),"^")'=DGNTN(DGX)
SET DGCHG=1
End DoDot:2
IF DGCHG
QUIT
End DoDot:1
+34 ;new record
IF DGIEN=0
SET DGCHG=1
CHNGQ QUIT DGCHG
+1 ;
SITE(DGSITE) ;Convert a station number into a pointer to the
+1 ; INSTITUTION file (#4). If called with a null parameter then
+2 ; the pointer to the INSTITUTION file (#4) of the primary site
+3 ; will be returned.
+4 ;
+5 ; Input
+6 ; DGSITE - Station number (optional)
+7 ;
+8 ; Output
+9 ; Return Site IEN to INSTITUTION file (#4)
+10 ;
+11 SET DGSITE=$GET(DGSITE)
+12 IF DGSITE]""
IF $DATA(^DIC(4,"D",DGSITE))
Begin DoDot:1
+13 SET DGSITE=$ORDER(^DIC(4,"D",DGSITE,0))
End DoDot:1
+14 IF '$TEST
Begin DoDot:1
+15 SET DGSITE=$PIECE($$SITE^VASITE,U)
End DoDot:1
+16 IF +DGSITE'>0
SET DGSITE=""
+17 QUIT DGSITE
+18 ;
INTERP(DGINTR) ;Create external status interpretation
+1 ;
+2 ; Input
+3 ; DGINTR - NTR record values array
+4 ;
+5 ; Output
+6 ; DGINTRP - function return
+7 ; NO
+8 ; YES,PENDING BOTH DOCUMENTATION AND DIAGNOSIS
+9 ; YES,PENDING DIAGNOSIS
+10 ; YES,VERIFIED
+11 ;
+12 ;interpretation
NEW DGINTRP
+13 ;generic index
NEW DGX
+14 ;temp array
NEW DGINT
+15 FOR DGX="HNC","NTR","VER"
SET DGINT(DGX)=$PIECE($GET(@DGINTR@(DGX)),"^")
+16 SET DGINTRP="NO"
+17 IF DGINT("NTR")="Y"!(DGINT("NTR")="U")
Begin DoDot:1
+18 IF DGINT("VER")=""
Begin DoDot:2
+19 SET DGINTRP="YES,PENDING BOTH DOCUMENTATION AND DIAGNOSIS"
+20 IF DGINT("HNC")="Y"
Begin DoDot:3
+21 SET DGINTRP="YES,PENDING DOCUMENTATION"
End DoDot:3
End DoDot:2
+22 IF DGINT("VER")="M"!(DGINT("VER")="S")
Begin DoDot:2
+23 SET DGINTRP="YES,PENDING DIAGNOSIS"
+24 IF DGINT("HNC")="Y"
Begin DoDot:3
+25 SET DGINTRP="YES,VERIFIED"
End DoDot:3
End DoDot:2
End DoDot:1
+26 QUIT DGINTRP
+27 ;
STATUS(DGARR) ;Determine if screening status is complete
+1 ; Input
+2 ; DGARR - result array of $$GETCUR^DGNTAPI
+3 ;
+4 ; Output - function result
+5 ; 0 - incomplete
+6 ; 1 - complete
+7 ;
+8 NEW DGRSLT
+9 ;temp array
NEW DGST
+10 SET DGRSLT=0
+11 SET DGST("NTR")=$PIECE($GET(DGARR("NTR")),"^")
+12 SET DGST("HNC")=$PIECE($GET(DGARR("HNC")),"^")
+13 SET DGST("VER")=$PIECE($GET(DGARR("VER")),"^")
+14 IF DGST("NTR")="N"
SET DGRSLT=1
+15 IF DGST("NTR")="Y"!(DGST("NTR")="U")
Begin DoDot:1
+16 SET DGRSLT=2
+17 IF ",S,M,"[(","_DGST("VER")_",")
Begin DoDot:2
+18 SET DGRSLT=3
+19 IF DGST("HNC")="Y"
Begin DoDot:3
+20 SET DGRSLT=$SELECT(DGST("VER")="M":4,1:5)
End DoDot:3
End DoDot:2
+21 IF DGST("VER")="N"
SET DGRSLT=6
End DoDot:1
+22 QUIT DGRSLT