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

APCHS4.m

Go to the documentation of this file.
APCHS4 ; IHS/CMI/LAB - PART 4 OF APCHS -- SUMMARY PRODUCTION COMPONENTS ;
 ;;2.0;IHS PCC SUITE;**5,10,11,16**;MAY 14, 2009;Build 9
 ;
PROBST ;EP - problems by status
 NEW APCHPBST,APCHST
 S APCHSTAT="AEOSR"
 S APCHSNDF=0
 S APCHSFAC="" F APCHSQ=0:0 S APCHSFAC=$O(^AUPNPROB("AA",APCHSPAT,APCHSFAC)) Q:'APCHSFAC  D
 .S APCHSPRB="" F APCHSQ=0:0 S APCHSPRB=$O(^AUPNPROB("AA",APCHSPAT,APCHSFAC,APCHSPRB)) Q:APCHSPRB=""  D
 ..S APCHSDFN=$O(^AUPNPROB("AA",APCHSPAT,APCHSFAC,APCHSPRB,""))
 ..S APCHST=$P(^AUPNPROB(APCHSDFN,0),U,12)
 ..Q:APCHST=""
 ..Q:"AEOSR"'[APCHST
 ..S APCHSNDF=APCHSNDF+1,APCHSDFT(APCHST,APCHSFAC_APCHSPRB)=APCHSDFN
 X APCHSCKP G:$D(APCHSQIT) PROBX I 'APCHSNPG W ! X APCHSCKP G:$D(APCHSQIT) PROBX X:'APCHSNPG APCHSBRK
 I APCHSNDF=0 G COMMON1
 F APCHST="A","S","E","O","R" D
 .S APCHSFPP="" F APCHSQ=0:0 S APCHSFPP=$O(APCHSDFT(APCHST,APCHSFPP)) Q:APCHSFPP=""  S APCHSDFN=APCHSDFT(APCHST,APCHSFPP) D PROBDSP
 G COMMON1
PROB ; ******************** PROBLEM / NOTES * 9000011 *********
APROB S APCHSTAT="AS" S:$P(^APCHSCTL(APCHSTYP,0),U,4) APCHSTAT=APCHSTAT_"O" G COMMON
CPROB S APCHSTAT="A" G COMMON
SPROB S APCHSTAT="S" G COMMON
OPROB S APCHSTAT="O" G COMMON
EPROB S APCHSTAT="E" G COMMON
RPROB S APCHSTAT="R" G COMMON
IPROB S APCHSTAT="I"
 ; <SETUP>
COMMON ;
 K APCHSDFT S APCHSNDF=0
 S APCHSFAC="" F APCHSQ=0:0 S APCHSFAC=$O(^AUPNPROB("AA",APCHSPAT,APCHSFAC)) Q:'APCHSFAC  D PROBSCH
 X APCHSCKP G:$D(APCHSQIT) PROBX I 'APCHSNPG W ! X APCHSCKP G:$D(APCHSQIT) PROBX X:'APCHSNPG APCHSBRK
 I APCHSNDF=0 G COMMON1
 ; <DISPLAY>
 X APCHSCKP Q:$D(APCHSQIT)  W ?13,"ENT.    MODIFIED",!
 S APCHSFPP="" F APCHSQ=0:0 S APCHSFPP=$O(APCHSDFT(APCHSFPP)) Q:APCHSFPP=""!($D(APCHSQIT))  S APCHSDFN=APCHSDFT(APCHSFPP) D PROBDSP
COMMON1 ;additional stuff for CHHIT bjpc 2.0 patch 5
 ;get date last reviewed and display
 S APCHSX=$$LASTPLR^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W !,"Problem List Reviewed On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 S APCHSX=$$LASTPLU^APCLAPI6(APCHSPAT,,DT,"A")
 X APCHSCKP Q:$D(APCHSQIT)
 W "Problem List Updated On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",?54,$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
 I APCHSTAT]"" D
 .S APCHSX=$$LASTNAP^APCLAPI6(APCHSPAT,,DT,"A")
 .X APCHSCKP Q:$D(APCHSQIT)
 .;I '$$ANYACTP^APCDAPRB(APCHSPAT) W !,"No Active Problems: ",?24,$$FMTE^XLFDT($P(APCHSX,U,1)) I $P(APCHSX,U,3) W ?39,"Documented By: ",?54,$E($P($G(^VA(200,$P(APCHSX,U,3),0)),U),1,25),!
 .W "No Active Problems Documented On: ",?36,$$FMTE^XLFDT($P(APCHSX,U,1)) W ?51,"By: ",$E($S($P(APCHSX,U,3):$P($G(^VA(200,$P(APCHSX,U,3),0)),U),1:""),1,25),!
PROBX K APCHSDFT,APCHSNDF,APCHSFPP,APCHSFAC,APCHSPLN,APCHSPBN,APCHSDTM,APCHSDTN,APCHSPRB,APCHSTAT,APCHSNFP,APCHSNRQ,APCHSPNM,APCHSDFN,APCHSFCN,APCHSICD,APCHSDOO
 K APCHSICL,APCHSILN,APCHSN,APCHSNAR,APCHSNTE
 K APCHSNFL,APCHSNSH,APCHSNAB,APCHSVSC,APCHSITE,Y,APCHCSVD,APCHSX
 Q
PROBSCH ;
 S APCHSPRB="" F APCHSQ=0:0 S APCHSPRB=$O(^AUPNPROB("AA",APCHSPAT,APCHSFAC,APCHSPRB)) Q:APCHSPRB=""  S APCHSDFN=$O(^(APCHSPRB,"")) S:APCHSTAT[$P(^AUPNPROB(APCHSDFN,0),U,12) APCHSNDF=APCHSNDF+1,APCHSDFT(APCHSFAC_APCHSPRB)=APCHSDFN
 Q
PROBDSP ;
 ; <SETUP PROBLEM>
 S APCHSNTE=""
 S APCHSN=^AUPNPROB(APCHSDFN,0)
 S APCHCSVD=$P(^AUPNPROB(APCHSDFN,0),U,3)
 S APCHSICD=$P(APCHSN,U,1) D GETICDDX^APCHSUTL
 S APCHSNRQ="" I $$WANTPN^APCHSUTL(APCHSTYP) D
 .S APCHSNRQ=$$GET1^DIQ(9000011,APCHSDFN_",",.05)
 .I $P(^APCHSCTL(APCHSTYP,0),U,3) S X=$$GET1^DIQ(9000011,APCHSDFN_",",80001) I X]"" S APCHSNRQ=APCHSNRQ_" ("_X_")"
 S APCHSITE=$P(APCHSN,U,6) D GETSITE^APCHSUTL
 S APCHSPNM=$P(APCHSN,U,7) ;***** EDE *****
 S APCHSPNM=APCHSNAB_APCHSPNM ;***** EDE *****
 S Y=$P(APCHSN,U,3) X APCHSCVD S APCHSDTM=Y
 S Y=$P(APCHSN,U,8) X APCHSCVD S APCHSDTN=Y
 S APCHSCL=$$VAL^XBDIQ1(9000011,APCHSDFN,.15)
 I APCHSCL]"" S APCHSNTE="  "_$$CAT^AUPNVPLC($P(APCHSN,U,1))_":  "_APCHSCL
 S Y=$P(APCHSN,U,13) X:Y]"" APCHSCVD S APCHSDOO=Y
 S:APCHSDOO]"" APCHSNTE=APCHSNTE_" (onset "_APCHSDOO_")"
 S APCHSNTE=APCHSNTE_"(Status: "_$$VAL^XBDIQ1(9000011,APCHSDFN,.12)_")"
 S APCHSPLN=APCHSPNM_$E("           ",1,12-$L(APCHSPNM))_APCHSDTN_" "_APCHSDTM
 X APCHSCKP Q:$D(APCHSQIT)  W:APCHSNPG ?12,"ENT.    MODIFIED",!
 W APCHSPLN S APCHSICL=31,APCHSILN=50 D PRTICD^APCHSUTL
 I $P(APCHSN,U,16)!($P(APCHSN,U,17))!($P(APCHSN,U,18)) D ECODEDSP
 ;SEVERITY
 I $O(^AUPNPROB(APCHSDFN,13,0)) D
 .W ?30,"Severity: "
 .S APCHSAX=0 F  S APCHSAX=$O(^AUPNPROB(APCHSDFN,13,APCHSAX)) Q:APCHSAX'=+APCHSAX  D
 ..S I=APCHSAX_","_APCHSDFN
 ..W ?42,$$GET1^DIQ(9000011.13,I,.01)_" - "_$$GET1^DIQ(9000011.13,I,.019),!
 ;FINDING SITE
 I $O(^AUPNPROB(APCHSDFN,17,0)) D
 .W ?30,"Finding Site: "
 .S APCHSAX=0 F  S APCHSAX=$O(^AUPNPROB(APCHSDFN,17,APCHSAX)) Q:APCHSAX'=+APCHSAX  D
 ..S I=APCHSAX_","_APCHSDFN
 ..W ?42,$$GET1^DIQ(9000011.17,I,.01),!
 ;clinical course
 I $O(^AUPNPROB(APCHSDFN,18,0)) D
 .W ?30,"Clinical Course: "
 .S APCHSAX=0 F  S APCHSAX=$O(^AUPNPROB(APCHSDFN,18,APCHSAX)) Q:APCHSAX'=+APCHSAX  D
 ..S I=APCHSAX_","_APCHSDFN
 ..W ?42,$$GET1^DIQ(9000011.18,I,.01)_" - "_$$GET1^DIQ(9000011.18,I,.019),!
 D NOTEDSP
 Q
ECODEDSP ;
 X APCHSCKP Q:$D(APCHSQIT)  W ?30,"CAUSE: ",!
 F APCHSP=16,17,18 D  Q:$D(APCHSQIT)
 .X APCHSCKP Q:$D(APCHSQIT)  W:APCHSNPG ?13,"ENT.    MODIFIED",!
 .S APCHSTXT=""
 .S APCHSICD=$P(APCHSN,U,APCHSP)
 .Q:APCHSICD=""
 .S APCHSNRQ=$S(APCHSICF="N":$P($$ICDDX^ICDEX($P(APCHSN,U,APCHSP)),U,4),APCHSICF="L":$P($$ICDDX^ICDEX($P(APCHSN,U,APCHSP)),U,4),1:"")
 .D GETICDDX^APCHSUTL
 .I APCHSICF="C"!(APCHSICF="") S APCHSNRQ=APCHSICD_"-"_$P($$ICDDX^ICDEX($P(APCHSN,U,APCHSP)),U,4)
 .I APCHSICF="L" S APCHSNRQ=APCHSICD
 .S APCHSICL=31,APCHSILN=50
 .D PRTICDE^APCHSUTL
 .Q
 Q
NOTEDSP ; DISPLAY NOTES UNDER APCHSPRBLEM
 S APCHSNFP=0 F APCHSQ=0:0 S APCHSNFP=$O(^AUPNPROB(APCHSDFN,11,APCHSNFP)) Q:'APCHSNFP  D DSPFACN
 Q
DSPFACN ; DISPLAY NOTES FOR SELECTED APSHCFACILITY
 Q:$D(^AUPNPROB(APCHSDFN,11,APCHSNFP,11,0))'=1  Q:$O(^(0))=""
 S APCHSITE=^AUPNPROB(APCHSDFN,11,APCHSNFP,0) D GETSITE^APCHSUTL S APCHSFCN=APCHSNAB
 S APCHSNDF=0 F APCHSQ=0:0 S APCHSNDF=$O(^AUPNPROB(APCHSDFN,11,APCHSNFP,11,APCHSNDF)) Q:'APCHSNDF  S APCHSN=^(APCHSNDF,0) D DSPN
 Q
DSPN ; DISPLAY SINGLE NOTE
 Q:$P(APCHSN,U,4)'="A"
 S APCHSNAR=$P(APCHSN,U,3) S Y=$P(APCHSN,U,5) ;S:Y="" Y="            "
 I Y>0 X APCHSCVD S Y=Y_" -  "
 S APCHSNAR=Y_APCHSNAR
 F APCHSQ=0:0 Q:$E(APCHSFCN)'=" "  S APCHSFCN=$E(APCHSFCN,2,99)
 X APCHSCKP Q:$D(APCHSQIT)  W APCHSPNM,APCHSFCN,$P(APCHSN,U)
 S APCHSTXT=APCHSNAR,APCHSICL=31 D PRTTXT^APCHSUTL
 Q