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

ANSQSS1.m

Go to the documentation of this file.
ANSQSS1 ;IHS/OIRM/DSD/CSC - CALCULATE NURSE STAFFING STATS; [ 02/25/98  10:32 AM ]
 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
 ;;CALCULATE NURSE STAFFING TOTALS FOR EACH DAY
 ;;"A" NODE OF GLOBAL IS INFO ON EACH ADMISSION
 ;;"O" NODE IS INFOR ON EACH OBSERVATION
EN I '$D(ANSPAR) S ANSPAR=^ANSD(51,1,0)
 D PERCENT
 S ANSD=0
 F  S ANSD=$O(^TMP("ANS",$J,ANSD)) Q:'ANSD  D
 .S ANSSH=0,(ANSTOT,ANSMAX)=""
 .F  S ANSSH=$O(^TMP("ANS",$J,ANSD,ANSSH)) Q:'ANSSH  D
 ..S (ANSAS,ANSCL,ANSRT)=""
 ..S:$D(^TMP("ANS",$J,ANSD,ANSSH,"A")) ANSAS=^("A")
 ..S:$D(^TMP("ANS",$J,ANSD,ANSSH,"O")) ANSCL=^("O")
 ..S T=0
 ..F L=1:1:6 S N=$P(ANSCL,U,L) D:N
 ...D:$D(ANSP(ANSSH)) SBRTL
 ...S $P(ANSTOT,U,L+4)=$P(ANSTOT,U,L+4)+N,T=T+N
 ..I T>ANSMAX S ANSMAX=T
 ..S N=$P(ANSCL,U,5)
 ..I N S ANSRT=ANSRT+(N*.5),$P(ANSTOT,U,4)=$P(ANSTOT,U,4)+N
 ..S T=0
 ..F L=1:1:6 S N=$P(ANSAS,U,L) I N D SBRTA S T=T+N
 ..S A=ANSRT,S="H",P=3 D SBADD
 ..S $P(ANSTOT,U,3)=$P(ANSTOT,U,3)+T,$P(ANSTOT,U,11)=$P(ANSTOT,U,11)+ANSRT
 .D B1
 D C1
 Q
B1 ;SET DAILY TOTAL AND SET GLOBAL NODE WITH TOTAL SUMMARY FOR THE DAY
 S $P(ANSTOT,U,2)=ANSMAX,T=0
 F I=5:1:10 S T=T+$P(ANSTOT,U,I),$P(ANSTOT,U,I)=$P(ANSTOT,U,I)/ANSNS
 S $P(ANSTOT,U)=T/ANSNS,T=0
 F I=1:1:3 I $D(^TMP("ANS",$J,ANSD,I,"H")) S T=T+$P(^("H"),U)-$P(^("H"),U,2)
 S $P(ANSTOT,U,12)=T,^TMP("ANS",$J,ANSD,"T")=ANSTOT
 Q
C1 D ^ANSQSP
 Q
SBRTL ;CALCULATE THE REQUIRED NURSING TIME FOR EACH LEVEL OF CARE
 ;ANSP(ANSSH) = PERCENT OF CARE REQUIRED FOR THE SHIFT
 ;ANSH(L) = HOURS OF CARE REQUIRED BY LEVEL OF CARE FOR THE DAY
 ;N = NUMBER OF PATIENTS AT THE CARE LEVEL
 S H=ANSP(ANSSH)*ANSH(L)*N,ANSRT=ANSRT+H
 Q
SBRTA ;CALCULATE THE NUMBER OF HOURS OF NURSING TIME REQUIRED FOR ADMISSIONS
 ;ANSA(L) = HOURS REQUIRED FOR ADMISSION FOR EACH CARE LEVEL
 ;N =  NUMBER OF PATIENTS AT THE CARE LEVEL
 S H=ANSA(L)*N,ANSRT=ANSRT+H
 Q
SBADD ;SET TEMP GLOBAL NODES FOR PRINTOUT
 I '$D(^TMP("ANS",$J,ANSD,ANSSH,S)) S ^TMP("ANS",$J,ANSD,ANSSH,S)=""
 S $P(^TMP("ANS",$J,ANSD,ANSSH,S),U,P)=$P(^TMP("ANS",$J,ANSD,ANSSH,S),U,P)+A,ANSRT=$P(^(S),U,P)
 Q
PERCENT ;CALCULATE THE PERCENT OF TIME REQUIRED PER SHIFT
 ;ANSNS = NUMBER OF SHIFTS
 K ANSP
 S ANSNS=$P(ANSPAR,U,5),X=""
 S X=$G(^ANSD(51.1,ANSNS,1))
 F I=1:1:ANSNS S ANSP(I)=$P(X,U,I)/100
 Q