DGNTAPI ;ALB/RPM - API's for N/T Radium Treatments ; 8/24/01 3:49pm
;;5.3;Registration;**397,423**;Aug 13, 1993
Q
;
;
GETPRIM(DFN) ; Used to get the patient's primary record in the (#28.11) file.
;
; Input:
; DFN - IEN of patient in the PATIENT (#2) file
;
; Output:
; Function Value - If successful, returns IEN of record in (#28.11) file, otherwise returns null on failure.
;
Q:'$G(DFN) ""
Q $O(^DGNT(28.11,"APR",DFN,1,0))
;
;
GETREC(DGIEN,DGNTAPA) ; Used to obtain a record in the (#28.11) file.
;
; Input:
; DGIEN - IEN of record in the (#28.11) file
; DGNTAPA - Array name of return values [Optional - Default DGNTARR]
;
; Output:
; Function Value: Returns 1 on success, 0 on failure.
; DGNTAPA() array, passed by reference. If the function is successful
; this array will contain the record.
;
; subscript field name
; --------- ----------
; "DFN" Patient
; "IND" NTR Indicator - internal^external
; "STAT" Screening Status - internal^external
; "NTR" NTR Treatment - internal^external
; "AVI" Military Aviator Pre 1/31/1955 - internal^external
; "SUB" Submarine Training Pre 1/1/65 - internal^external
; "EDT" Date/Time NTR Entered
; "EUSR" NTR Entered By
; "PRIM" NTR Primary Entry
; "SUPER" Date/Time Superseded
; "VER" Verification Method - internal^external
; "VDT" Date/Time Verified
; "VUSR" Verified By
; "VSIT" Site Verifying Documentation
; "HNC" Head/Neck CA DX - internal^external
; "HDT" Date/Time DX Verified
; "HUSR" DX Verified By
; "HSIT" Site Verifying DX
;
N DGFDA,DGMSG
;
I '$G(DGIEN) Q 0
I '$D(^DGNT(28.11,DGIEN,0)) Q 0
;
S DGNTAPA=$G(DGNTAPA)
I DGNTAPA']"" S DGNTAPA="DGNTARR"
;
; Obtain record
D GETS^DIQ(28.11,DGIEN_",","*","IE","DGFDA","DGMSG")
S @DGNTAPA@("DFN")=$G(DGFDA(28.11,+DGIEN_",",.01,"I"))
S @DGNTAPA@("IND")=$G(DGFDA(28.11,+DGIEN_",",.02,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.02,"E"))
S @DGNTAPA@("STAT")=$G(DGFDA(28.11,+DGIEN_",",.03,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.03,"E"))
S @DGNTAPA@("NTR")=$G(DGFDA(28.11,+DGIEN_",",.04,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.04,"E"))
S @DGNTAPA@("AVI")=$G(DGFDA(28.11,+DGIEN_",",.05,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.05,"E"))
S @DGNTAPA@("SUB")=$G(DGFDA(28.11,+DGIEN_",",.06,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.06,"E"))
S @DGNTAPA@("EDT")=$G(DGFDA(28.11,+DGIEN_",",.07,"I"))
S @DGNTAPA@("EUSR")=$G(DGFDA(28.11,+DGIEN_",",.08,"I"))
S @DGNTAPA@("PRIM")=$G(DGFDA(28.11,+DGIEN_",",.09,"I"))
S @DGNTAPA@("SUPER")=$G(DGFDA(28.11,+DGIEN_",",.1,"I"))
S @DGNTAPA@("VER")=$G(DGFDA(28.11,+DGIEN_",",1.01,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",1.01,"E"))
S @DGNTAPA@("VDT")=$G(DGFDA(28.11,+DGIEN_",",1.02,"I"))
S @DGNTAPA@("VUSR")=$G(DGFDA(28.11,+DGIEN_",",1.03,"I"))
S @DGNTAPA@("VSIT")=$G(DGFDA(28.11,+DGIEN_",",1.04,"I"))
S @DGNTAPA@("HNC")=$G(DGFDA(28.11,+DGIEN_",",2.01,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",2.01,"E"))
S @DGNTAPA@("HDT")=$G(DGFDA(28.11,+DGIEN_",",2.02,"I"))
S @DGNTAPA@("HUSR")=$G(DGFDA(28.11,+DGIEN_",",2.03,"I"))
S @DGNTAPA@("HSIT")=$G(DGFDA(28.11,+DGIEN_",",2.04,"I"))
;
Q 1
;
GETCUR(DGDFN,DGNTAPIA) ; Retrieve current record
;This is a supported API (DBIA #3457)
; Input:
; DGDFN - IEN of patient in the PATIENT (#2) file
; DGNTAPIA - Array name of return values [Optional - Default DGNTARR]
;
; Output:
; function result - IEN of current NTR HISTORY file (#28.11) record.
; DGNTAPIA - Array of current NTR HISTORY file record field values.
; See $$GETREC for documentation.
; The node, "INTRP", a calculated free text intrepretation
; is added to the array.
;
N DGIEN
;
I '$G(DGDFN) Q 0
;
S DGNTAPIA=$G(DGNTAPIA)
I DGNTAPIA']"" S DGNTAPIA="DGNTARR"
;
S DGIEN=+$$GETPRIM(DGDFN)
I $$GETREC(DGIEN,DGNTAPIA) D
. S @DGNTAPIA@("INTRP")=$$INTERP^DGNTUT(DGNTAPIA)
Q DGIEN
;
FILENTR(DFN,DGNUPD,DGXMIT) ; NTR HISTORY (#28.11) filer
; Callpoint to create a new NTR HISTORY FILE (#28.11) entry.
; Will also queue HL7 message for HEC database updates.
;
; Input
; DFN - Patients DFN
; DGNUPD - question response array
; "NTR" - NTR exposure code
; "AVI" - Military Aviator prior to 1/31/55
; "SUB" - Submarine Training prior to 1/1/65
; "EDT" - Date/Time entered
; "EUSR" - Entered by
; "VER" - verification method
; "VDT" - Date/Time verified
; "VUSR" - verified by
; "VSIT" - Site verifying Documentation
; "HNC" - Head/Neck Cancer DX
; "HDT" - Date/Time diagnosis verified
; "HUSR" - diagnosis verified by
; "HSIT" - Site verifying DX
; DGXMIT - flag to transmit update to the HEC
; "0" - don't transmit, "1" - transmit [default]
;
; Output
; DGRSLT - Returns IEN of file (#28.11) entry if successful
;
; If an error occurred during parameter validation, then:
; DGRSLT = 0^Error Description
;
; If an error occured during filing, then:
; DGRSLT = 0^Error Code IEN
; (returned by UPDATE^DIE call)
;
N DGRSLT,DGFDA,DGNERR
S DFN=+$G(DFN)
S DGXMIT=$S($G(DGXMIT)=0:0,1:1)
S DGRSLT=0
;
I DFN>0,$D(DGNUPD) D
. S DGNUPD("DFN")=DFN
. ;validate the input array parameter
. I '$$VALID^DGNTAPI1(.DGNUPD,.DGNERR) D Q
. . S DGRSLT="0^"_$G(DGNERR)
. I $$BLDFDA(DFN,.DGNUPD,.DGFDA) S DGRSLT=$$NEWNTR(.DGFDA)
. Q:'DGRSLT
. ;queue message to the HEC
. I DGXMIT D AUTOUPD^DGENA2(DFN)
;
Q DGRSLT
;
BLDFDA(DFN,DGNTUPD,DGBFDA) ;
;Build the field desription array
; Input
; DFN - Patients DFN
; DGNTUPD - question response array - refer to $$FILENTR
; DGBFDA - FDA name passed by reference
;
; Output
; DGBFDA - field array built by reference
; DGRSLT - function return
; 1 - successful build
; 0 - nothing built
;
N DGSTAT ;screening status internal code
N DGIENS ;IENS string
N DGRSLT ;did anything get built
;
S DGIENS="+1,"
S DGRSLT=0
S DGBFDA(28.11,DGIENS,.01)=DFN
S DGBFDA(28.11,DGIENS,.04)=$P(DGNTUPD("NTR"),"^")
S DGBFDA(28.11,DGIENS,.05)=$P(DGNTUPD("AVI"),"^")
S DGBFDA(28.11,DGIENS,.06)=$P(DGNTUPD("SUB"),"^")
S DGBFDA(28.11,DGIENS,.07)=$G(DGNTUPD("EDT"))
S DGBFDA(28.11,DGIENS,.08)=$G(DGNTUPD("EUSR"))
S DGBFDA(28.11,DGIENS,1.01)=$P(DGNTUPD("VER"),"^")
S DGBFDA(28.11,DGIENS,1.02)=$G(DGNTUPD("VDT"))
S DGBFDA(28.11,DGIENS,1.03)=$G(DGNTUPD("VUSR"))
S DGBFDA(28.11,DGIENS,1.04)=$G(DGNTUPD("VSIT"))
S DGBFDA(28.11,DGIENS,2.01)=$P(DGNTUPD("HNC"),"^")
S DGBFDA(28.11,DGIENS,2.02)=$G(DGNTUPD("HDT"))
S DGBFDA(28.11,DGIENS,2.03)=$G(DGNTUPD("HUSR"))
S DGBFDA(28.11,DGIENS,2.04)=$G(DGNTUPD("HSIT"))
;indicator and status
S DGSTAT=$$STATUS^DGNTUT(.DGNTUPD) ;determine pending/verified status
S DGBFDA(28.11,DGIENS,.02)=$S(DGSTAT=4!(DGSTAT=5):"Y",1:"N")
S DGBFDA(28.11,DGIENS,.03)=DGSTAT
S DGBFDA(28.11,DGIENS,.09)=1
Q 1
;
NEWNTR(DGNFDA) ;Create new record
; Input
; DGNFDA - Field description array
;
; Output
; DGRSLT - 1=success
; 0=failed
;
N DGERR,DGRSLT,DGNTIEN
D UPDATE^DIE("","DGNFDA","DGNTIEN","DGERR")
S DGRSLT=+$G(DGNTIEN(1))
I $D(DGERR) D
. S DGRSLT="0^"_$G(DGERR("DIERR",1))
Q DGRSLT
;
;
UPDNTR(DGUFDA) ;Update existing record
; Input
; DGUFDA - Field description array
;
; Output
; DGRSLT - 1=success
; 0=failed
;
N DGERR,DGRSLT
S DGRSLT=0
D FILE^DIE("K","DGUFDA","DGERR")
I '$D(DGERR) S DGRSLT=1
Q DGRSLT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGNTAPI 7780 printed Dec 13, 2024@02:46:09 Page 2
DGNTAPI ;ALB/RPM - API's for N/T Radium Treatments ; 8/24/01 3:49pm
+1 ;;5.3;Registration;**397,423**;Aug 13, 1993
+2 QUIT
+3 ;
+4 ;
GETPRIM(DFN) ; Used to get the patient's primary record in the (#28.11) file.
+1 ;
+2 ; Input:
+3 ; DFN - IEN of patient in the PATIENT (#2) file
+4 ;
+5 ; Output:
+6 ; Function Value - If successful, returns IEN of record in (#28.11) file, otherwise returns null on failure.
+7 ;
+8 if '$GET(DFN)
QUIT ""
+9 QUIT $ORDER(^DGNT(28.11,"APR",DFN,1,0))
+10 ;
+11 ;
GETREC(DGIEN,DGNTAPA) ; Used to obtain a record in the (#28.11) file.
+1 ;
+2 ; Input:
+3 ; DGIEN - IEN of record in the (#28.11) file
+4 ; DGNTAPA - Array name of return values [Optional - Default DGNTARR]
+5 ;
+6 ; Output:
+7 ; Function Value: Returns 1 on success, 0 on failure.
+8 ; DGNTAPA() array, passed by reference. If the function is successful
+9 ; this array will contain the record.
+10 ;
+11 ; subscript field name
+12 ; --------- ----------
+13 ; "DFN" Patient
+14 ; "IND" NTR Indicator - internal^external
+15 ; "STAT" Screening Status - internal^external
+16 ; "NTR" NTR Treatment - internal^external
+17 ; "AVI" Military Aviator Pre 1/31/1955 - internal^external
+18 ; "SUB" Submarine Training Pre 1/1/65 - internal^external
+19 ; "EDT" Date/Time NTR Entered
+20 ; "EUSR" NTR Entered By
+21 ; "PRIM" NTR Primary Entry
+22 ; "SUPER" Date/Time Superseded
+23 ; "VER" Verification Method - internal^external
+24 ; "VDT" Date/Time Verified
+25 ; "VUSR" Verified By
+26 ; "VSIT" Site Verifying Documentation
+27 ; "HNC" Head/Neck CA DX - internal^external
+28 ; "HDT" Date/Time DX Verified
+29 ; "HUSR" DX Verified By
+30 ; "HSIT" Site Verifying DX
+31 ;
+32 NEW DGFDA,DGMSG
+33 ;
+34 IF '$GET(DGIEN)
QUIT 0
+35 IF '$DATA(^DGNT(28.11,DGIEN,0))
QUIT 0
+36 ;
+37 SET DGNTAPA=$GET(DGNTAPA)
+38 IF DGNTAPA']""
SET DGNTAPA="DGNTARR"
+39 ;
+40 ; Obtain record
+41 DO GETS^DIQ(28.11,DGIEN_",","*","IE","DGFDA","DGMSG")
+42 SET @DGNTAPA@("DFN")=$GET(DGFDA(28.11,+DGIEN_",",.01,"I"))
+43 SET @DGNTAPA@("IND")=$GET(DGFDA(28.11,+DGIEN_",",.02,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",.02,"E"))
+44 SET @DGNTAPA@("STAT")=$GET(DGFDA(28.11,+DGIEN_",",.03,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",.03,"E"))
+45 SET @DGNTAPA@("NTR")=$GET(DGFDA(28.11,+DGIEN_",",.04,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",.04,"E"))
+46 SET @DGNTAPA@("AVI")=$GET(DGFDA(28.11,+DGIEN_",",.05,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",.05,"E"))
+47 SET @DGNTAPA@("SUB")=$GET(DGFDA(28.11,+DGIEN_",",.06,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",.06,"E"))
+48 SET @DGNTAPA@("EDT")=$GET(DGFDA(28.11,+DGIEN_",",.07,"I"))
+49 SET @DGNTAPA@("EUSR")=$GET(DGFDA(28.11,+DGIEN_",",.08,"I"))
+50 SET @DGNTAPA@("PRIM")=$GET(DGFDA(28.11,+DGIEN_",",.09,"I"))
+51 SET @DGNTAPA@("SUPER")=$GET(DGFDA(28.11,+DGIEN_",",.1,"I"))
+52 SET @DGNTAPA@("VER")=$GET(DGFDA(28.11,+DGIEN_",",1.01,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",1.01,"E"))
+53 SET @DGNTAPA@("VDT")=$GET(DGFDA(28.11,+DGIEN_",",1.02,"I"))
+54 SET @DGNTAPA@("VUSR")=$GET(DGFDA(28.11,+DGIEN_",",1.03,"I"))
+55 SET @DGNTAPA@("VSIT")=$GET(DGFDA(28.11,+DGIEN_",",1.04,"I"))
+56 SET @DGNTAPA@("HNC")=$GET(DGFDA(28.11,+DGIEN_",",2.01,"I"))_"^"_$GET(DGFDA(28.11,+DGIEN_",",2.01,"E"))
+57 SET @DGNTAPA@("HDT")=$GET(DGFDA(28.11,+DGIEN_",",2.02,"I"))
+58 SET @DGNTAPA@("HUSR")=$GET(DGFDA(28.11,+DGIEN_",",2.03,"I"))
+59 SET @DGNTAPA@("HSIT")=$GET(DGFDA(28.11,+DGIEN_",",2.04,"I"))
+60 ;
+61 QUIT 1
+62 ;
GETCUR(DGDFN,DGNTAPIA) ; Retrieve current record
+1 ;This is a supported API (DBIA #3457)
+2 ; Input:
+3 ; DGDFN - IEN of patient in the PATIENT (#2) file
+4 ; DGNTAPIA - Array name of return values [Optional - Default DGNTARR]
+5 ;
+6 ; Output:
+7 ; function result - IEN of current NTR HISTORY file (#28.11) record.
+8 ; DGNTAPIA - Array of current NTR HISTORY file record field values.
+9 ; See $$GETREC for documentation.
+10 ; The node, "INTRP", a calculated free text intrepretation
+11 ; is added to the array.
+12 ;
+13 NEW DGIEN
+14 ;
+15 IF '$GET(DGDFN)
QUIT 0
+16 ;
+17 SET DGNTAPIA=$GET(DGNTAPIA)
+18 IF DGNTAPIA']""
SET DGNTAPIA="DGNTARR"
+19 ;
+20 SET DGIEN=+$$GETPRIM(DGDFN)
+21 IF $$GETREC(DGIEN,DGNTAPIA)
Begin DoDot:1
+22 SET @DGNTAPIA@("INTRP")=$$INTERP^DGNTUT(DGNTAPIA)
End DoDot:1
+23 QUIT DGIEN
+24 ;
FILENTR(DFN,DGNUPD,DGXMIT) ; NTR HISTORY (#28.11) filer
+1 ; Callpoint to create a new NTR HISTORY FILE (#28.11) entry.
+2 ; Will also queue HL7 message for HEC database updates.
+3 ;
+4 ; Input
+5 ; DFN - Patients DFN
+6 ; DGNUPD - question response array
+7 ; "NTR" - NTR exposure code
+8 ; "AVI" - Military Aviator prior to 1/31/55
+9 ; "SUB" - Submarine Training prior to 1/1/65
+10 ; "EDT" - Date/Time entered
+11 ; "EUSR" - Entered by
+12 ; "VER" - verification method
+13 ; "VDT" - Date/Time verified
+14 ; "VUSR" - verified by
+15 ; "VSIT" - Site verifying Documentation
+16 ; "HNC" - Head/Neck Cancer DX
+17 ; "HDT" - Date/Time diagnosis verified
+18 ; "HUSR" - diagnosis verified by
+19 ; "HSIT" - Site verifying DX
+20 ; DGXMIT - flag to transmit update to the HEC
+21 ; "0" - don't transmit, "1" - transmit [default]
+22 ;
+23 ; Output
+24 ; DGRSLT - Returns IEN of file (#28.11) entry if successful
+25 ;
+26 ; If an error occurred during parameter validation, then:
+27 ; DGRSLT = 0^Error Description
+28 ;
+29 ; If an error occured during filing, then:
+30 ; DGRSLT = 0^Error Code IEN
+31 ; (returned by UPDATE^DIE call)
+32 ;
+33 NEW DGRSLT,DGFDA,DGNERR
+34 SET DFN=+$GET(DFN)
+35 SET DGXMIT=$SELECT($GET(DGXMIT)=0:0,1:1)
+36 SET DGRSLT=0
+37 ;
+38 IF DFN>0
IF $DATA(DGNUPD)
Begin DoDot:1
+39 SET DGNUPD("DFN")=DFN
+40 ;validate the input array parameter
+41 IF '$$VALID^DGNTAPI1(.DGNUPD,.DGNERR)
Begin DoDot:2
+42 SET DGRSLT="0^"_$GET(DGNERR)
End DoDot:2
QUIT
+43 IF $$BLDFDA(DFN,.DGNUPD,.DGFDA)
SET DGRSLT=$$NEWNTR(.DGFDA)
+44 if 'DGRSLT
QUIT
+45 ;queue message to the HEC
+46 IF DGXMIT
DO AUTOUPD^DGENA2(DFN)
End DoDot:1
+47 ;
+48 QUIT DGRSLT
+49 ;
BLDFDA(DFN,DGNTUPD,DGBFDA) ;
+1 ;Build the field desription array
+2 ; Input
+3 ; DFN - Patients DFN
+4 ; DGNTUPD - question response array - refer to $$FILENTR
+5 ; DGBFDA - FDA name passed by reference
+6 ;
+7 ; Output
+8 ; DGBFDA - field array built by reference
+9 ; DGRSLT - function return
+10 ; 1 - successful build
+11 ; 0 - nothing built
+12 ;
+13 ;screening status internal code
NEW DGSTAT
+14 ;IENS string
NEW DGIENS
+15 ;did anything get built
NEW DGRSLT
+16 ;
+17 SET DGIENS="+1,"
+18 SET DGRSLT=0
+19 SET DGBFDA(28.11,DGIENS,.01)=DFN
+20 SET DGBFDA(28.11,DGIENS,.04)=$PIECE(DGNTUPD("NTR"),"^")
+21 SET DGBFDA(28.11,DGIENS,.05)=$PIECE(DGNTUPD("AVI"),"^")
+22 SET DGBFDA(28.11,DGIENS,.06)=$PIECE(DGNTUPD("SUB"),"^")
+23 SET DGBFDA(28.11,DGIENS,.07)=$GET(DGNTUPD("EDT"))
+24 SET DGBFDA(28.11,DGIENS,.08)=$GET(DGNTUPD("EUSR"))
+25 SET DGBFDA(28.11,DGIENS,1.01)=$PIECE(DGNTUPD("VER"),"^")
+26 SET DGBFDA(28.11,DGIENS,1.02)=$GET(DGNTUPD("VDT"))
+27 SET DGBFDA(28.11,DGIENS,1.03)=$GET(DGNTUPD("VUSR"))
+28 SET DGBFDA(28.11,DGIENS,1.04)=$GET(DGNTUPD("VSIT"))
+29 SET DGBFDA(28.11,DGIENS,2.01)=$PIECE(DGNTUPD("HNC"),"^")
+30 SET DGBFDA(28.11,DGIENS,2.02)=$GET(DGNTUPD("HDT"))
+31 SET DGBFDA(28.11,DGIENS,2.03)=$GET(DGNTUPD("HUSR"))
+32 SET DGBFDA(28.11,DGIENS,2.04)=$GET(DGNTUPD("HSIT"))
+33 ;indicator and status
+34 ;determine pending/verified status
SET DGSTAT=$$STATUS^DGNTUT(.DGNTUPD)
+35 SET DGBFDA(28.11,DGIENS,.02)=$SELECT(DGSTAT=4!(DGSTAT=5):"Y",1:"N")
+36 SET DGBFDA(28.11,DGIENS,.03)=DGSTAT
+37 SET DGBFDA(28.11,DGIENS,.09)=1
+38 QUIT 1
+39 ;
NEWNTR(DGNFDA) ;Create new record
+1 ; Input
+2 ; DGNFDA - Field description array
+3 ;
+4 ; Output
+5 ; DGRSLT - 1=success
+6 ; 0=failed
+7 ;
+8 NEW DGERR,DGRSLT,DGNTIEN
+9 DO UPDATE^DIE("","DGNFDA","DGNTIEN","DGERR")
+10 SET DGRSLT=+$GET(DGNTIEN(1))
+11 IF $DATA(DGERR)
Begin DoDot:1
+12 SET DGRSLT="0^"_$GET(DGERR("DIERR",1))
End DoDot:1
+13 QUIT DGRSLT
+14 ;
+15 ;
UPDNTR(DGUFDA) ;Update existing record
+1 ; Input
+2 ; DGUFDA - Field description array
+3 ;
+4 ; Output
+5 ; DGRSLT - 1=success
+6 ; 0=failed
+7 ;
+8 NEW DGERR,DGRSLT
+9 SET DGRSLT=0
+10 DO FILE^DIE("K","DGUFDA","DGERR")
+11 IF '$DATA(DGERR)
SET DGRSLT=1
+12 QUIT DGRSLT