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

BHSFH1.m

Go to the documentation of this file.
BHSFH1 ; IHS/MSC/MGH - Health summary for family history   ;01-Aug-2013 17:22;DU
 ;;1.0;HEALTH SUMMARY COMONENTS;**8**;March 17, 2006;Build 22
 ;
 ;
FMH ;EP -  ******* FAMILY HISTORY * 9000014 *******
 ; <SETUP>
 ;Same as other family history but without SNOMED codes displayed
 N BHSPAT,BHSQ
 S BHSPAT=DFN
 I '$D(^AUPNFH("AC",BHSPAT)),'$D(^AUPNFHR("AA",BHSPAT)) Q  ;no family history to display
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <DISPLAY>
 K APCHTFH
 S BHSDFN=0 F  S BHSDFN=$O(^AUPNFH("AC",BHSPAT,BHSDFN)) Q:'BHSDFN  D
 .Q:'$D(^AUPNFH(BHSDFN,0))  ;bad xref
 .S R=$P(^AUPNFH(BHSDFN,0),U,9)
 .I R="" S R="Z",S=$$VAL^XBDIQ1(9000014,BHSDFN,.07),Z=S_" ",O=8 D  G FMH1
 ..I S="" S S="UNKNOWN",Z="UNKNOWN "
 .S S=$$VAL^XBDIQ1(9000014.1,R,.01),Z=S_" "_$P(^AUPNFHR(R,0),U,3)
 .S O=$P(^AUPNFHR(R,0),U) I O S O=$P($G(^AUTTRLSH(O,21)),U,3)
 .I 'O S O=8
FMH1 .S APCHTFH(O,S,Z,R,(9999999-$$LDM(BHSDFN)),BHSDFN)=""
 ;get relations with no conditions
 S X=0 F  S X=$O(^AUPNFHR("AA",BHSPAT,X)) Q:X'=+X  S Y=0 F  S Y=$O(^AUPNFHR("AA",BHSPAT,X,Y)) Q:Y'=+Y  D
 .I '$D(^AUPNFH("AE",Y)) D
 ..S R=Y
 ..S S=$$VAL^XBDIQ1(9000014.1,R,.01),Z=S_" "_$P(^AUPNFHR(R,0),U,3)
 ..S O=$P(^AUPNFHR(R,0),U) I O S O=$P($G(^AUTTRLSH(O,21)),U,3)
 ..I 'O S O=8
 ..S APCHTFH(O,S,Z,R,(9999999-$P(^AUPNFHR(R,0),U,9)),0)=""
 W "Date Last Mod",?14,"Relation/Status/Diagnosis"
 S BHO=0 F  S BHO=$O(APCHTFH(BHO)) Q:BHO'=+BHO  D FMH2
FMHX K BHSDFN,BHSN,BHSICD,BHSDAT,BHSNRQ,BHSICL,BHSDFN,APCHTFH,BHS,BHZ,BHR,BHD,BHO
 K BHC,BHIEN,BHSIVD,BHSTAT,BHTD,BHTDAT,A,T,N,O,P,R,S,X,Y,Z
 Q
LDM(I) ;get last date modified of Family History or relation
 I $G(I)="" Q ""
 I '$D(^AUPNFH(I,0)) Q ""
 NEW J,D,E
 S D=""
 S J=$P(^AUPNFH(I,0),U,9) I J S D=$P($G(^AUPNFHR(J,0)),U,9) I D="" S D=$P($G(^AUPNFHR(J,0)),U,9)
 S E=$P(^AUPNFH(I,0),U,12) I E>D S D=E
 S E=$P(^AUPNFH(I,0),U,3) I E>D S D=E
 Q D
FMH2 ;
 S BHS="",BHC=0 F  S BHS=$O(APCHTFH(BHO,BHS)) Q:BHS=""!($D(GMTSQIT))  D
 .S BHZ="" F  S BHZ=$O(APCHTFH(BHO,BHS,BHZ)) Q:BHZ=""!($D(GMTSQIT))  D
 ..S BHR="" F  S BHR=$O(APCHTFH(BHO,BHS,BHZ,BHR)) Q:BHR=""!($D(GMTSQIT))  D
 ...S BHTD=$O(APCHTFH(BHO,BHS,BHZ,BHR,0)),BHTD=(9999999-BHTD) S X=BHTD D REGDT4^GMTSU S BHTDAT=X S:BHTDAT="/" BHTDAT=""
 ...S BHD="",BHC=0 F  S BHD=$O(APCHTFH(BHO,BHS,BHZ,BHR,BHD)) Q:BHD=""!($D(GMTSQIT))  D
 ....S BHSDFN="" F  S BHSDFN=$O(APCHTFH(BHO,BHS,BHZ,BHR,BHD,BHSDFN)) Q:BHSDFN=""!($D(GMTSQIT))  D FHDSP
 ;S APCHSDFN="" F APCHSQ=0:0 S APCHSDFN=$O(^AUPNFH("AC",APCHSPAT,APCHSDFN)) Q:APCHSDFN=""  D FHDSP
 ; <CLEANUP>
 Q
FHDSP S BHC=BHC+1
 I BHC=1 W !,BHTDAT,?14,BHZ,"  Status: "
 S BHSTAT=""
 I 'BHR,BHSDFN D
 .S BHSTAT=$S($P(^AUPNFH(BHSDFN,0),U,6)]"":$$VAL^XBDIQ1(9000014,BHSDFN,.06),1:"None")
 I BHR S BHSTAT=$S($P($G(^AUPNFHR(BHR,0)),U,4)]"":$$VAL^XBDIQ1(9000014.1,BHR,.04),1:"None")
 I BHC=1 W BHSTAT,!
 I BHR,$P(^AUPNFHR(BHR,0),U,5)]""!($P(^AUPNFHR(BHR,0),U,6)]"") D
 .I BHC=1 W ?14,"Age at Death: ",$$VAL^XBDIQ1(9000014.1,BHR,.05),"  Cause of Death: ",$S($P(^AUPNFHR(BHR,0),U,6)]"":$P(^AUPNFHR(BHR,0),U,6),1:"Data Not Available"),!
 I BHR,$P(^AUPNFHR(BHR,0),U,7)]""!($P(^AUPNFHR(BHR,0),U,8)]"") D
 .I BHC=1 W ?14,"Multiple Birth: "_$$VAL^XBDIQ1(9000014.1,BHR,.07)_$S($P(^AUPNFHR(BHR,0),U,7)="Y":"  Multiple Birth Type: "_$$VAL^XBDIQ1(9000014.1,BHR,.08),1:""),! ;_"  Date Updated: "_$$VAL^XBDIQ1(9000014.1,R,.09)
 Q:'BHSDFN
 S BHSN=^AUPNFH(BHSDFN,0)
 S BHSICD=$P(BHSN,U,1) D GETICDDX^BHSUTL
 ;S Y=$P(APCHSN,U,3) X APCHSCVD S APCHSDAT=Y
 S BHSNRQ=$P(BHSN,U,4)
 D GETNARR^BHSUTL
 D CKP^GMTSUP Q:$D(GMTSQIT)  ;  W !,APCHSDAT
 S (X,R,S,N,A,P)=""
 ;S R=$$VAL^XBDIQ1(9000014,BHSDFN,.07)
 ;S BHSNRQ=BHSNRQ_" ("_$$VAL^XBDIQ1(9000014,BHSDFN,.01)_")"
 S A="" I BHSDFN S A=$$VAL^XBDIQ1(9000014,BHSDFN,.11) I A="" S A=$$VAL^XBDIQ1(9000014,BHSDFN,.05)
 ;S S=$$VAL^XBDIQ1(9000014,APCHSDFN,.06)
 ;S P=$$VAL^XBDIQ1(9000014,APCHSDFN,.08)
 ;S X=R
 ;I X]"" S X=X_"; "
 S X=BHSNRQ
 S X=X_$S(A]"":"; Age at Onset: "_A,1:"; Age at Onset: None")
 ;S X=X_$S(S]"":"; Status: "_S,1:"; Status: None")
 ;S X=X_$S(P]"":"; Documented By: "_P,1:"")
 S BHSICL=14,BHSNRQ=X
 D PRTICD^BHSUTL
 Q
 ;
PWH ;EP - called from component Patient wellness Handout
 ; <SETUP>
 N BHSPAT
 S BHSPAT=DFN
 D CKP^GMTSUP Q:$D(GMTSQIT)
 ; <DISPLAY>
 K BHTFH
 S BHSIVD="" F  S BHSIVD=$O(^APCHPWHL("AA",BHSPAT,BHSIVD)) Q:BHSIVD=""!(BHSIVD>GMTSDLM)  D
 .S BHIEN=0 F  S BHIEN=$O(^APCHPWHL("AA",BHSPAT,BHSIVD,BHIEN)) Q:BHIEN'=+BHIEN  D
 ..S BHSN=$G(^APCHPWHL(BHIEN,0))
 ..I BHSN="" Q
 ..S N=$$VAL^XBDIQ1(9001027,BHIEN,.02)
 ..S $P(BHTFH(N),U)=$P($G(BHTFH(N)),U)+1
 ..S P=$P(BHTFH(N),U)+1
 ..S $P(BHTFH(N),U,P)=$$DATE^BHSMU($P(^APCHPWHL(BHIEN,0),U,4))
 ;now display
 I '$D(BHTFH) W "No Patient Wellness Handouts given to this patient.",! Q
 W ?2,"PATIENT WELLNESS HANDOUT TYPE",?34,"# given",?42,"Dates Last 4 Given to Patient",!
 W $$REPEAT^XLFSTR("-",79),!
 S BHSN="" F  S BHSN=$O(BHTFH(BHSN)) Q:BHSN=""!($D(GMTSQIT))  D
 .W ?2,BHSN,?34,$P(BHTFH(BHSN),U) W ?42,$P(BHTFH(BHSN),U,2)," ",$P(BHTFH(BHSN),U,3)," ",$P(BHTFH(BHSN),U,4)," ",$P(BHTFH(BHSN),U,5),!
 .Q
 K BHTFH,BHSN
 Q