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

NURARWL2.m

Go to the documentation of this file.
NURARWL2 ;HIRMFO/MD-(CURRENT) MANHOURS WORKLOAD STAT REPORT FOR HOSP. CON'T ;2/27/98  14:24
 ;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
 I 'NHOS S NPFAC="" F  S NPFAC=$O(NURSPC(NPFAC)) Q:NPFAC=""  S NZ=0 F  S NZ=$O(NURSPC(NPFAC,1,NZ)) Q:NZ'>0  S (NURSWARD,NPWARD)=$S($E(NZ,1,3)=999:$E(NZ,4,99),1:NZ) D EN6^NURSAUTL S NPLOC=NPWARD D  Q:NURQUIT
 . S NJ=0 F  S NJ=$O(NURSPC(NPFAC,1,NZ,NJ)) D:NJ'>0 BRK^NURARWL3 Q:NJ'>0  D BEDSEC,ACUFTE,DETAIL^NURARWL3 Q:NURQUIT
 . Q
 I NHOS S:'NURMDSW NURFAC(2)="  BLANK" D  Q:NURQUIT
 . S NDA=0 F  S NDA=$O(^NURSF(211.4,NDA)) Q:NDA'>0  S NPWARD=NDA D EN6^NURSAUTL I NPWARD'="" D  Q:NURQUIT
 . . I $G(NURFAC(2))'="  BLANK" S NURFAC(2)=$$EN12^NURSUT3($G(NDA)) Q:NURFAC(2)=""  I '$G(NURFAC),$G(NURFAC(2))'=$G(NURFAC(1)) Q
 . . S ^TMP($J,"WARD",NURFAC(2),NPWARD,NDA)=""
 . . Q
 . S NPFAC="" F  S NPFAC=$O(^TMP($J,"WARD",NPFAC)) Q:NPFAC=""  D:'$G(NURSUMSW) HEADER^NURARWL3 D  Q:NURQUIT  D:NURMDSW FACTOT^NURARWL9
 . . S NPLOC="" F  S NPLOC=$O(^TMP($J,"WARD",NPFAC,NPLOC)) Q:NPLOC=""!NURQUIT  S NZ=$O(^(NPLOC,"")) I NZ'="",$D(NURSPC(NPFAC,1,NZ)) D  Q:NURQUIT
 . . . S NURSWARD=NZ,NJ=0 F  S NJ=$O(NURSPC(NPFAC,1,NZ,NJ)) D:NJ'>0 BRK^NURARWL3 Q:NJ'>0  D BEDSEC,ACUFTE,DETAIL^NURARWL3 Q:NURQUIT
 . . . Q
 . . Q
 . Q
 Q
ACUFTE ;
 F X(1)=1,2,3 S $P(NREQ,U,X(1))=0,$P(NFTEE,U,X(1))=0,$P(NVAR,U,X(1))=0 S $P(NPROD,U,X(1))=$S(NURSZAP'>6:0,1:"")
 S NURS213=^NURSF(213.3,NJ,1),DIC=213.4,DIC(0)="",X=NRPTDAT_NURSHFT_NURSWARD D ^DIC K DIC S NDA=+Y D
 . F Z=1:1:5 Q:'$D(NURSPC(NPFAC,Z,NZ,NJ))  S $P(NPC,U,Z)=NURSPC(NPFAC,Z,NZ,NJ),NPCC=NPCC+$P(NPC,U,Z)
 . S:NTCEN(NZ) NPERCEN=(NPCC/NTCEN(NZ))
 . I NURSHFT="D" S NTLFTEE=(($P(NPC,U)*$P(NURS213,"^",2))+($P(NPC,U,2)*$P(NURS213,"^",3))+($P(NPC,U,3)*$P(NURS213,"^",4))+($P(NPC,U,4)*$P(NURS213,"^",5))+($P(NPC,U,5)*$P(NURS213,"^",14)))/8.5
 . I NURSHFT="E" S NTLFTEE=(($P(NPC,U)*$P(NURS213,"^",6))+($P(NPC,U,2)*$P(NURS213,"^",7))+($P(NPC,U,3)*$P(NURS213,"^",8))+($P(NPC,U,4)*$P(NURS213,"^",9))+($P(NPC,U,5)*$P(NURS213,"^",15)))/8.5
 . I NURSHFT="N" S NTLFTEE=(($P(NPC,U)*$P(NURS213,"^",10))+($P(NPC,U,2)*$P(NURS213,"^",11))+($P(NPC,U,3)*$P(NURS213,"^",12))+($P(NPC,U,4)*$P(NURS213,"^",13))+($P(NPC,U,5)*$P(NURS213,"^",16)))/8
 . S X=$S($D(^NURSA(213.4,NDA,0)):^NURSA(213.4,NDA,0),1:"0^0^0^0") S $P(NFTEE,U)=$S($P(X,"^",2):$P(X,"^",2)/8,1:0) S $P(NFTEE,U,2)=$S($P(X,"^",3):$P(X,"^",3)/8,1:0) S $P(NFTEE,U,3)=$S($P(X,"^",4):$P(X,"^",4)/8,1:0)
 . S X=NTLFTEE I $D(^NURSF(211.4,NURSWARD,1)),$P(^(1),"^",2) S Y=^NURSF(211.4,NURSWARD,1),NTLFTEE("PROF")=X/(100/$P(Y,"^",2)) S NTLFTEE("NPROF")=$S($P(Y,"^",2)<100:X/(100/(100-$P(Y,"^",2))),1:0)
 . E  S Y=^DIC(213.9,1,0),NTLFTEE("PROF")=X/(100/$P(Y,"^",7)) S NTLFTEE("NPROF")=$S($P(Y,"^",7)<100:X/(100/(100-$P(Y,"^",7))),1:0)
 . S $P(NREQ,U)=NTLFTEE("PROF"),$P(NREQ,U,2)=NTLFTEE("NPROF")/2,$P(NREQ,U,3)=NTLFTEE("NPROF")/2
 . F X=1:1:3 D
 . . S $P(NDFTEE,U,X)=$S($D(NPERCEN):($P(NFTEE,U,X)*NPERCEN),1:($P(NFTEE,U,X)/NBSEC)) S $P(NVAR,U,X)=$J($P(NDFTEE,U,X),1,1)-$J($P(NREQ,U,X),1,1)
 . . I $J($P(NDFTEE,U,X),1,1),$J($P(NREQ,U,X),1,1),NURSZAP'>6,NPCC S $P(NPROD,U,X)=($J($P(NREQ,U,X),1,1)/$J($P(NDFTEE,U,X),1,1))*100
 . . Q
 . K NPERCEN F X=1:1:3 S $P(NFTEE,U,X)=0
 . Q
 Q
ADDTOT ; ACCUM. PT. CATEGORY TOT.
 D ^NURSAPCH
 I NURSX="LEAVE"!(NURSX="OTH. FAC.")!(NURSX="AWOL") Q
 D EN6^NURSCUTL S NDATA=$P(^NURSF(214,DFN,0),U,4)
 I NURSADM,NDATA=$O(^NURSF(213.3,"B","DOMICILIARY",0)) S NCAT=1,NBED=NDATA G ADD
 I NDATA=$O(^NURSF(213.3,"B","RECOVERY ROOM",0))!(NDATA=$O(^NURSF(213.3,"B","HEMODIALYSYS",0))) S NCAT=1,NBED=NDATA G ADD
 S RPTDATE=DT,NURSCLAS("CL")=1 D EN2^NURSCUTL
 Q:NURSCLAS=""  S NCAT=$S('$D(^NURSA(214.6,NURSCLAS,0)):"",1:$P(^(0),"^",3)),NBED=$S('$D(^NURSA(214.6,NURSCLAS,0)):"",1:$P(^(0),"^",9))
 Q:(NCAT="")!(NBED="")  Q:NURSWARD'=$P(^NURSA(214.6,NURSCLAS,0),"^",8)
ADD ;
 S:'$D(NURSPC(NURFAC(2),NCAT,NURSWARD,NBED)) NURSPC(NURFAC(2),NCAT,NURSWARD,NBED)=0 I $D(NTCEN(NURSWARD)) S NURSPC(NURFAC(2),NCAT,NURSWARD,NBED)=NURSPC(NURFAC(2),NCAT,NURSWARD,NBED)+1,NTCEN(NURSWARD)=(NTCEN(NURSWARD)+1)
 Q
BEDSEC ;
 S (NBSEC,NI)=0 F  S NI=$O(NURSPC(NPFAC,1,NZ,NI)) Q:NI'>0  S NBSEC=NBSEC+1
 Q