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

BPCPROB.m

Go to the documentation of this file.
  1. BPCPROB ; IHS/OIT/MJL - GUI COLLECTS PROBLEM LIST DATA ;
  1. ;;1.5;BPC;;MAY 26, 2005
  1. ;
  1. EN(RESULT,BPCIEN,BPCSDATE,BPCEDATE) ;EP CALL FROM REMOTE PROC: BPC GETPROBLEMS
  1. S U="^",XWBWRAP=1,BPCCTR=0,BPCSUB=$J,BPCIEN=$G(BPCIEN),BPCSDATE=$G(BPCSDATE),BPCEDATE=$G(BPCEDATE) K ^BGUTMP(BPCSUB),RESULT
  1. I BPCIEN="" S RESULT(1)="-1",RESULT(2)="NO PATIENT IEN DEFINED!" D KILL Q
  1. I BPCSDATE="" S RESULT(1)="-1",RESULT(2)="NO STARTING DATE DEFINED!" D KILL Q
  1. I BPCEDATE="" S RESULT(1)="-1",RESULT(2)="NO ENDING DATE DEFINED!" D KILL Q
  1. D DT^DILF("",BPCSDATE,.BPCSDAT)
  1. I BPCSDAT=-1 D
  1. .S BPCSDATE="1/1/1980"
  1. .D DT^DILF("",BPCSDATE,.BPCSDAT)
  1. D DT^DILF("",BPCEDATE,.BPCEDAT)
  1. I BPCEDAT=-1 D
  1. .S BPCEDATE="T"
  1. .D DT^DILF("",BPCEDATE,.BPCEDAT)
  1. S BPCPRB="" F S BPCPRB=$O(^AUPNPROB("AC",BPCIEN,BPCPRB)) Q:BPCPRB="" D PRB
  1. D SETRES,KILL
  1. Q
  1. KILL ;
  1. K BPCCTR,BPCSUB,BPCPRB,BPCIEN,BPCCTR,BPCX,BPCDXP,BPCLOCP,BPCSTAT,BPCOSET,BPCNARP,BPCNBR,BPCDX,BPCPRBID,BPCNAR,BPCDTMOD,BPCDTENT,BPCCLS,BPCLOCC,BPCLOCN
  1. Q
  1. PRB ;
  1. S BPCCTR=BPCCTR+1
  1. S BPCX=^AUPNPROB(BPCPRB,0)
  1. Q:$P($G(BPCX),U,3)<BPCSDATE
  1. S BPCDXP=$P(BPCX,U,1),BPCLOCP=$P(BPCX,U,6),BPCSTAT=$S($P(BPCX,U,12)="A":"ACTIVE",$P(BPCX,U,12)="I":"INACTIVE",1:"UNKNOWN"),BPCOSET=$P(BPCX,U,13),BPCNARP=$P(BPCX,U,5),BPCNBR=+$P(BPCX,U,7)
  1. S BPCDTENT=$P(BPCX,U,8),BPCDTMOD=$P(BPCX,U,3),BPCLOCC=$P(^AUTTLOC(BPCLOCP,0),U,7),BPCCLS=$P(BPCX,U,4)
  1. S:BPCLOCC="" BPCLOCC="UK"
  1. S BPCDX=$P(^ICD9(BPCDXP,0),U,1),BPCPRBID=BPCLOCC_BPCNBR,BPCNAR=$P(^AUTNPOV(BPCNARP,0),U,1)
  1. S ^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC,BPCNBR)="PROB"_U_BPCPRBID_U_BPCDX_U_BPCSTAT_U_BPCOSET_U_BPCNAR_U_BPCPRB_U_BPCDTENT_U_BPCDTMOD_U_BPCCLS_U_BPCDXP
  1. D GETNOTES
  1. Q
  1. GETNOTES ;
  1. S BPCLOCP="" F S BPCLOCP=$O(^AUPNPROB(BPCPRB,11,"B",BPCLOCP)) Q:BPCLOCP="" S BPCLOCN=$P(^AUTTLOC(BPCLOCP,0),U,7),BPCNUM="" F S BPCNUM=$O(^AUPNPROB(BPCPRB,11,"B",BPCLOCP,BPCNUM)) Q:BPCNUM="" D GN1
  1. Q
  1. GN1 ;
  1. S BPCNOT="0" F S BPCNOT=$O(^AUPNPROB(BPCPRB,11,BPCNUM,11,BPCNOT)) Q:+BPCNOT=0 D GN2
  1. Q
  1. GN2 ;
  1. S BPCNOTID=BPCLOCN_BPCNOT
  1. S BPCX=^AUPNPROB(BPCPRB,11,BPCNUM,11,BPCNOT,0)
  1. S ^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC,BPCNBR,BPCNUM,BPCNOT)="NOTE"_U_BPCPRB_U_BPCNUM_U_BPCNOTID_U_BPCLOCP_U_BPCX
  1. S BPCCTR=BPCCTR+1
  1. Q
  1. SETRES ;
  1. I BPCCTR=0 S RESULT(1)=-1,RESULT(2)="NO PROBLEMS FOUND!" Q
  1. S RESULT(1)=BPCCTR,BPCCTR=1
  1. S BPCSTAT="" F S BPCSTAT=$O(^BGUTMP(BPCSUB,BPCSTAT)) Q:BPCSTAT="" D SETRES1
  1. Q
  1. SETRES1 ;
  1. ;S BPCPRBID="" F S BPCPRBID=$O(^BGUTMP(BPCSUB,BPCSTAT,BPCPRBID)) Q:BPCPRBID="" S BPCCTR=BPCCTR+1,RESULT(BPCCTR)=^(BPCPRBID) D SETRES2
  1. S BPCLOCC="" F S BPCLOCC=$O(^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC)) Q:BPCLOCC="" S BPCNBR="" F S BPCNBR=$O(^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC,BPCNBR)) Q:BPCNBR="" S BPCCTR=BPCCTR+1,RESULT(BPCCTR)=^(BPCNBR) D SETRES2
  1. Q
  1. SETRES2 ;
  1. S BPCNUM="" F S BPCNUM=$O(^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC,BPCNBR,BPCNUM)) Q:BPCNUM="" S BPCNOT="" F S BPCNOT=$O(^BGUTMP(BPCSUB,BPCSTAT,BPCLOCC,BPCNBR,BPCNUM,BPCNOT)) Q:BPCNOT="" S BPCCTR=BPCCTR+1,RESULT(BPCCTR)=^(BPCNOT)
  1. Q