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

BHSPLST.m

Go to the documentation of this file.
BHSPLST ;IHS/MSC/MGH  - Health Summary for Problem list;04-Jan-2016 10:26;DU
 ;;1.0;HEALTH SUMMARY COMPONENTS;**13**;Mar 17,2006;Build 6
 ; IHS/CMI/LAB - PART 4 OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;31-Mar-2014 16:53;DU
 ;
PROBST ;EP - problems by status
 NEW BHPBST,BHST
 S BHSTAT="AEOS"
 S BHSPAT=DFN
 S BHSNDF=0
 S BHSFAC="" F BHSQ=0:0 S BHSFAC=$O(^AUPNPROB("AA",BHSPAT,BHSFAC)) Q:'BHSFAC  D
 .S BHSPRB="" F BHSQ=0:0 S BHSPRB=$O(^AUPNPROB("AA",BHSPAT,BHSFAC,BHSPRB)) Q:BHSPRB=""  D
 ..S BHSDFN=$O(^AUPNPROB("AA",BHSPAT,BHSFAC,BHSPRB,""))
 ..S BHST=$P(^AUPNPROB(BHSDFN,0),U,12)
 ..Q:BHST=""
 ..Q:"AEOS"'[BHST
 ..S BHSNDF=BHSNDF+1,BHSDFT(BHST,BHSFAC_BHSPRB)=BHSDFN
 D CKP^GMTSUP G:$D(GMTSQIT) PROBX I 'GMTSNPG W ! D CKP^GMTSUP G:$D(GMTSQIT) PROBX
 I BHSNDF=0 G COMMON1
 W ?12,"ENT.    MODIFIED",!
 F BHST="A","S","E","O" D
 .S BHSFPP="" F BHSQ=0:0 S BHSFPP=$O(BHSDFT(BHST,BHSFPP)) Q:BHSFPP=""  S BHSDFN=BHSDFT(BHST,BHSFPP) D PROBDSP
 G COMMON1
PROB ; ******************** PROBLEM / NOTES * 9000011 *********
APROB S BHSTAT="ASEO" G COMMON
CPROB S BHSTAT="A" G COMMON
SPROB S BHSTAT="S" G COMMON
OPROB S BHSTAT="O" G COMMON
EPROB S BHSTAT="E" G COMMON
IPROB S BHSTAT="I"
 ; <SETUP>
COMMON ;
 K BHSDFT S BHSNDF=0
 S BHSPAT=DFN
 S BHSFAC="" F BHSQ=0:0 S BHSFAC=$O(^AUPNPROB("AA",BHSPAT,BHSFAC)) Q:'BHSFAC  D PROBSCH
 D CKP^GMTSUP G:$D(GMTSQIT) PROBX I 'GMTSNPG W ! D CKP^GMTSUP G:$D(GMTSQIT) PROBX
 I BHSNDF=0 G COMMON1
 ; <DISPLAY>
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W ?13,"ENT.       MODIFIED",!
 S BHSFPP="" F BHSQ=0:0 S BHSFPP=$O(BHSDFT(BHSFPP)) Q:BHSFPP=""!($D(GMTSQIT))  S BHSDFN=BHSDFT(BHSFPP) D PROBDSP
COMMON1 ;additional stuff for CHHIT bjpc 2.0 patch 5
 ;get date last reviewed and display
 S BHSX=$$LASTPLR^APCLAPI6(BHSPAT,,DT,"A")
 Q:$D(GMTSQIT)
 W !,"Problem List Reviewed On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",?54,$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
 S BHSX=$$LASTPLU^APCLAPI6(BHSPAT,,DT,"A")
 Q:$D(GMTSQIT)
 W "Problem List Updated On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",?54,$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
 I BHSTAT]"" D
 .S BHSX=$$LASTNAP^APCLAPI6(BHSPAT,,DT,"A")
 .Q:$D(GMTSQIT)
 .;I '$$ANYACTP^APCDAPRB(BHSPAT) W !,"No Active Problems: ",?24,$$FMTE^XLFDT($P(BHSX,U,1)) I $P(BHSX,U,3) W ?39,"Documented By: ",?54,$E($P($G(^VA(200,$P(BHSX,U,3),0)),U),1,25),!
 .W "No Active Problems Documented On: ",?36,$$FMTE^XLFDT($P(BHSX,U,1)) W ?51,"By: ",$E($S($P(BHSX,U,3):$P($G(^VA(200,$P(BHSX,U,3),0)),U),1:""),1,25),!
PROBX K BHSDFT,BHSNDF,BHSFPP,BHSFAC,BHSPLN,BHSPBN,BHSDFN,BHSDTM,BHSDTN,BHSPRB,BHSTAT,BHSNFP,BHSNRQ,BHSPNM,BHSDFN,BHSFCN,BHSICD,BHSDOO
 K BHSICL,BHSILN,BHSN,BHSNAR,BHSNTE,BHSAX,BHSCL,BHSTXT,BHSQ,BHSICF
 K BHSNFL,BHSNSH,BHSNAB,BHSVSC,BHSITE,Y,BHSVD,BHSX,BHSP,I,BHSPAT
 Q
PROBSCH ;
 S BHSPRB="" F BHSQ=0:0 S BHSPRB=$O(^AUPNPROB("AA",BHSPAT,BHSFAC,BHSPRB)) Q:BHSPRB=""  S BHSDFN=$O(^(BHSPRB,"")) S:BHSTAT[$P(^AUPNPROB(BHSDFN,0),U,12) BHSNDF=BHSNDF+1,BHSDFT(BHSFAC_BHSPRB)=BHSDFN
 Q
PROBDSP ;
 ; <SETUP PROBLEM>
 S BHSNTE="",BHSDOO=""
 S BHSN=^AUPNPROB(BHSDFN,0)
 S BHSVD=$P(^AUPNPROB(BHSDFN,0),U,3)
 S BHSICD=$P(BHSN,U,1) D GETPLICD^BHSUTL
 S BHSNRQ=""
 S BHSNRQ=$$GET1^DIQ(9000011,BHSDFN_",",.05)
 S X=$$GET1^DIQ(9000011,BHSDFN_",",80001) I X]"" S BHSNRQ=BHSNRQ_" ("_X_")"
 S BHSITE=$P(BHSN,U,6) D GETSITE^BHSUTL
 S BHSPNM=$P(BHSN,U,7) ;***** EDE *****
 S BHSPNM=BHSNAB_BHSPNM ;***** EDE *****
 S X=$P(BHSN,U,3) D REGDT4^GMTSU  S BHSDTM=X
 S X=$P(BHSN,U,8) D REGDT4^GMTSU S BHSDTN=X
 S BHSCL=$$VAL^XBDIQ1(9000011,BHSDFN,.15)
 I BHSCL]"" S BHSNTE="  "_$$CAT^AUPNVPLC($P(BHSN,U,1))_":  "_BHSCL
 S X=$P(BHSN,U,13) I X]"" D REGDT4^GMTSU S BHSDOO=X
 S:BHSDOO]"" BHSNTE=BHSNTE_" (onset "_BHSDOO_")"
 S BHSNTE=BHSNTE_"(Status: "_$$VAL^XBDIQ1(9000011,BHSDFN,.12)_")"
 S BHSPLN=BHSPNM_$E("         ",1,10-$L(BHSPNM))_BHSDTN_" "_BHSDTM
 D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG ?12,"ENT.    MODIFIED",!
 W BHSPLN S BHSICL=33,BHSILN=50 D PRTICD^BHSUTL
 I $P(BHSN,U,16)!($P(BHSN,U,17))!($P(BHSN,U,18)) D ECODEDSP
 ;SEVERITY
 I $O(^AUPNPROB(BHSDFN,13,0)) D
 .W ?33,"Severity: "
 .S BHSAX=0 F  S BHSAX=$O(^AUPNPROB(BHSDFN,13,BHSAX)) Q:BHSAX'=+BHSAX  D
 ..S I=BHSAX_","_BHSDFN
 ..W ?42,$$GET1^DIQ(9000011.13,I,.01)_" - "_$$GET1^DIQ(9000011.13,I,.019),!
 ;FINDING SITE
 I $O(^AUPNPROB(BHSDFN,17,0)) D
 .W ?33,"Finding Site: "
 .S BHSAX=0 F  S BHSAX=$O(^AUPNPROB(BHSDFN,17,BHSAX)) Q:BHSAX'=+BHSAX  D
 ..S I=BHSAX_","_BHSDFN
 ..W ?42,$$GET1^DIQ(9000011.17,I,.01),!
 ;clinical course
 I $O(^AUPNPROB(BHSDFN,18,0)) D
 .W ?33,"Clinical Course: "
 .S BHSAX=0 F  S BHSAX=$O(^AUPNPROB(BHSDFN,18,BHSAX)) Q:BHSAX'=+BHSAX  D
 ..S I=BHSAX_","_BHSDFN
 ..W ?42,$$GET1^DIQ(9000011.18,I,.01)_" - "_$$GET1^DIQ(9000011.18,I,.019),!
 ;D NOTEDSP
 D RECON^BHSPL(BHSDFN)
 Q
ECODEDSP ;
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W ?33,"CAUSE: ",!
 F BHSP=16,17,18 D  Q:$D(GMTSQIT)
 .D CKP^GMTSUP Q:$D(GMTSQIT)
 .W:GMTSNPG ?13,"ENT.       MODIFIED",!
 .S BHSTXT=""
 .S BHSICD=$P(BHSN,U,BHSP)
 .Q:BHSICD=""
 .S BHSNRQ=$S(BHSICF="N":$P($$ICDDX^ICDEX($P(BHSN,U,BHSP),"","","I"),U,4),BHSICF="L":$P($$ICDDX^AUPNVUTL($P(BHSN,U,BHSP)),U,4),1:"")
 .;D GETICDDX^BHSUTL
 . D GETPLICD^BHSUTL
 .I BHSICF="C"!(BHSICF="") S BHSNRQ=BHSICD_"-"_$P($$ICDDX^ICDEX($P(BHSN,U,BHSP),"","","I"),U,4)
 .I BHSICF="L" S BHSNRQ=BHSICD
 .S BHSICL=33,BHSILN=50
 .D PRTICDE^BHSUTL
 .Q
 Q
NOTEDSP ; DISPLAY NOTES UNDER APCHSPRBLEM
 S BHSNFP=0 F BHSQ=0:0 S BHSNFP=$O(^AUPNPROB(BHSDFN,11,BHSNFP)) Q:'BHSNFP  D DSPFACN
 Q
DSPFACN ; DISPLAY NOTES FOR SELECTED APSHCFACILITY
 Q:$D(^AUPNPROB(BHSDFN,11,BHSNFP,11,0))'=1  Q:$O(^(0))=""
 S BHSITE=^AUPNPROB(BHSDFN,11,BHSNFP,0) D GETSITE^BHSUTL S BHSFCN=BHSNAB
 S BHSNDF=0 F BHSQ=0:0 S BHSNDF=$O(^AUPNPROB(BHSDFN,11,BHSNFP,11,BHSNDF)) Q:'BHSNDF  S BHSN=^(BHSNDF,0) D DSPN
 Q
DSPN ; DISPLAY SINGLE NOTE
 Q:$P(BHSN,U,4)="E"
 Q:$P(BHSN,U,4)="I"
 S BHSNAR=$P(BHSN,U,3) S Y=$P(BHSN,U,5) ;S:Y="" Y="            "
 N X
 I X>0 D REGDT4^GMTSU S X=X_" -  "
 S BHSNAR=X_BHSNAR
 F BHSQ=0:0 Q:$E(BHSFCN)'=" "  S BHSFCN=$E(BHSFCN,2,99)
 D CKP^GMTSUP Q:$D(GMTSQIT)  W BHSFCN_" "_$P(BHSN,U)
 S BHSTXT=BHSNAR,BHSICL=34 D PRTTXT^BHSUTL
 Q