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