DGNTAPI1 ;ALB/RPM - API's for N/T Radium Treatment(part 2); 7/16/01 3:04pm
;;5.3;Registration;**397,423**;Aug 13, 1993
Q
;
ENRUPD(DGDFN,DGHEC) ;
;This function is the entry point for HEC/Enrollment data updates
;via the Enrollment HL7 message upload.
;
; Input:
; DGDFN - PATIENT file (#2) IEN
; DGHEC - update values array passed by reference
; DGHEC("NTR") - Nose/Throat Radium
; DGHEC("AVI") - Aviator?
; DGHEC("SUB") - Submariner
; DGHEC("VER") - Verification method
; DGHEC("VDT") - Verification completion date/time
; DGHEC("VSIT") - Verification site
; DGHEC("HNC") - Head/Neck CA DX
; DGHEC("HDT") - Head/Neck CA date/time
; DGHEC("HSIT") - Site determining CA DX
;
; Output:
; function result 1-success, 0-failure
;
N DGRSLT
N DGX ;generic index
S DGRSLT=0
S DGDFN=+$G(DGDFN)
F DGX="NTR","AVI","SUB","VER","VDT","VSIT","HNC","HDT","HSIT" D
. S DGHEC(DGX)=$G(DGHEC(DGX))
I DGDFN>0,$D(^DPT(DGDFN)),DGHEC("NTR")]"",DGHEC("VDT")]"",$$CHANGE^DGNTUT(DGDFN,.DGHEC,1) D
. S DGHEC("EUSR")=DUZ
. S DGHEC("EDT")=$$NOW^XLFDT
. S DGRSLT=$$FILENTR^DGNTAPI(DGDFN,.DGHEC,0)
Q DGRSLT
;
ENRGET(DGDFN,DGENR) ;Entry point for Enrollment data retrieval from
;NOSE AND THROAT RADIUM HISTORY file (#28.11).
;
; Input:
; DGDFN - IEN of patient in the PATIENT (#2) file
; DGENR - Array name of return values [Optional - Default DGNTARR]
;
; Output:
; function result - 1-complete record found, 0-incomplete record
; DGENR - Array of current NTR HISTORY file record field values.
; See $$GETREC^DGNTAPI for array specifications.
;
N DGIEN
N DGRSLT
N DGX
;
I '$G(DGDFN) Q 0
;
S DGENR=$G(DGENR)
I DGENR']"" S DGENR="DGNTARR"
;
S DGRSLT=0
S DGIEN=+$$GETPRIM^DGNTAPI(DGDFN)
I ($$GETREC^DGNTAPI(DGIEN,DGENR)&($G(@DGENR@("VDT"))]"")) D
. S DGRSLT=1
. ;return only internal values
. F DGX="IND","STAT","NTR","AVI","SUB","VER","HNC" D
. . S @DGENR@(DGX)=$P(@DGENR@(DGX),"^")
Q DGRSLT
;
GETSTAT(DGDFN) ;get the screening status
;
; Input:
; DGDFN - IEN of patient in the PATIENT (#2) file
;
; Output:
; function result - internal value of SCREENING STATUS field (#.03)
;
N DGNT
I +$G(DGDFN)>0,+$$GETCUR^DGNTAPI(DGDFN,"DGNT")
Q (+$G(DGNT("STAT")))
;
FILEHNC(DGDFN) ;entry point for applications that need to complete the
;Head/Neck diagnosis question. Only file an entry if the Screening
;Status is "3" - Pending Diagnosis.
;This API is supported by DBIA #3456
;
; Input:
; DGDFN - IEN of patient in the PATIENT (#2) file
;
; Output:
; function result - "0"-nothing filed, "1"-success
;
N DGNT,DGRSLT
S DGRSLT=0
I +$G(DGDFN)>0,+$$GETCUR^DGNTAPI(DGDFN,"DGNT"),+$G(DGNT("STAT"))=3 D
. S DGNT("HNC")="Y"
. S DGNT("HDT")=$$NOW^XLFDT
. S DGNT("HUSR")=DUZ
. S DGNT("HSIT")=$$SITE^DGNTUT
. S DGRSLT=$$FILENTR^DGNTAPI(DGDFN,.DGNT,1)
Q DGRSLT
;
VALID(DGIP,DGERR) ;Validate input parameters before filing
; Input
; DGIP - array of input parameters to validate passed by reference
; DGERR - error parameter passed by reference
;
; Output
; function output - 0:invalid, 1:valid
; DGERR - error message
;
N DGVLD ;function return value
N DGFXR ;node name to field xref array
N DGREQ ;array of required parameters
N DGN ;array node name
N DGFILE ;file number
;
S DGVLD=1
S DGN=""
S DGFILE=28.11
;build field/node xref and required fields array
D BLDARR(.DGFXR,.DGREQ)
;
D ;first invalid condition will exit block structure
. ;check for required parameters
. F S DGN=$O(DGREQ(DGN)) Q:DGN="" I $G(DGIP(DGN))']"" D Q
. . S DGVLD=0,DGERR=$$GET1^DID(DGFILE,DGFXR(DGN),,"LABEL")_" REQUIRED"
. ;quit if any missing required parameters
. Q:'DGVLD
. ;check value validity
. F S DGN=$O(DGIP(DGN)) Q:DGN="" I $D(DGFXR(DGN)),'$$TESTVAL(DGFILE,DGFXR(DGN),$P(DGIP(DGN),U)) D Q
. . S DGVLD=0,DGERR=$$GET1^DID(DGFILE,DGFXR(DGN),,"LABEL")_" NOT VALID"
Q DGVLD
;
BLDARR(DGFLDA,DGREQA) ;Read in $T(XREF) lines and build name/field xref
;array and required fields array.
; Input
; DGFLDA - array name passed by reference
; DGREQA - array name of required fields passed by reference
;
; Output
; DGFLDA - field array node xref
; DGREQA - required fields array
;
N DGOFF ;offset value used with $T
N DGLINE ;line retrieved by $T(XREF+offset)
;
F DGOFF=1:1 S DGLINE=$T(XREF+DGOFF) Q:DGLINE="" D
. S DGFLDA($P(DGLINE,";",3))=$P(DGLINE,";",4)
. I +$P(DGLINE,";",5) S DGREQA($P(DGLINE,";",3))=""
Q
;
TESTVAL(DGFIL,DGFLD,DGVAL) ;Used to determine if a field value is valid
;
; Input
; DGFIL - file number
; DGFLD - field number
; DGVAL - field value to be validated
;
; Output
; Function value: 1:field value is valid, 0:field value is invalid
;
N DGVALEX ;external value after conversion
N DGRSLT ;result of CHK^DIE
N VALID ;function result
;
S VALID=1
I DGVAL'="" D
. S DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
. I DGVALEX="" S VALID=0 Q
. ;
. I $$GET1^DID(DGFIL,DGFLD,"","TYPE")'="POINTER" D
. . D CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT) I DGRSLT="^" S VALID=0 Q
Q VALID
;
XREF ;;array node name;field#;required param;description
;;DFN;.01;1;patient IEN
;;NTR;.04;1;NTR exposure code
;;AVI;.05;0;Military Aviator prior to 1/31/55
;;SUB;.06;0;Submarine Training prior to 1/1/65
;;EDT;.07;0;Date/Time entered
;;EUSR;.08;0;Entered by
;;VER;1.01;0;verification method
;;VDT;1.02;0;Date/Time verified
;;VUSR;1.03;0;verified by
;;VSIT;1.04;0;Site verifying Documentation
;;HNC;2.01;0;Head/Neck Cancer DX
;;HDT;2.02;0;Date/Time diagnosis verified
;;HUSR;2.03;0;diagnosis verified by
;;HSIT;2.04;0;Site verifying DX
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGNTAPI1 5887 printed Dec 13, 2024@02:46:10 Page 2
DGNTAPI1 ;ALB/RPM - API's for N/T Radium Treatment(part 2); 7/16/01 3:04pm
+1 ;;5.3;Registration;**397,423**;Aug 13, 1993
+2 QUIT
+3 ;
ENRUPD(DGDFN,DGHEC) ;
+1 ;This function is the entry point for HEC/Enrollment data updates
+2 ;via the Enrollment HL7 message upload.
+3 ;
+4 ; Input:
+5 ; DGDFN - PATIENT file (#2) IEN
+6 ; DGHEC - update values array passed by reference
+7 ; DGHEC("NTR") - Nose/Throat Radium
+8 ; DGHEC("AVI") - Aviator?
+9 ; DGHEC("SUB") - Submariner
+10 ; DGHEC("VER") - Verification method
+11 ; DGHEC("VDT") - Verification completion date/time
+12 ; DGHEC("VSIT") - Verification site
+13 ; DGHEC("HNC") - Head/Neck CA DX
+14 ; DGHEC("HDT") - Head/Neck CA date/time
+15 ; DGHEC("HSIT") - Site determining CA DX
+16 ;
+17 ; Output:
+18 ; function result 1-success, 0-failure
+19 ;
+20 NEW DGRSLT
+21 ;generic index
NEW DGX
+22 SET DGRSLT=0
+23 SET DGDFN=+$GET(DGDFN)
+24 FOR DGX="NTR","AVI","SUB","VER","VDT","VSIT","HNC","HDT","HSIT"
Begin DoDot:1
+25 SET DGHEC(DGX)=$GET(DGHEC(DGX))
End DoDot:1
+26 IF DGDFN>0
IF $DATA(^DPT(DGDFN))
IF DGHEC("NTR")]""
IF DGHEC("VDT")]""
IF $$CHANGE^DGNTUT(DGDFN,.DGHEC,1)
Begin DoDot:1
+27 SET DGHEC("EUSR")=DUZ
+28 SET DGHEC("EDT")=$$NOW^XLFDT
+29 SET DGRSLT=$$FILENTR^DGNTAPI(DGDFN,.DGHEC,0)
End DoDot:1
+30 QUIT DGRSLT
+31 ;
ENRGET(DGDFN,DGENR) ;Entry point for Enrollment data retrieval from
+1 ;NOSE AND THROAT RADIUM HISTORY file (#28.11).
+2 ;
+3 ; Input:
+4 ; DGDFN - IEN of patient in the PATIENT (#2) file
+5 ; DGENR - Array name of return values [Optional - Default DGNTARR]
+6 ;
+7 ; Output:
+8 ; function result - 1-complete record found, 0-incomplete record
+9 ; DGENR - Array of current NTR HISTORY file record field values.
+10 ; See $$GETREC^DGNTAPI for array specifications.
+11 ;
+12 NEW DGIEN
+13 NEW DGRSLT
+14 NEW DGX
+15 ;
+16 IF '$GET(DGDFN)
QUIT 0
+17 ;
+18 SET DGENR=$GET(DGENR)
+19 IF DGENR']""
SET DGENR="DGNTARR"
+20 ;
+21 SET DGRSLT=0
+22 SET DGIEN=+$$GETPRIM^DGNTAPI(DGDFN)
+23 IF ($$GETREC^DGNTAPI(DGIEN,DGENR)&($GET(@DGENR@("VDT"))]""))
Begin DoDot:1
+24 SET DGRSLT=1
+25 ;return only internal values
+26 FOR DGX="IND","STAT","NTR","AVI","SUB","VER","HNC"
Begin DoDot:2
+27 SET @DGENR@(DGX)=$PIECE(@DGENR@(DGX),"^")
End DoDot:2
End DoDot:1
+28 QUIT DGRSLT
+29 ;
GETSTAT(DGDFN) ;get the screening status
+1 ;
+2 ; Input:
+3 ; DGDFN - IEN of patient in the PATIENT (#2) file
+4 ;
+5 ; Output:
+6 ; function result - internal value of SCREENING STATUS field (#.03)
+7 ;
+8 NEW DGNT
+9 IF +$GET(DGDFN)>0
IF +$$GETCUR^DGNTAPI(DGDFN,"DGNT")
+10 QUIT (+$GET(DGNT("STAT")))
+11 ;
FILEHNC(DGDFN) ;entry point for applications that need to complete the
+1 ;Head/Neck diagnosis question. Only file an entry if the Screening
+2 ;Status is "3" - Pending Diagnosis.
+3 ;This API is supported by DBIA #3456
+4 ;
+5 ; Input:
+6 ; DGDFN - IEN of patient in the PATIENT (#2) file
+7 ;
+8 ; Output:
+9 ; function result - "0"-nothing filed, "1"-success
+10 ;
+11 NEW DGNT,DGRSLT
+12 SET DGRSLT=0
+13 IF +$GET(DGDFN)>0
IF +$$GETCUR^DGNTAPI(DGDFN,"DGNT")
IF +$GET(DGNT("STAT"))=3
Begin DoDot:1
+14 SET DGNT("HNC")="Y"
+15 SET DGNT("HDT")=$$NOW^XLFDT
+16 SET DGNT("HUSR")=DUZ
+17 SET DGNT("HSIT")=$$SITE^DGNTUT
+18 SET DGRSLT=$$FILENTR^DGNTAPI(DGDFN,.DGNT,1)
End DoDot:1
+19 QUIT DGRSLT
+20 ;
VALID(DGIP,DGERR) ;Validate input parameters before filing
+1 ; Input
+2 ; DGIP - array of input parameters to validate passed by reference
+3 ; DGERR - error parameter passed by reference
+4 ;
+5 ; Output
+6 ; function output - 0:invalid, 1:valid
+7 ; DGERR - error message
+8 ;
+9 ;function return value
NEW DGVLD
+10 ;node name to field xref array
NEW DGFXR
+11 ;array of required parameters
NEW DGREQ
+12 ;array node name
NEW DGN
+13 ;file number
NEW DGFILE
+14 ;
+15 SET DGVLD=1
+16 SET DGN=""
+17 SET DGFILE=28.11
+18 ;build field/node xref and required fields array
+19 DO BLDARR(.DGFXR,.DGREQ)
+20 ;
+21 ;first invalid condition will exit block structure
Begin DoDot:1
+22 ;check for required parameters
+23 FOR
SET DGN=$ORDER(DGREQ(DGN))
if DGN=""
QUIT
IF $GET(DGIP(DGN))']""
Begin DoDot:2
+24 SET DGVLD=0
SET DGERR=$$GET1^DID(DGFILE,DGFXR(DGN),,"LABEL")_" REQUIRED"
End DoDot:2
QUIT
+25 ;quit if any missing required parameters
+26 if 'DGVLD
QUIT
+27 ;check value validity
+28 FOR
SET DGN=$ORDER(DGIP(DGN))
if DGN=""
QUIT
IF $DATA(DGFXR(DGN))
IF '$$TESTVAL(DGFILE,DGFXR(DGN),$PIECE(DGIP(DGN),U))
Begin DoDot:2
+29 SET DGVLD=0
SET DGERR=$$GET1^DID(DGFILE,DGFXR(DGN),,"LABEL")_" NOT VALID"
End DoDot:2
QUIT
End DoDot:1
+30 QUIT DGVLD
+31 ;
BLDARR(DGFLDA,DGREQA) ;Read in $T(XREF) lines and build name/field xref
+1 ;array and required fields array.
+2 ; Input
+3 ; DGFLDA - array name passed by reference
+4 ; DGREQA - array name of required fields passed by reference
+5 ;
+6 ; Output
+7 ; DGFLDA - field array node xref
+8 ; DGREQA - required fields array
+9 ;
+10 ;offset value used with $T
NEW DGOFF
+11 ;line retrieved by $T(XREF+offset)
NEW DGLINE
+12 ;
+13 FOR DGOFF=1:1
SET DGLINE=$TEXT(XREF+DGOFF)
if DGLINE=""
QUIT
Begin DoDot:1
+14 SET DGFLDA($PIECE(DGLINE,";",3))=$PIECE(DGLINE,";",4)
+15 IF +$PIECE(DGLINE,";",5)
SET DGREQA($PIECE(DGLINE,";",3))=""
End DoDot:1
+16 QUIT
+17 ;
TESTVAL(DGFIL,DGFLD,DGVAL) ;Used to determine if a field value is valid
+1 ;
+2 ; Input
+3 ; DGFIL - file number
+4 ; DGFLD - field number
+5 ; DGVAL - field value to be validated
+6 ;
+7 ; Output
+8 ; Function value: 1:field value is valid, 0:field value is invalid
+9 ;
+10 ;external value after conversion
NEW DGVALEX
+11 ;result of CHK^DIE
NEW DGRSLT
+12 ;function result
NEW VALID
+13 ;
+14 SET VALID=1
+15 IF DGVAL'=""
Begin DoDot:1
+16 SET DGVALEX=$$EXTERNAL^DILFD(DGFIL,DGFLD,"F",DGVAL)
+17 IF DGVALEX=""
SET VALID=0
QUIT
+18 ;
+19 IF $$GET1^DID(DGFIL,DGFLD,"","TYPE")'="POINTER"
Begin DoDot:2
+20 DO CHK^DIE(DGFIL,DGFLD,,DGVALEX,.DGRSLT)
IF DGRSLT="^"
SET VALID=0
QUIT
End DoDot:2
End DoDot:1
+21 QUIT VALID
+22 ;
XREF ;;array node name;field#;required param;description
+1 ;;DFN;.01;1;patient IEN
+2 ;;NTR;.04;1;NTR exposure code
+3 ;;AVI;.05;0;Military Aviator prior to 1/31/55
+4 ;;SUB;.06;0;Submarine Training prior to 1/1/65
+5 ;;EDT;.07;0;Date/Time entered
+6 ;;EUSR;.08;0;Entered by
+7 ;;VER;1.01;0;verification method
+8 ;;VDT;1.02;0;Date/Time verified
+9 ;;VUSR;1.03;0;verified by
+10 ;;VSIT;1.04;0;Site verifying Documentation
+11 ;;HNC;2.01;0;Head/Neck Cancer DX
+12 ;;HDT;2.02;0;Date/Time diagnosis verified
+13 ;;HUSR;2.03;0;diagnosis verified by
+14 ;;HSIT;2.04;0;Site verifying DX