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

GMTSDEM.m

Go to the documentation of this file.
  1. GMTSDEM ; SLC/DLT,KER - Demographics ; 12/11/2002
  1. ;;2.7;Health Summary;**28,49,55,56,60,73**;Oct 20, 1995
  1. ;
  1. ; External References
  1. ; DBIA 10061 OAD^VADPT
  1. ; DBIA 10061 OPD^VADPT
  1. ; DBIA 10061 SVC^VADPT
  1. ; DBIA 10061 ADD^VADPT
  1. ; DBIA 10061 DEM^VADPT
  1. ; DBIA 10061 ELIG^VADPT
  1. ; DBIA 2967 ^DIC(31,
  1. ; DBIA 10035 ^DPT( (file #2)
  1. ;
  1. DEMOG ; Demographic (VADPT)
  1. N I,VA,VADM,VAERR,VAOA,VASV,VAPA,VAPD,VAEL,SCD,SCDS,SCDP,FROM,GMI,TO,IX,X,Z
  1. D ADR,PER,SVC,BOS,COMB,ELIG,SC,SCDD,MT
  1. D NOK^GMTSDEM2,CD^GMTSDEMP(+($G(DFN)))
  1. D INS^GMTSDEM2,TF^GMTSDEMB(+($G(DFN)))
  1. D SRC^GMTSDEMB,END
  1. Q
  1. DEMO(DFN) ;
  1. K ^TMP("GMTSDEMO",$J,+($G(DFN)))
  1. N GMTSDEMX,I,VA,VADM,VAERR,VAOA,VASV,VAPA,VAPD,VAEL,SCD,SCDS,SCDP,FROM,GMI,TO,IX,X,Z
  1. S GMTSDEMX="" D DEMOG D:$D(GMTSTEST) ST
  1. Q
  1. ADR ; Patient Address
  1. Q:$D(GMTSQIT) D:$D(GMTSDEMX) NAM Q:$D(GMTSQIT) N %,%H,VA,VAPA,VAERR D ADD^VADPT
  1. D WRT("Address",$S($L(VAPA(1)):VAPA(1),1:"Not available"),"Phone",VAPA(8),1) Q:$D(GMTSQIT)
  1. I VAPA(2)'="" D WRT(($J("",21)_VAPA(2)),,,,0) Q:$D(GMTSQIT)
  1. I VAPA(3)'="" D WRT(($J("",21)_VAPA(3)),,,,0) Q:$D(GMTSQIT)
  1. I VAPA(4)'="" D Q:$D(GMTSQIT)
  1. . N STR S STR=VAPA(4)_", " S:VAPA(5)'="" STR=STR_$P($G(VAPA(5)),"^",2)_" "
  1. . S:VAPA(6)'="" STR=STR_VAPA(6) D WRT("",STR,"County",$P(VAPA(7),"^",2),1)
  1. D WRT(" ",,,,0)
  1. Q
  1. NAM ; Name/SSN/DOB/Sex
  1. N VAPTYP,VAHOW,VAROUT,VADM D DEM^VADPT
  1. D WRT("Name",$G(VADM(1)),"SSN",$E($P($G(VADM(2)),"^",2),1,11),1)
  1. D WRT("Date of Birth",$$EDT^GMTSU($P($G(VADM(3)),"^",1)),,,1)
  1. Q
  1. PER ; Personal
  1. Q:$D(GMTSQIT) N %,%H,VA,VADM,VAERR,VAPD D DEM^VADPT,OPD^VADPT
  1. I VADM(10)'=""!(VADM(4)'="") D Q:$D(GMTSQIT)
  1. . D WRT("Marital Status",$P($G(VADM(10)),"^",2),"Age",$P($G(VADM(4)),"^",1),1)
  1. I VADM(9)'=""!(VADM(5)'="") D Q:$D(GMTSQIT)
  1. . D WRT("Religion",$P($G(VADM(9)),"^",2),"Sex",$P($G(VADM(5)),"^",2),1)
  1. D RACE^GMTSDEM2 I VAPD(6)'="" D Q:$D(GMTSQIT)
  1. . D WRT("Occupation",$P($G(VAPD(6)),"^",1),,,1)
  1. Q
  1. SVC ; Service
  1. Q:$D(GMTSQIT) N %,%H,VAEL,VAERR D ELIG^VADPT
  1. I $P(VAEL(2),"^",1) D Q:$D(GMTSQIT)
  1. . D WRT("Period of Service",$P($G(VAEL(2)),"^",2),,,1)
  1. Q
  1. BOS ; Branch of Service
  1. Q:$D(GMTSQIT) N %,%H,VAEL,VAERR,VASV,GMTSI,FROM,TO
  1. D SVC^VADPT F GMTSI=6,7,8 D
  1. . Q:'$D(VASV(GMTSI)) Q:+(VASV(GMTSI))=0
  1. . S FROM=$$EDT^GMTSU($P(VASV(GMTSI,4),U,1))
  1. . S TO=$$EDT^GMTSU($P(VASV(GMTSI,5),U,1))
  1. . S:$L(FROM)&('$L(TO)) TO="UNKNOWN"
  1. . D:GMTSI=6 WRT("Branch of Service",($P(VASV(GMTSI,1),U,2)_" "_FROM_" TO "_TO),,,1)
  1. . D:GMTSI'=6 WRT("",($P(VASV(GMTSI,1),U,2)_" "_FROM_" TO "_TO),,,1)
  1. Q
  1. COMB ; Service Connected Disabilities
  1. Q:$D(GMTSQIT) N %,%H,VAEL,VAERR,VASV D ELIG^VADPT,SVC^VADPT
  1. I $P(VAEL(2),U) D Q:$D(GMTSQIT)
  1. . D WRT("Combat",$S(VASV(5):"YES",1:"NO"),"POW",$S(VASV(4):"YES",1:"NO"),1)
  1. Q
  1. ELIG ; Eligibility
  1. Q:$D(GMTSQIT) N Z,I,%,%H,VAEL,VAERR D ELIG^VADPT
  1. I $P(VAEL(1),"^",1) D Q:$D(GMTSQIT)
  1. . D WRT("Eligibility",$P(VAEL(1),"^",2),$S(VAEL(8)'="":"Status",1:""),$P(VAEL(8),"^",2),1)
  1. I $O(VAEL(1,0)) D Q:$D(GMTSQIT)
  1. . S I=0 F Z=0:0 D Q:$D(GMTSQIT) Q:I=""
  1. . . Q:$D(GMTSQIT) S I=$O(VAEL(1,I)) Q:I=""
  1. . . D WRT("",$P(VAEL(1,I),"^",2),,,1)
  1. Q
  1. SC ; Service Connected Percent
  1. Q:$D(GMTSQIT) N %,%H,VAEL,VAERR D ELIG^VADPT
  1. D:VAEL(3) WRT("S/C %",$P(VAEL(3),"^",2),,,1)
  1. Q
  1. SCDD ; Service Connected Disabilities/Diagnosis
  1. Q:$D(GMTSQIT) N SCD,SCDP,SCDS,IX,GMTSC S (IX,GMTSC)=0
  1. F S IX=$O(^DPT(DFN,.372,IX)) Q:$D(GMTSQIT) Q:+IX=0 D SCDP Q:$D(GMTSQIT)
  1. Q
  1. SCDP ; Service Connected Diagnosis
  1. Q:$D(GMTSQIT) N SCD,SCDS,SCDP S SCD=^DPT(DFN,.372,IX,0)
  1. S SCDS=$S($P(SCD,"^",1):$P(^DIC(31,$P(SCD,"^",1),0),"^",1),1:"")
  1. S SCDP=$P(SCD,"^",2)_"% "_$S($P(SCD,"^",3):"SC",1:"")
  1. S GMTSC=+($G(GMTSC))+1
  1. I +($G(GMTSC))'>1 D Q:$D(GMTSQIT)
  1. . S STR=" S/C Disabilities: "_SCDS,STR=STR_$J("",(61-$L(STR)))_SCDP
  1. . D WRT(STR,,,,0)
  1. I +($G(GMTSC))>1 D
  1. . S STR=$J("",21)_SCDS,STR=STR_$J("",(61-$L(STR)))_SCDP
  1. . D WRT(STR,,,,0)
  1. Q
  1. MT ; Means Test
  1. Q:$D(GMTSQIT) N %,%H,VAEL,VAERR D ELIG^VADPT
  1. D:VAEL(9)'="" WRT("Means Test",$P(VAEL(9),"^",2),,,1)
  1. Q
  1. NOK ; Next of Kin
  1. Q:$D(GMTSQIT) N %,%H,VAOA S VAOA("A")=1 D OAD^VADPT
  1. Q:VAOA(9)="" I VAOA(9)'="" D Q:$D(GMTSQIT)
  1. . D CKP^GMTSUP Q:$D(GMTSQIT)
  1. . W ?16,"NOK: ",VAOA(9)
  1. . W:VAOA(10)'="" ?51,"Relation: ",VAOA(10) W !
  1. I VAOA(1)'="" D Q:$D(GMTSQIT)
  1. . D CKP^GMTSUP Q:$D(GMTSQIT)
  1. . W:VAOA(1)]"" ?21,VAOA(1)
  1. . W:VAOA(8)'="" ?54,"Phone: ",VAOA(8) W !
  1. I VAOA(2)'="" D Q:$D(GMTSQIT)
  1. . D CKP^GMTSUP Q:$D(GMTSQIT) W ?21,VAOA(2),!
  1. I VAOA(3)'="" D Q:$D(GMTSQIT)
  1. . D CKP^GMTSUP Q:$D(GMTSQIT) W ?21,VAOA(3),!
  1. I VAOA(4)'="" D Q:$D(GMTSQIT)
  1. . D CKP^GMTSUP Q:$D(GMTSQIT)
  1. . W ?21,VAOA(4) W:VAOA(5) ", ",$P(VAOA(5),U,2)
  1. . W:VAOA(6) " ",VAOA(6) W !
  1. Q
  1. IEN ; Ineligible for Care Data
  1. Q:$D(GMTSQIT) N STR,REM,WRD,%,%H,VAEL,VAERR,GMTSDT D ELIG^VADPT
  1. I +($P(VAEL(5,1),U,1))>0 D
  1. . S GMTSDT=$$EDT^GMTSU($P(VAEL(5,1),U,1))
  1. . Q:$D(GMTSQIT) D WRT("Ineligible date",GMTSDT,,,1)
  1. . Q:$D(GMTSQIT) S STR=$P(VAEL(5,2),U,2)_" "_VAEL(5,3)_", "_$P(VAEL(5,4),U,2)
  1. . D WRT("Inelig. TWX source",STR,,,1)
  1. . Q:$D(GMTSQIT) S STR=$G(VAEL(5,5))
  1. . F WRD=1:1 Q:$L(STR)'>58 D
  1. . . S REM=$P(STR," ",($L(STR," ")-WRD),$L(STR," "))
  1. . . S STR=$P(STR," ",1,($L(STR," ")-(WRD+1)))
  1. . D:$L(STR) WRT(($J("",21)_STR),,,,0)
  1. . D:$L(REM) WRT(($J("",21)_REM),,,,0)
  1. . D:$L(VAEL(5,6)) WRT("Reason",$E(VAEL(5,6),1,58),,,1)
  1. Q
  1. ;
  1. WRT(CH1,CD1,CH2,CD2,FMT) ; Write/Save Demographic Line
  1. ;
  1. ; Input
  1. ; CH1 - Column 1 Header or Preformated Line
  1. ; CD1 - Column 1 Data
  1. ; CH2 - Column 2 Header
  1. ; CD2 - Column 2 Data
  1. ; FMT - Format in Columns 1=Yes 0=No
  1. ;
  1. ; If the variable GMTSDEMX exist, then the data will
  1. ; be saved in a global array instead of written to the
  1. ; screen. Global array:
  1. ;
  1. ; ^TMP("GMTSDEMO",$J,DFN,#)=<demographic text>
  1. Q:$D(GMTSQIT) N STR,BL,COL1,COL2,LN,LNLGTH
  1. S LN=+($O(^TMP("GMTSDEMO",$J,+($G(DFN))," "),-1))+1,CH1=$G(CH1),CD1=$G(CD1),CH2=$G(CH2),CD2=$G(CD2),FMT=$G(FMT)
  1. S:+FMT'>0 STR=CH1
  1. I +FMT>0 D
  1. . S LNLGTH=59
  1. . S:CH2="" LNLGTH=78
  1. . S BL=$J("",(19-$L(CH1))),CH1=BL_CH1_$S($L(CH1)>0:": ",1:" ")
  1. . S BL=$J("",(((LNLGTH-$L(CH1))-$L(CH2))-2))
  1. . S CD1=$E(CD1,1,$L(BL)),COL1=CH1_CD1
  1. . S BL=$J("",((59-$L(COL1))-$L(CH2)))
  1. . S CH2=BL_CH2_$S($L(CH2)>0:": ",1:" "),COL2=CH2_$E(CD2,1,17)
  1. . S STR=COL1_COL2
  1. I '$D(GMTSDEMX) D CKP^GMTSUP Q:$D(GMTSQIT) W $G(STR),!
  1. S:$D(GMTSDEMX) ^TMP("GMTSDEMO",$J,+($G(DFN)),LN)=STR
  1. Q
  1. ;
  1. ST ; Show ^TMP Global Array
  1. W !! N NN,NC S NN="^TMP(""GMTSDEMO"","_$J_","_+($G(DFN))_")",NC="^TMP(""GMTSDEMO"","_$J_","_+($G(DFN))_"," F S NN=$Q(@NN) Q:NN=""!(NN'[NC) W !,@NN
  1. Q
  1. END ; Clean-up and quit
  1. K I,VA,VADM,VAERR,VAOA,VASV,VAPA,VAPD,VAEL,SCD,SCDS,SCDP,FROM
  1. K GMI,TO,IX,X,Z Q