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

APCHS4A.m

Go to the documentation of this file.
APCHS4A ; IHS/CMI/LAB - PART 4A OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
HFACT ; ******************** HEALTH FACTORS * 9000019 *********
 ; <SETUP>
 Q:'$D(^AUPNVHF("AC",APCHSPAT))
 S APCHSSNM=APCHSNDM,APCHSSDM=APCHSDLM
 X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK
 ; <DISPLAY>
 S APCHSHP=0
 I $O(^APCHSCTL(APCHSTYP,7,0)) D
 . S APCHSHFS="" F  S APCHSHFS=$O(^APCHSCTL(APCHSTYP,7,"B",APCHSHFS)) Q:'APCHSHFS  D
 .. S APCHSHFI="" F  S APCHSHFI=$O(^APCHSCTL(APCHSTYP,7,"B",APCHSHFS,APCHSHFI)) Q:'APCHSHFI  D
 ... S APCHSN=^APCHSCTL(APCHSTYP,7,APCHSHFI,0) S APCHSFC=$P(APCHSN,U,2),APCHSFT=$P(APCHSN,U,3),APCHSFD=$P(APCHSN,U,4) D ONECAT
 . Q
 E  D
 . S APCHSFC="" F  S APCHSFC=$O(^AUTTHF("AD","C",APCHSFC)) Q:'APCHSFC  S (APCHSFT,APCHSFD)="" D ONECAT
 . Q
 ; <CLEANUP>
HFACTX K APCHSCFI,APCHSDAT,APCHSDT2,APCHSFC,APCHSFD,APCHSFDP,APCHSFN,APCHSFSS,APCHSFT,APCHSFTB,APCHSHFI,APCHSHFS,APCHSHP,APCHSI,APCHSIVD,APCHSNDT,APCHSNI,APCHSPVD,APCHSSDM,APCHSSNM,APCHSTNP,Y,X
 Q
 ;
ONECAT ;
 S:APCHSFD="" APCHSFD="Y"
 S:APCHSFT="" APCHSFT=$P(^AUTTHF(APCHSFC,0),U)
 ;W "Category=",APCHSFC," Name=",$P(^AUTTHF(APCHSFC,0),U)," Title=",APCHSFT," Display=",APCHSFD,!
 S APCHSTNP=1
 K APCHSFTB
 S APCHSCFI="" F  S APCHSCFI=$O(^AUTTHF("AC",APCHSFC,APCHSCFI)) Q:'APCHSCFI  D ONEFACT
 D DISPDATA
 Q
ONEFACT ;
 S APCHSN=^AUTTHF(APCHSCFI,0),APCHSFN=$P(APCHSN,U)
 ;W ?3,APCHSN,!
 S APCHSNDM=APCHSSNM,APCHSDLM=APCHSSDM
 S APCHSPVD=0
 F APCHSIVD=0:0 S APCHSIVD=$O(^AUPNVHF("AA",APCHSPAT,APCHSCFI,APCHSIVD)) Q:APCHSIVD=""!(APCHSIVD>APCHSDLM)  D ONEDATE Q:$D(APCHSQIT)  S:(APCHSDAT'=APCHSPVD) APCHSNDM=APCHSNDM-1,APCHSPVD=APCHSDAT Q:APCHSNDM=0  Q:APCHSFD="Y"
 Q
 ;
ONEDATE ;
 S Y=-APCHSIVD\1+9999999 X APCHSCVD S APCHSDAT=Y S APCHSNDT=(APCHSDAT'=APCHSPVD)
 D:APCHSTNP TPRINT
 S APCHSNI="" F  S APCHSNI=$O(^AUPNVHF("AA",APCHSPAT,APCHSCFI,APCHSIVD,APCHSNI)) Q:'APCHSNI  D SETFACT
 Q
SETFACT S APCHSN=^AUPNVHF(APCHSNI,0)
 S APCHSFSS="" S X=$P(APCHSN,U,4) I X]"" S Y=$P(^DD(9000019,.04,0),U,3) F APCHSI=1:1:$L(Y,";") S APCHSFDP=$P(Y,";",APCHSI) I X=$P(APCHSFDP,":") S APCHSFSS=$P(APCHSFDP,":",2) Q
 S APCHSQTY=$P(APCHSN,U,6)
 S APCHSFTB(APCHSIVD,APCHSDAT_U_APCHSFN_U_APCHSFSS_U_APCHSQTY_U_$P(APCHSN,U))=""
 Q
DISPDATA ; DISPLAY TABLED DATA
 S APCHSDT2=""
 S APCHSIVD=0 F  S APCHSIVD=$O(APCHSFTB(APCHSIVD)) Q:'APCHSIVD  S APCHSN="" F  S APCHSN=$O(APCHSFTB(APCHSIVD,APCHSN)) Q:APCHSN=""  D DISP2
 Q
DISP2 ;
 S APCHSDAT=$P(APCHSN,U),APCHSFN=$P(APCHSN,U,2),APCHSFSS=$P(APCHSN,U,3)
 W:APCHSDAT'=APCHSDT2 APCHSDAT W ?10,APCHSFN W:APCHSFSS]"" " (",APCHSFSS,")" D:$P(APCHSN,U,4)]"" WQTY W !
 S APCHSDT2=APCHSDAT
 Q
WQTY ;write out quantity and phrase
 NEW X S X=$P(APCHSN,U,5) Q:'X
 S X=$P(^AUTTHF(X,0),U,11)
 I X="" S X="QUANTITY"
 S X=X_": "
 W "  ",X,$P(APCHSN,U,4)
 Q
TPRINT ; PRINT TITLE
 S APCHSTNP=0
 W !,"~~ ",APCHSFT," ~~",! ;temporary
 Q
EDUCASSE ;EP - called from component educational assessment
 X APCHSCKP Q:$D(APCHSQIT)  X:'APCHSNPG APCHSBRK
 W !,"Most recent Health Factor recorded.",!
 W !,"   Learning Preference:  ",$$LASTHF^APCHSMU(APCHSPAT,"LEARNING PREFERENCE","B"),!
 ;X APCHSCKP Q:$D(APCHSQIT)
 ;W !,"    Readiness to Learn:  ",$$LASTHF^APCHSMU(APCHSPAT,"READINESS TO LEARN","B"),!
 X APCHSCKP Q:$D(APCHSQIT)
 W !,"  Barriers to Learning:  "
 S C=$O(^AUTTHF("B","BARRIERS TO LEARNING",0)) ;ien of category passed
 I '$G(C) Q
 S H=0 K APCHO
 F  S H=$O(^AUTTHF("AC",C,H))  Q:'+H  D
 .  Q:'$D(^AUPNVHF("AA",APCHSPAT,H))
 .  S D=$O(^AUPNVHF("AA",APCHSPAT,H,""))
 .  Q:'D
 .  S APCHO(H,D)=$O(^AUPNVHF("AA",APCHSPAT,H,D,""))
 .  Q
 S APCHX="" F  S APCHX=$O(APCHO(APCHX)) Q:APCHX=""!($D(APCHSQIT))  D
 .S D=$O(APCHO(APCHX,0))
 .X APCHSCKP Q:$D(APCHSQIT)
 .W ?25,$$VAL^XBDIQ1(9000010.23,APCHO(APCHX,D),.01)_"  "_$$FMTE^XLFDT((9999999-D)),!
 Q