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

ANSEA.m

Go to the documentation of this file.
ANSEA ;IHS/OIRM/DSD/CSC - ENTER/EDIT ACUITY DATA; [ 02/25/98  10:32 AM ]
 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
 ;ENTRY POINT TO ADD OR EDIT PATIENT ACUITY DATA
EN N C,D,I,L,N,P,T,X,Y,Z
 K ANSDT
 F  D EN1 Q:$D(DTOUT)!$D(DUOUT)
EXIT K ANS,ANSDA,ANSDT,ANSP,ANSS,ANSSH,ANSSTR,ANSUN,ANT,ANSX
 Q
EN1 D HEAD,^ANSUD
 Q:'$D(ANSUN)!'$D(ANSDT)!'$D(ANSSH)
 F  D EN2 Q:$D(DTOUT)!$D(DUOUT)!'$D(ANSDFN)
 K DTOUT,DUOUT
 Q
EN2 D DISP
 K ANSDFN,DTOUT,DUOUT
 D ^ANSUPT
 Q:$D(DTOUT)!$D(DUOUT)!'$D(ANSDFN)
 D FIND
 I '$D(^ANSR(+ANSADM,0)) D  Q
 .W *7,!!,"  NOT An Inpatient During This Time."
 .D PAUSE^ANSDIC
 I ANSUN'=$P(^ANSR(ANSADM,0),U,3) D  Q
 .W *7,!!," NOT Admitted to this Unit During This Time."
 .D PAUSE^ANSDIC
 D CUR
 D ^ANSEA1
 K DUOUT,DTOUT
 Q
FIND ;FIND MOST RECENT ADMISSION
 S I=9999998-ANSDT,ANSADM=0,W=ANSDT_"."_ANSSH
 F  S I=$O(^ANSR("AA",ANSDFN,I)) Q:'I  D
 .S N=0
 .F  S N=$O(^ANSR("AA",ANSDFN,I,N)) Q:'N!ANSADM  D
 ..S A=$P(^ANSR(N,0),U)_"."_$P(^(0),U,2),E=$P($G(^("DX")),U,5)
 ..S D=DT_".9"
 ..I E,$D(^ANSR(E,0)) S D=$P(^(0),U)_"."_$P(^(0),U,2)
 ..I W'<A,W'>D S ANSADM=N
 Q
CUR ;DATA FOR CURRENT ADMISSION
 S (A,ANSDA,N,M)=0,X=ANSDT_"."_ANSSH
 S ANSMR=$P(^ANSR(ANSADM,0),U)_"."_$P(^(0),U,2)
 F I=1:1 S M=$O(^ANSR(ANSADM,"AT",X,M)) Q:M=""  I $D(^ANSR(M,0)),$P(^(0),U,5)="O" S (N,ANSDA)=M
 S M=0
 F  S M=$O(^ANSR(ANSADM,"AT",M)) Q:M=""!(M>X)  D
 .S O=0,ANSMR=M
 .F  S O=$O(^ANSR(ANSADM,"AT",M,O)) Q:O=""  I $D(^ANSR(O,0)) D
 ..I $P(^ANSR(O,0),U,5)="D" S A=0 Q
 ..S N=O
 S (ANSCL,ANSAF,ANSDX)=""
 I ANSDA S N=ANSDA
 I $O(^ANSR(ANSADM,"AT",X))="" S ANSDX=$G(^ANSR(ANSADM,"DX")) I $P(ANSDX,U,2)'=ANSUN S ANSDX=$P(ANSDX,U)
 Q:'N
 S M=0
 F  S M=$O(^ANSR(N,"L",M)) Q:M<1  D
 .S $P(ANSCL,U,M)=$P($G(^ANSR(N,"L",M,0)),U,2)
 S M=0
 F  S M=$O(^ANSR(N,"F",M)) Q:M=""  D
 .I $D(^ANSR(N,"F",M,0)) S ANSAF=$G(ANSAF)_M_U
 Q
 S ANSX="PATIENT ACUITY ASSESSMENT"
 W !!,?80-$L(ANSX)/2,ANSX
 Q
SUBH S Y=ANSDT
 X ^DD("DD")
 W !!,?6,Y
 S Y="",ANSS=$P(ANSPAR,U,5)
 I $D(ANSSH) S X=$T(@ANSS),Y=$P($P(X,";;",ANSSH+1),U,2) W ?30,Y," Shift"
 I ANSUN,$D(^ANSD(59.1,ANSUN,0)) S Z=$P(^(0),U) W ?56,"Unit ",Z
 Q
DISP D HEAD,SUBH
 Q
2 ;;1^DAY;;2^NIGHT
3 ;;1^DAY;;2^EVENING;;3^NIGHT