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

BQIPTFHD.m

Go to the documentation of this file.
BQIPTFHD ;VNGT/HS/ALA-Family History Detail ; 12 Sep 2008  12:30 PM
 ;;2.4;ICARE MANAGEMENT SYSTEM;;Apr 01, 2015;Build 41
 ;
 Q
 ;
EN(DATA,DFN) ; EP -- BQI PAT FAM HISTORY DETAIL
 ;
 ;Description - all the family history that a patient has
 ;
 ;Input Parameters
 ;  DFN - Patient internal entry number
 ;Parameters
 ;  
 NEW UID,II,IEN,DIAG,NARR,RELAT,AGE,STAT,DTMNT,PROV,RELN,RELT,STC,STT,PRVR,PRVN,NIEN
 NEW ARRAY,CIEN,RIEN,AGC,FHXDTLM,RORD,ORD,PROV,AGDTH,AGEDT,CASDTH,DIEN,FLD,MLTB,MLTBT
 NEW MULT,MULTYP,NARRT,PRV,RELD,RELNM,FAM
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTFHD",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTFHD D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010FHXIEN^I00010FHXRIEN^T00060FHXRLTN^T00030FHXREL^T00060FHXDXN^T00080DXNARR^"
 S @DATA@(II)=@DATA@(II)_"T00020FHXAGE^T00020FHXSTAT^D00030FHXDTNT^T00100APCDTNQ^T00050FHXPROV^"
 S @DATA@(II)=@DATA@(II)_"T00015FHXAAD^T00060FHXCDTH^T00010FHXMBRTH^T00020FHXMBTY^D00015FHXDTLM"_$C(30)
 S CIEN=""
 F  S CIEN=$O(^AUPNFH("AC",DFN,CIEN)) Q:CIEN=""  D
 . S DTMNT=$$GET1^DIQ(9000014,CIEN_",",.03,"I")
 . S DIEN=$$GET1^DIQ(9000014,CIEN_",",.01,"I") I DIEN="" Q
 . I $$VERSION^XPDUTL("BCSV") S DIAG=$$ICD9^BQIUL3(DIEN,DTMNT,2)_"-"_$$ICD9^BQIUL3(DIEN,DTMNT,4) ; csv
 . I '$$VERSION^XPDUTL("BCSV") S DIAG=$$GET1^DIQ(80,DIEN_",",.01,"E")_"-"_$$GET1^DIQ(80,DIEN_",",3,"E")
 . S DIAG=DIEN_$C(28)_DIAG
 . S NARR=$$GET1^DIQ(9000014,CIEN_",",.04,"E")
 . S NIEN=$$GET1^DIQ(9000014,CIEN_",",.04,"I")
 . I $$PATCH^XPDUTL("BJPC*2.0*10") S NARR=$$PNPROB^AUPNVUTL(NIEN)
 . S NARRT="" I NIEN'="" S NARRT=NIEN_$C(28)_NARR
 . S FLD=.11,AGC=$$GET1^DIQ(9000014,CIEN_",",FLD,"I")
 . I AGC=FLD S AGC=""
 . S AGE="" I AGC'="" S AGE=AGC_$C(28)_$$GET1^DIQ(9000014,CIEN_",",.11,"E")
 . S FLD=.09,RIEN=$$GET1^DIQ(9000014,CIEN_",",.09,"I")
 . I RIEN=FLD S RIEN=""
 . I RIEN'="" S FAM(RIEN)=""
 . D GFAM
 . S PRV=$$GET1^DIQ(9000014,CIEN_",",.08,"I")
 . S PROV="" I PRV'="" S PROV=PRV_$C(28)_$$GET1^DIQ(9000014,CIEN_",",.08,"E")
 . S ARRAY(RORD,RELNM,CIEN)=CIEN_U_RIEN_U_RELAT_U_RELD_U_DIAG_U_NARR_U_AGE_U_STAT_U_$$FMTE^BQIUL1(DTMNT)_U_NARRT_U_PROV_U_AGEDT_U_CASDTH_U_MULT_U_MULTYP_U_$$FMTE^BQIUL1(FHXDTLM)_$C(30)
 . ;
 S CIEN=""
 F  S CIEN=$O(^AUPNFHR("AA",DFN,CIEN)) Q:'CIEN  S RIEN="" D
 . F  S RIEN=$O(^AUPNFHR("AA",DFN,CIEN,RIEN)) Q:RIEN=""  D
 .. I $D(FAM(RIEN)) Q
 .. ; For family without diagnoses search FAMILY HISTORY FAMILY MEMBERS file
 .. D GFAM
 .. S ARRAY(RORD,RELNM,"R"_RIEN)=U_RIEN_U_RELAT_U_RELD_U_U_U_U_STAT_U_U_U_U_AGEDT_U_CASDTH_U_MULT_U_MULTYP_U_$$FMTE^BQIUL1(FHXDTLM)_$C(30)
 S ORD=""
 F  S ORD=$O(ARRAY(ORD)) Q:ORD=""  D
 . S RELNM=""
 . F  S RELNM=$O(ARRAY(ORD,RELNM)) Q:RELNM=""  D
 .. S IEN=""
 .. F  S IEN=$O(ARRAY(ORD,RELNM,IEN)) Q:IEN=""  D
 ... S II=II+1,@DATA@(II)=ARRAY(ORD,RELNM,IEN)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
GFAM ; Get family history family members data
 S RELN=$$GET1^DIQ(9000014.1,RIEN_",",.01,"I")
 S RORD=$$GET1^DIQ(9999999.36,RELN_",",2103,"E") S:RORD="" RORD="~"
 S RELT=$$GET1^DIQ(9000014.1,RIEN_",",.01,"E")
 S RELNM=RELT S:RELNM="" RELNM="~"
 S RELD=$$GET1^DIQ(9000014.1,RIEN_",",.03,"E")
 S RELAT="" I RELN'="" S RELAT=RELN_$C(28)_RELT
 S STC=$$GET1^DIQ(9000014.1,RIEN_",",.04,"I")
 S STAT="" I STC'="" S STAT=STC_$C(28)_$$GET1^DIQ(9000014.1,RIEN_",",.04,"E")
 S FHXDTLM=$$GET1^DIQ(9000014.1,RIEN_",",.09,"I")
 S MLTB=$$GET1^DIQ(9000014.1,RIEN_",",.07,"I")
 S MULT="" I MLTB'="" S MULT=MLTB_$C(28)_$$GET1^DIQ(9000014.1,RIEN_",",.07,"E")
 S AGDTH=$$GET1^DIQ(9000014.1,RIEN_",",.05,"I")
 S AGEDT="" I AGDTH'="" S AGEDT=AGDTH_$C(28)_$$GET1^DIQ(9000014.1,RIEN_",",.05,"E")
 S CASDTH=$$GET1^DIQ(9000014.1,RIEN_",",.06,"E")
 S MLTBT=$$GET1^DIQ(9000014.1,RIEN_",",.08,"I")
 S MULTYP="" I MLTBT'="" S MULTYP=MLTBT_$C(28)_$$GET1^DIQ(9000014.1,RIEN_",",.08,"E")
 Q