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

AGGPTRGO.m

Go to the documentation of this file.
  1. AGGPTRGO ;VNGT/HS/BEE-Other Patient Data Triggers ; 09 Apr 2010 7:57 AM
  1. ;;1.0;PATIENT REGISTRATION GUI;;Nov 15, 2010
  1. ;
  1. Q
  1. ;
  1. INIT(DATA,DFN) ; EP -- AGG OTHER PATIENT INIT TRG
  1. ; Input
  1. ; DFN - Patient IEN
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGGECREL,VISIBLE,EFND,EIEN,VAR,LIEN,LDT,AGOPT,HDR,HIN
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Method of Collection (disabled if Ethnicity is blank)
  1. I $$ETHN^AGGPTDMG(DFN,.01)="" S SOURCE="AGMETH",ABLE="N",TYPE="T",CLEAR="",CLFLAG="",VALUE="",HELP="",REQ="O",VISIBLE="" D UP
  1. ;
  1. ;Other Languages
  1. S SOURCE="OTHLNG",ABLE="Y",TYPE="M",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. ;Interpreter Required? (disabled if Primary Language is English)
  1. I $$MUL^AGGWDISP(DFN,9000001,8601,.02,"E")="ENGLISH" S SOURCE="AGGINTRP",ABLE="N",TYPE="C",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="",CLFLAG="",CLFLAG="" D UP
  1. ;
  1. ;English Proficiency (disabled if Primary Language or Other Languages not English)
  1. S LIEN="",LDT=$O(^AUPNPAT(DFN,86,"B",""),-1)
  1. I LDT]"" S LIEN=$O(^AUPNPAT(DFN,86,"B",LDT,""),-1)
  1. D GETS^DIQ(9000001.86,LIEN_","_DFN_",",".05*","E","VAR") ;Pull Other Languages
  1. S EFND=0,EIEN="" F S EIEN=$O(VAR(9000001.8605,EIEN)) Q:EIEN="" I $G(VAR(9000001.8605,EIEN,".01","E"))="ENGLISH" S EFND=1 Q
  1. I $$MUL^AGGWDISP(DFN,9000001,8601,.02,"E")'="ENGLISH",EFND=0 S SOURCE="AGGLGEPF",ABLE="N",TYPE="C",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP ;NEED TO ADD IN CHECK FOR OTHER LANGUAGE
  1. ;
  1. ;Migrant Worker Type (disabled if Migrant Status is not 'Yes')
  1. I $$MUL^AGGWDISP(DFN,9000001,8401,.02,"I")'="Y" S SOURCE="AGGMGTYP",ABLE="N",TYPE="C",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. ;Homeless Type (disabled if Homeless Status is not 'Yes')
  1. I $$MUL^AGGWDISP(DFN,9000001,8501,.02,"I")'="Y" S SOURCE="AGGHMTYP",ABLE="N",TYPE="C",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. ;Household Income
  1. S HIN=$$GET1^DIQ(9000001,DFN_",",.36,"E") I HIN>0 S HIN=$$NUMB(HIN),SOURCE="AGGTHINC",ABLE="Y",TYPE="T",CLEAR="",VALUE=HIN,HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. ;Household Income Period
  1. I $$GET1^DIQ(9000001,DFN_",",.36,"E")'>0 S SOURCE="AGGHINP",ABLE="N",TYPE="C",CLEAR="",VALUE="",HELP="",REQ="O",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. ;Enable Internet Access Where Field
  1. I $$MUL^AGGWDISP(DFN,9000001,8101,.02,"I")=1 S SOURCE="AGGWEBF",VALUE="",HELP="",ABLE="Y",REQ="O",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="",CLFLAG="" D UP
  1. I $$MUL^AGGWDISP(DFN,9000001,8101,.02,"I")'=1 S SOURCE="AGGWEBF",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="AGGWEBF",CLFLAG="Y",TYPE="C",VISIBLE="",CLFLAG="" D UP
  1. ;
  1. D ^AGVAR
  1. I AGOPT(22)="N" D
  1. . S SOURCE="AGRACE",VALUE=$$RCE^AGGPTDMG(DFN,.01),ABLE="N",TYPE="T",CLEAR="",HELP="",REQ="O",VISIBLE="N",CLFLAG="" D UP
  1. . S SOURCE="AGGTHNUM",VALUE=$$GET1^DIQ(9000001,DFN_",",.35,"E"),ABLE="N",TYPE="X",CLEAR="",HELP="",REQ="O",VISIBLE="N",CLFLAG="" D UP
  1. . S SOURCE="AGGTHINC",VALUE=$$GET1^DIQ(9000001,DFN_",",.36,"E"),ABLE="N",TYPE="X",CLEAR="",HELP="",REQ="O",VISIBLE="N",CLFLAG="" D UP
  1. . S SOURCE="AGGHINP",VALUE=$$GET1^DIQ(9000001,DFN_",",8701,"E"),ABLE="N",TYPE="C",CLEAR="",HELP="",REQ="O",VISIBLE="N",CLFLAG="" D UP
  1. ;
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. ETH(DATA,AGETH) ; EP -- AGG OTH PAT ETH TRG
  1. ; Input
  1. ; DFN - Patient IEN
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGGECREL,HDR
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Enable Method of Collection
  1. I $G(AGETH)]"" S SOURCE="AGMETH",VALUE="",HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="T",VISIBLE="" D UP
  1. I $G(AGETH)="" S SOURCE="AGMETH",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="",CLFLAG="",TYPE="T",VISIBLE="" D UP
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. PLNG(DATA,AGGLGPRI,AGGINTRP,AGGLGEPF,OTHLNG) ; EP -- AGG OTH PAT PRM TRG
  1. ; Input
  1. ; DFN - Patient IEN
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,AGGECREL,AGGLGOTH,BQ,ENGIEN,EFND,HDR
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Determine the English IEN
  1. S ENGIEN=$O(^AUTTLANG("B","ENGLISH",""))
  1. ;
  1. ;Parse Other Language Multiple
  1. S AGGLGOTH="",EFND=0
  1. F BQ=1:1:$L(OTHLNG,$C(28)) D
  1. . N PDATA,NAME,VALUE,BP,BV
  1. . S PDATA=$P(OTHLNG,$C(28),BQ) Q:PDATA=""
  1. . S NAME=$P(PDATA,"=",1)
  1. . S VALUE=$P(PDATA,"=",2,99) Q:VALUE=""
  1. . F BP=1:1:$L(VALUE,$C(29)) S BV=$P(VALUE,$C(29),BP),@NAME=$G(@NAME)_$S(BP=1:"",1:$C(29))_BV
  1. ;
  1. ;Look for English in the Other Languages
  1. I AGGLGOTH]"" D
  1. . N I,VAL,CVAL
  1. . S CVAL="" F I=1:1:$L(AGGLGOTH,$C(29)) S CVAL=$P($G(AGGLGOTH),$C(29),I) I CVAL]"",CVAL=ENGIEN S EFND=1
  1. ;
  1. ;Enable/Disable Interpreter Required
  1. I $G(AGGLGPRI)]"",AGGLGPRI'=ENGIEN D
  1. . S SOURCE="AGGINTRP",VALUE=$G(AGGINTRP),HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="T",VISIBLE="" D UP
  1. I $G(AGGLGPRI)]"",AGGLGPRI=ENGIEN D
  1. . S SOURCE="AGGINTRP",VALUE="",HELP="",ABLE="N",REQ="R",CLEAR="",CLFLAG="",TYPE="T",VISIBLE="" D UP
  1. ;
  1. ;Enable/Disable English Proficiency
  1. I (($G(AGGLGPRI)="")!(($G(AGGLGPRI)]"")&(AGGLGPRI'=ENGIEN)))&(EFND=0) D
  1. . S SOURCE="AGGLGEPF",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. I ($G(AGGLGPRI)]""&(AGGLGPRI=ENGIEN))!(EFND=1) D
  1. . S SOURCE="AGGLGEPF",VALUE=$G(AGGLGEPF),HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. ;
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. MSTS(DATA,AGGMGSTS,AGGMGTYP) ; EP -- AGG MIGRNT TRIGGER
  1. ; Input
  1. ; AGGMGSTS - Migrant Status (Y/N)
  1. ; AGGMGTYP - Migrant Type (S/M)
  1. ;
  1. NEW UID,II,VALUE,SOURCE,HELP,TYPE,ABLE,REQ,CLEAR,CLFLAG,HDR
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Enable Migrant Type Field
  1. I $G(AGGMGSTS)="Y" S SOURCE="AGGMGTYP",VALUE=$G(AGGMGTYP),HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. I $G(AGGMGSTS)'="Y" S SOURCE="AGGMGTYP",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. HSTS(DATA,AGGHMSTS,AGGHMTYP) ; EP -- AGG HOMELESS TRIGGER
  1. ; Input
  1. ; AGGHMSTS - Homeless Status (Y/N)
  1. ; AGGHMTYP - Homeless Type (H/T/D/S/U)
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,REQ,CLEAR,CLFLAG,HDR
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Enable Homeless Type Field
  1. I $G(AGGHMSTS)="Y" S SOURCE="AGGHMTYP",VALUE=$G(AGGHMTYP),HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. I $G(AGGHMSTS)'="Y" S SOURCE="AGGHMTYP",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. HINC(DATA,AGGHINC,AGGHINP) ; EP -- AGG HSHLD INCOME TRIGGER
  1. ; Input
  1. ; AGGHINC - Household Income
  1. ; AGGHINP - Household Income Period (Y/M/W/B)
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,REQ,CLEAR,CLFLAG,HDR,HIN
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Add comma to Household Income
  1. I $TR($G(AGGHINC),",")>0 S HIN=$$NUMB(AGGHINC),SOURCE="AGGTHINC",ABLE="Y",TYPE="T",CLEAR="",VALUE=HIN,HELP="",REQ="O",VISIBLE="" D UP
  1. ;
  1. ;Enable Household Income Period Field
  1. I $TR($G(AGGHINC),",")>0 S SOURCE="AGGHINP",VALUE="",HELP="",ABLE="Y",REQ="R",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. I $TR($G(AGGHINC),",")'>0 S SOURCE="AGGHINP",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="",CLFLAG="",TYPE="C",VISIBLE="" D UP
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. INTR(DATA,AGGINTNT,AGGWEBF) ; EP -- AGG INTERNET ACCESS TRIGGER
  1. ; Input
  1. ; AGGINTNT - Internet Access (Y/N)
  1. ; AGGWEBF - Access Internet From (H/W/S/HC/L/T/M)
  1. ;
  1. NEW UID,II,VALUE,SOURCE,IEN,HELP,TYPE,ABLE,REQ,CLEAR,CLFLAG,HDR
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("AGGPTRGO",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^AGGPTRGO D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. D HDR
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. ;Enable Internet Access Where Field
  1. I $G(AGGINTNT)=1 S SOURCE="AGGWEBF",VALUE="",HELP="",ABLE="Y",REQ="O",CLEAR="",CLFLAG="N",TYPE="C",VISIBLE="" D UP
  1. I $G(AGGINTNT)'=1 S SOURCE="AGGWEBF",VALUE="",HELP="",ABLE="N",REQ="O",CLEAR="AGGWEBF",CLFLAG="Y",TYPE="C",VISIBLE="" D UP
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. ERR ;
  1. D ^%ZTER
  1. NEW Y,ERRDTM
  1. S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
  1. S BMXSEC="Recording that an error occurred at "_ERRDTM
  1. I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. UP ;
  1. S II=II+1,@DATA@(II)=SOURCE_U_TYPE_U_VALUE_U_ABLE_U_$G(CLEAR)_U_HELP_U_REQ_U_$G(VISIBLE)_U_$G(CLFLAG)_$C(30)
  1. Q
  1. ;
  1. NUMB(X) ;Format number with commas
  1. N Y,I
  1. S X=$TR(X,",")
  1. I X'?4N.N Q X
  1. S Y=""
  1. F I=0:1:($L(X)-1) S Y=$E(X,$L(X)-I)_$S(((I>0)&(I#3=0)):",",1:"")_Y
  1. Q Y
  1. ;
  1. HDR ;
  1. S HDR="T00008SOURCE^T00001CODE_TYPE^T01024PARMS^T00001ABLE_FLAG^T00100CLEAR_FIELDS^T00200HELP_TEXT^T00001REQ_OPT^T00001VISIBLE^T00001CLEAR_FLAG"
  1. Q