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

ANSQRS.m

Go to the documentation of this file.
ANSQRS ;IHS/OIRM/DSD/CSC - PRINT NURSING UNIT ROSTER; [ 02/25/98  10:32 AM ]
 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
 ;;PRINT NURSING UNIT ROSTER
EN I '$D(ANSPAR) S ANSPAR=^ANSD(51,1,0)
 Q:'$D(ANSUNIT)
 D SB1
 D ^ANSQRP
 W:$G(IOST)["P-" @IOF
 Q
SB1 ;CHECH THROUGH ALL CURRENTLY ADMITTED PATIENTS
 K ^TMP("ANS",$J)
 S ANSDFN=""
S1 F  S ANSDFN=$O(^ANSR("PT",ANSDFN)) Q:ANSDFN=""!$D(DTOUT)!$D(DUOUT)  D
 .S ANSADM=0
S2 .F  S ANSADM=$O(^ANSR("PT",ANSDFN,ANSADM)) Q:ANSADM=""!$D(DTOUT)!$D(DUOUT)  D
 ..Q:'$D(^ANSR(ANSADM,0))
 ..S X=$G(^ANSR(ANSADM,"DX"))
 ..Q:$P(X,U,2)'=ANSUNIT
 ..D SET
 Q
SET ;DETERMINE THE CARE LEVEL FOR THE PATIENT, ADJUSTMENT FACTORS AND
 ;SET TEMP GLOBAL FOR PRINTED ROSTER REPORT
 S (R,B)="/",Y=$P(X,U,3),(ANSCL,ANSAF,L)=""
 ;DETERMINE ROOM AND BED
 I Y S Y=$P($G(^ANSD(59.1,ANSUNIT,"R",Y,0)),U) D
 .S:Y R=Y
 .S Y=$P(X,U,4)
 .I R,Y,$D(^ANSD(59.1,ANSUNIT,"R",Y,"B",Y,0)) S Y=$P(^(0),U) S:Y B=Y
 ;FIND LATEST ASSESSMENT
 S M=0
 F  S M=$O(^ANSR(ANSADM,"AT",M)) Q:M=""!$D(DTOUT)!$D(DUOUT)  D
 .S N=0
 .F  S N=$O(^ANSR(ANSADM,"AT",M,N)) Q:N=""!$D(DTOUT)!$D(DUOUT)  D
 ..Q:'$D(^ANSR(N,0))
 ..Q:$P(^ANSR(N,0),U,5)="D"
 ..S L=N
 ;IF LATEST ASSESSMENT FOUND SET THE CARE LEVEL
 ;ANSCL = CARE LEVELS FOR EACH CRITERIA
 I L D
 .F I=1:1:10 S $P(ANSCL,U,I)=$P($G(^ANSR(L,"L",I,0)),U,2)
 .S N=0
 .F  S N=$O(^ANSR(L,"F",N)) Q:N=""  D
 ..S ANSAF=$G(ANSAF)_N_U
 S ^TMP("ANS",$J,R,B,ANSDFN)=X,^(ANSDFN,1)=ANSCL,^(2)=ANSAF
 Q