Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGNTQ

DGNTQ.m

Go to the documentation of this file.
  1. DGNTQ ;ALB/RPM - NOSE/THROAT RADIUM TREATMENT QUESTIONS ; 8/24/01 12:59pm
  1. ;;5.3;Registration;**397**;Aug 13, 1993
  1. Q
  1. ;
  1. ASKSTAT(DGDIRA,DGDIRB,DGDIR0) ;
  1. ;
  1. ; Input
  1. ; DGDIR0 - DIR(0) string
  1. ; DGDIRA - DIR("A") string
  1. ; DGDIRB - DIR("B") string
  1. ;
  1. ; Output
  1. ; DGRSLT has the following values:
  1. ; 0 - if user up-arrows, times out, or enters null
  1. ; Y - user response
  1. ;
  1. K DIRUT
  1. S DIR(0)=DGDIR0
  1. S DIR("A")=DGDIRA
  1. S DIR("B")=DGDIRB
  1. D ^DIR
  1. K DIR
  1. I $D(DIRUT) S DGRSLT=0
  1. E S DGRSLT=Y
  1. ;
  1. Q DGRSLT
  1. ;
  1. REG(DGDFN) ;Entry point from REGISTRATION
  1. ;This sub-routine asks the Nose/Throat Radium Treatment questions
  1. ;for Screen 6 of LOAD/EDIT PATIENT DATA. The answers are filed in
  1. ;the NTR HISTORY file (#28.11) using the $$FILENTR^DGNTAPI API.
  1. ;A caret "^" entered as an answer to any of the questions will cause
  1. ;the sub-routine to QUIT without filing any data.
  1. ;A user possessing the DGNT VERIFY security key will have additional
  1. ;verification questions asked.
  1. ;
  1. ; Input
  1. ; DGDFN - IEN to PATIENT file (#2)
  1. ;
  1. ; Output none
  1. ;
  1. N I,X,Y ;protect FileMan ^DIE variables
  1. N DGNTIEN ;IEN from existing record from $$GETCUR API call
  1. N DGNT ;data array from $$GETCUR API call
  1. N DGDFLT ;default answer array
  1. N DGUPD ;question response array subscripted by "NTR","AVI","SUB"
  1. N DGRSLT ;result of filer API
  1. N DGX ;generic counter
  1. N DGXMT ;HL7 transmit flag
  1. ;
  1. ;initialize defaults
  1. S DGNTIEN=$$GETCUR^DGNTAPI(DGDFN,"DGNT")
  1. I 'DGNTIEN D
  1. . F DGX="NTR","AVI","SUB","EDT","EUSR","HNC","HDT","HUSR","HSIT","VER","VDT","VUSR","VSIT" S DGUPD(DGX)=""
  1. I +DGNTIEN>0,$D(DGNT) M DGUPD=DGNT
  1. F DGX="NTR","AVI","SUB" D
  1. . S DGDFLT(DGX)=$S($P(DGUPD(DGX),"^",2)]"":$P(DGUPD(DGX),"^",2),1:"NO")
  1. ;
  1. ;call reader API $$ASKSTAT passing DFN,DIR(0),DIR("B"),DIR("A")
  1. S DGUPD("NTR")=$$ASKSTAT("Did you receive Nose or Throat Radium Treatments in the military? ",DGDFLT("NTR"),"28.11,.04AO")
  1. Q:DGUPD("NTR")=0 ;user entered "^" or timed out
  1. I DGUPD("NTR")="Y"!(DGUPD("NTR")="U") D
  1. . S DGUPD("AVI")=$S($$DATOK(DGDFN,2550131):$$ASKSTAT("Did you serve as an aviator in the military before Jan 31, 1955? ",DGDFLT("AVI"),"28.11,.05AO"),1:"")
  1. . Q:DGUPD("AVI")=0
  1. . S DGUPD("SUB")=$S($$DATOK(DGDFN,2650101):$$ASKSTAT("Did you have submarine training in the military before Jan 1, 1965? ",DGDFLT("SUB"),"28.11,.06AO"),1:"")
  1. ;quit if user entered "^" or timed out during questions
  1. I DGUPD("NTR")=0!(DGUPD("AVI")=0!(DGUPD("SUB")=0)) Q
  1. ;check for value change and add entry date, user, site and clear
  1. ;the previous verification/head&neck values
  1. F DGX="NTR","AVI","SUB" I DGUPD(DGX)'=$P($G(DGNT(DGX)),"^") D Q
  1. . S DGUPD("EDT")=$$NOW^XLFDT
  1. . S DGUPD("EUSR")=DUZ
  1. . I DGUPD("VDT")]"" D ;clear verification
  1. . . F DGX="VER","VDT","VUSR","VSIT" S DGUPD(DGX)=""
  1. . I DGUPD("HDT")]"" D ;clear Head/Neck DX
  1. . . F DGX="HNC","HDT","HUSR","HSIT" S DGUPD(DGX)=""
  1. ;can user verify?
  1. I $D(^XUSEC("DGNT VERIFY",DUZ)),(DGUPD("NTR")="Y"!(DGUPD("NTR")="U")) D VERIFY(DGDFN,.DGUPD)
  1. ;flip Unknown to Yes if verified by Mil Med Record
  1. I DGUPD("NTR")="U",DGUPD("VER")="M" S DGUPD("NTR")="Y"
  1. ;file the data using filer API passing DFN and response array
  1. F DGX="NTR","AVI","SUB","VER","HNC" S DGUPD(DGX)=$P(DGUPD(DGX),"^")
  1. I $$CHANGE^DGNTUT(DGDFN,.DGUPD) D
  1. . I DGUPD("NTR")="N" D
  1. . . S DGUPD("VDT")=$$NOW^XLFDT
  1. . . S DGUPD("VSIT")=$$SITE^DGNTUT
  1. . S DGXMT=$S(DGUPD("VDT")'="":1,1:0)
  1. . S DGRSLT=$$FILENTR^DGNTAPI(DGDFN,.DGUPD,DGXMT)
  1. REGQ Q
  1. ;
  1. VERIFY(DGDFN,DGVUPD) ;Ask verification questions
  1. ;
  1. ; Input
  1. ; DGDFN - IEN to PATIENT file (#2)
  1. ; DGVUPD - array of question responses
  1. ;
  1. ; Output none
  1. ;
  1. N DGX ;generic index
  1. N DGDFLT ;default answer array
  1. ;
  1. ;set up default answer array
  1. S DGDFLT("VER")=$S($P($G(DGVUPD("VER")),"^",1)]"":$P(DGVUPD("VER"),"^",1),1:"")
  1. S DGDFLT("HNC")=$S($P($G(DGVUPD("HNC")),"^",2)]"":$P(DGVUPD("HNC"),"^",2),1:"")
  1. I $$ASKSTAT("Do you want to verify now? ","NO","YAO") D
  1. . S DGVUPD("VER")=$$ASKSTAT("Nose and throat radium treatment verified by: ",DGDFLT("VER"),"28.11,1.01AO")
  1. . I DGVUPD("VER")=0 S DGVUPD("VER")=DGDFLT("VER") Q
  1. . I DGVUPD("VER")'=DGDFLT("VER") D
  1. . . S DGVUPD("VDT")=$$NOW^XLFDT
  1. . . S DGVUPD("VUSR")=DUZ
  1. . . S DGVUPD("VSIT")=$$SITE^DGNTUT
  1. . I DGVUPD("VER")'="N" D
  1. . . S DGVUPD("HNC")=$$ASKSTAT("Has the veteran been diagnosed with Cancer of the Head and/or Neck? ",$S(DGDFLT("HNC")]"":DGDFLT("HNC"),1:"NO"),"28.11,2.01AO")
  1. . . I DGVUPD("HNC")=0 S DGVUPD("HNC")=$E(DGDFLT("HNC")) Q
  1. . . I DGVUPD("HNC")="N" S DGVUPD("HNC")=""
  1. . . I DGVUPD("HNC")'=DGDFLT("HNC") D
  1. . . . S DGVUPD("HDT")=$$NOW^XLFDT
  1. . . . S DGVUPD("HUSR")=DUZ
  1. . . . S DGVUPD("HSIT")=$$SITE^DGNTUT
  1. Q
  1. ;
  1. DATOK(DGDFN,DGDATE) ;Validate dates before asking questions
  1. ;Call $$SVCCHK to check Service Entry dates and if no Service
  1. ;Entry dates are found then at least validate against DOB.
  1. ;
  1. ; Input
  1. ; DGDFN - IEN to PATIENT file (#2)
  1. ; DGDATE- FM forumat date to validate agains
  1. ;
  1. ; Output
  1. ; DGRSLT - 0 = don't ask question
  1. ; 1 = ask question
  1. ;
  1. N DGRSLT
  1. S DGDFN=$G(DGDFN)
  1. S DGDATE=$G(DGDATE)
  1. S DGRSLT=1
  1. S DGRSLT=$$SVCCHK(DGDFN,DGDATE)
  1. I DGRSLT<0 S DGRSLT=$$DOBCHK(DGDFN,DGDATE)
  1. Q DGRSLT
  1. ;
  1. SVCCHK(DGDFN,DGDATE) ;Did veteran serve prior to DGDATE?
  1. ;This function searches the veteran's Service Entry dates to find the
  1. ;earliest date. If a Service Entry date is found then it is compared
  1. ;against the DGDATE parameter and returns a zero ("0") if DGDATE
  1. ;precedes the Service Entry date. If the Service Entry date precedes
  1. ;DGDATE a one ("1") is returned.
  1. ;
  1. ; Input
  1. ; DGDFN - IEN to PATIENT file (#2)
  1. ; DGDATE - FM format date to validate agains
  1. ;
  1. ; Output
  1. ; DGRSLT - 0 = DGDATE precedes earliest Service Entry date.
  1. ; 1 = Service Entry date precedes DGDATE
  1. ; -1 = no Service Entry date found.
  1. ;
  1. N DFN,VASV,VAERR ;SVC^VADPT variables
  1. N DGSVCE ;Service Entry date
  1. N DGRSLT
  1. S DGDFN=+$G(DGDFN)
  1. S DGDATE=+$G(DGDATE)
  1. S DGRSLT=-1
  1. S DFN=DGDFN
  1. D SVC^VADPT
  1. F DGX=8:-1:6 I +$G(VASV(DGX,4))>0 D Q
  1. . S DGRSLT=1
  1. . I DGDATE<+$G(VASV(DGX,4)) S DGRSLT=0
  1. Q DGRSLT
  1. ;
  1. DOBCHK(DGDFN,DGDATE) ;Was veteran too young to have served at DGDATE?
  1. ;This function compares the veteran's DOB against DGDATE to determine
  1. ;if the veteran was less than 15 years old at DGDATE. This logic
  1. ;is based on POS^DGRPDD1.
  1. ;
  1. ; Input
  1. ; DGDFN - IEN to PATIENT file (#2)
  1. ; DGDATE- FM format date to validate against
  1. ;
  1. ; Output
  1. ; DGRSLT - 0 = veteran too young
  1. ; 1 = veteran old enough
  1. ;
  1. N DFN,VA,VADM,VAERR ;DEM^VADPT variables
  1. N DGDOB
  1. N DGRSLT
  1. S DGDFN=+$G(DGDFN)
  1. S DGDATE=+$G(DGDATE)
  1. S DGRSLT=1
  1. S DFN=DGDFN
  1. D DEM^VADPT
  1. S DGDOB=+$G(VADM(3))
  1. I DGDATE-DGDOB\10000<15 S DGRSLT=0
  1. Q DGRSLT
  1. ;