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

BQIMUFCH.m

Go to the documentation of this file.
BQIMUFCH ;VNGT/HS/ALA-Hospital Hover Help ; 06 May 2011  8:17 AM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
 ;
 ;
EN(DATA,REPORT,TMFRAME,PERIOD) ; EP -- BQI MU GET FACILITY HOVER
 NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMUFCPH",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S TMFRAME=$G(TMFRAME,90),REPORT=$G(REPORT,"")
 S HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
 S HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
 S @DATA@(II)=HDR_$C(30)
 D GTM^BQIMUTIM
 S FAC=$$HME^BQIGPUTL() D RTE(FAC)
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
RTE(FAC) ; EP
 NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
 NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL,PGLOB
 ;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
 S FACIL=$P(^DIC(4,FAC,0),U,1)
 S PGLOB=$$PRFPGL^BQIMUTAB(REPORT)
 ;
 S PN=0
 F  S PN=$O(@PGLOB@(PN)) Q:'PN  D
 . S ID=$P(@PGLOB@(PN,0),U,1) I $P(@PGLOB@(PN,0),U,2)'="H" Q
 . I $P(@PGLOB@(PN,0),U,6)="A" Q
 . S BQZZ(ID,"C")="NDA",BQZZ(ID,"P")="NDA"
 ;
 S CRDT=""
 F  S CRDT=$O(BQCDAR(CRDT)) Q:CRDT=""  D
 . S CQN=$O(^BQIFAC(FAC,40,"B",CRDT,""))
 . D CPAGG
 ;
 S PRDT=""
 F  S PRDT=$O(BQPDAR(PRDT)) Q:PRDT=""  D
 . S PQN=$O(^BQIFAC(FAC,40,"B",PRDT,""))
 . D PPAGG
 ;
 S ID=""
 F  S ID=$O(BQZZ(ID)) Q:ID=""  D
 . S IMN=$O(@PGLOB@("B",ID,"")) I IMN="" Q
 . S ST1G=$G(@PGLOB@(IMN,13,1,0)),OBJ=$P(@PGLOB@(IMN,0),U,5)
 . S MSET=$$GET1^DIQ(9001300.02,IMN_",",.03,"E")
 . S CDEN=$P($G(BQZZ(ID,"C")),U,1)
 . S CNUM=$P($G(BQZZ(ID,"C")),U,2)
 . S CEXC=$P($G(BQZZ(ID,"C")),U,3)
 . ;
 . S PDEN=$P($G(BQZZ(ID,"P")),U,1)
 . S PNUM=$P($G(BQZZ(ID,"P")),U,2)
 . S PEXC=$P($G(BQZZ(ID,"P")),U,3)
 . ;
 . I +CDEN=0,+CNUM=0 S CURR=""
 . I +PDEN=0,+PNUM=0 S PREV=""
 . I +CDEN'=0,+CNUM=0 S CURR=""
 . I +PDEN'=0,+PNUM=0 S PREV=""
 . I +CDEN'=0,+CNUM'=0 S CURR=""
 . I +PDEN'=0,+PNUM'=0 S PREV=""
 . I CURR="" S CURR="N/A"
 . I PREV="" S PREV="N/A"
 . I CEXC'="" S CURR=CEXC
 . I PEXC'="" S PREV=PEXC
 . S:CNUM="" CNUM=0 S:PNUM="" PNUM=0 S:CDEN="" CDEN=0 S:PDEN="" PDEN=0
 . S II=II+1,@DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$C(30)
 K BQZZ
 Q
 ;
CQ(DATA,TMFRAME,PERIOD) ; EP -- BQI MU GET FAC CQ HOVER
 NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMUFCQH",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S TMFRAME=$G(TMFRAME,90)
 S HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
 S HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
 S @DATA@(II)=HDR_$C(30)
 ;
 D GTM^BQIMUTIM
 ;
 S FAC=$$HME^BQIGPUTL() D RET(FAC)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
RET(FAC) ; EP
 NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
 NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL
 ;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
 S FACIL=$P(^DIC(4,FAC,0),U,1)
 ;
 S X=0 F  S X=$O(^BGPMUIND(90595.11,"AMS","H",X)) Q:X'=+X  S BGPIND(X)=""
 S I="" F  S I=$O(BGPIND(I)) Q:I=""  D
 . S BN="" F  S BN=$O(^BGPMUIND(90596.11,"B",I,BN)) Q:BN=""  D
 .. S ID=$P(^BGPMUIND(90596.11,BN,0),U,4),BQZZ(ID,"C")="NDA",BQZZ(ID,"P")="NDA"
 ;
 S CRDT=""
 F  S CRDT=$O(BQCDAR(CRDT)) Q:CRDT=""  D
 . S CQN=$O(^BQIFAC(FAC,50,"B",CRDT,""))
 . D CAGG
 ;
 S PRDT=""
 F  S PRDT=$O(BQPDAR(PRDT)) Q:PRDT=""  D
 . S PQN=$O(^BQIFAC(FAC,50,"B",PRDT,""))
 . D PAGG
 ;
 S ID=""
 F  S ID=$O(BQZZ(ID)) Q:ID=""  D
 . S IMN=$O(^BGPMUIND(90596.11,"C",ID,"")) I IMN="" Q
 . S ST1G="",OBJ=$P($G(^BGPMUIND(90596.11,IMN,17)),U,3)
 . S MSN=$P(^BGPMUIND(90596.11,IMN,0),U,1)
 . I $P(^BGPMUIND(90595.11,MSN,0),U,4)'="H" Q
 . S MSET="HOSPITAL"
 . ;
 . S CDEN=$P($G(BQZZ(ID,"C")),U,1)
 . S CNUM=$P($G(BQZZ(ID,"C")),U,2)
 . S CEXC=$P($G(BQZZ(ID,"C")),U,3)
 . ;
 . S PDEN=$P($G(BQZZ(ID,"P")),U,1)
 . S PNUM=$P($G(BQZZ(ID,"P")),U,2)
 . S PEXC=$P($G(BQZZ(ID,"P")),U,3)
 . ;
 . I ID[".ED." D
 .. S CURR=""
 .. I CDEN'="" S CURR=""
 .. S PREV=""
 .. I PDEN'="" S PREV=""
 . I ID'[".ED." D
 .. I +CDEN=0,+CNUM=0 S CURR=""
 .. I +CDEN'=0,+CNUM=0 S CURR=""
 .. I +CDEN'=0,+CNUM'=0,(CDEN-CEXC)=0 S CURR=""
 .. I +CDEN'=0,+CNUM'=0,(CDEN-CEXC)'=0 S CURR=""
 .. S:CNUM="" CNUM=0 S:CDEN="" CDEN=0
 .. I +PDEN=0,+PNUM=0 S PREV=""
 .. I +PDEN'=0,+PNUM=0 S PREV=""
 .. I +PDEN'=0,+PNUM'=0,(PDEN-PEXC)=0 S PREV=""
 .. I +PDEN'=0,+PNUM'=0,(PDEN-PEXC)'=0 S PREV=""
 . S II=II+1,@DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$C(30)
 K BQZZ
 Q
 ;
CAGG ; Aggregate
 ;
 I CQN="" Q
 S IDN=0
 F  S IDN=$O(^BQIFAC(FAC,50,CQN,1,IDN)) Q:'IDN  D
 . S (CDEN,CNUM,CEXC,CURR)=""
 . S CDATA=^BQIFAC(FAC,50,CQN,1,IDN,0)
 . S CDEN=$P(CDATA,U,2),CNUM=$P(CDATA,U,3),CEXC=$P(CDATA,U,4)
 . S ID=$P(CDATA,U,1)
 . S $P(BQZZ(ID,"C"),U,1)=$P($G(BQZZ(ID,"C")),U,1)+CDEN
 . S $P(BQZZ(ID,"C"),U,2)=$P($G(BQZZ(ID,"C")),U,2)+CNUM
 . S $P(BQZZ(ID,"C"),U,3)=$P($G(BQZZ(ID,"C")),U,3)+CEXC
 Q
 ;
PAGG ; Aggregate
 I PQN="" Q
 S IDN=0
 F  S IDN=$O(^BQIFAC(FAC,50,PQN,1,IDN)) Q:'IDN  D
 . S (PDEN,PNUM,PEXC,PREV)=""
 . S PDATA=^BQIFAC(FAC,50,PQN,1,IDN,0)
 . S PDEN=$P(PDATA,U,2),PNUM=$P(PDATA,U,3),PEXC=$P(PDATA,U,4)
 . S ID=$P(PDATA,U,1)
 . ;
 . I +PNUM=0 S PREV=0
 . I +PDEN'=0,+PNUM'=0 S PREV=$J((PNUM/PDEN)*100,3,0),PREV=$$TRIM^BQIUL1(PREV," ")
 . I PDEN="",PNUM="",PEXC'="" S PREV="Excluded"
 . I PDEN="",PNUM="",PEXC="" S PREV=""
 . S $P(BQZZ(ID,"P"),U,1)=$P($G(BQZZ(ID,"P")),U,1)+PDEN
 . S $P(BQZZ(ID,"P"),U,2)=$P($G(BQZZ(ID,"P")),U,2)+PNUM
 . S $P(BQZZ(ID,"P"),U,3)=$P($G(BQZZ(ID,"P")),U,3)+PEXC
 Q
 ;
CPAGG ; Aggregate performance
 I CQN="" Q
 S IDN=0
 F  S IDN=$O(^BQIFAC(FAC,40,CQN,1,IDN)) Q:'IDN  D
 . S (CDEN,CNUM,CEXC,CURR)=""
 . S CDATA=^BQIFAC(FAC,40,CQN,1,IDN,0)
 . S CDEN=$P(CDATA,U,2),CNUM=$P(CDATA,U,3)
 . S CEXC=$G(^BQIFAC(FAC,40,CQN,1,IDN,1))
 . S ID=$P(CDATA,U,1)
 . S $P(BQZZ(ID,"C"),U,1)=$P($G(BQZZ(ID,"C")),U,1)+CDEN
 . S $P(BQZZ(ID,"C"),U,2)=$P($G(BQZZ(ID,"C")),U,2)+CNUM
 . S $P(BQZZ(ID,"C"),U,3)=CEXC
 Q
 ;
PPAGG ;
 I PQN="" Q
 S IDN=0
 F  S IDN=$O(^BQIFAC(FAC,40,PQN,1,IDN)) Q:'IDN  D
 . S (PDEN,PNUM,PEXC,PREV)=""
 . S PDATA=^BQIFAC(FAC,40,PQN,1,IDN,0)
 . S PDEN=$P(PDATA,U,2),PNUM=$P(PDATA,U,3)
 . S PEXC=$G(^BQIFAC(FAC,40,PQN,1,IDN,1))
 . S ID=$P(PDATA,U,1)
 . ;
 . I +PNUM=0 S PREV=0
 . I +PDEN'=0,+PNUM'=0 S PREV=$J((PNUM/PDEN)*100,3,0),PREV=$$TRIM^BQIUL1(PREV," ")
 . I PDEN="",PNUM="",PEXC'="" S PREV="Excluded"
 . I PDEN="",PNUM="",PEXC="" S PREV=""
 . S $P(BQZZ(ID,"P"),U,1)=$P($G(BQZZ(ID,"P")),U,1)+PDEN
 . S $P(BQZZ(ID,"P"),U,2)=$P($G(BQZZ(ID,"P")),U,2)+PNUM
 . S $P(BQZZ(ID,"P"),U,3)=PEXC
 Q