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

ANSUPT.m

Go to the documentation of this file.
ANSUPT ;IHS/OIRM/DSD/CSC - SELECT PATIENT; [ 02/25/98  10:32 AM ]
 ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
 ;;SELECT PATIENT
A1 D:$G(ANSCOUNT)<1 MSG
 K ANSDFN
 S DIC="^AUPNPAT(",DIC(0)="AEMQZ",DIC("A")="Enter Patient's Name or Chart NO.: "
 D DIC^ANSDIC
 S:$G(Y)>0 ANSDFN=+Y
 Q
INPATAR ;SET UP INPATIENT ARRAY
 K ^TMP("ANSPA",$J),DUOUT
 S ANSX="",ANSX=$O(^ANSR("PT",ANSX))
 I ANSX="" W *7,!!,?10,"No current inpatients....." Q
 S ANSX=""
 F  S ANSX=$O(^ANSR("PT",ANSX)) Q:ANSX=""!$D(DUOUT)  D ARRAY
 D:'$D(DUOUT) INPAT
 K DUOUT
 Q
ARRAY ;SET UP VARIABLES AND TEMPORARY INPAT GLOBAL
 S (ANSINPT,ANSUNIT,ANSROOM,ANSBED)=""
 S (ANSPUNIT,ANSPROOM,ANSPBED)=0
 I '$D(^DPT(ANSX,0)) Q
 S ANSINPT=$P(^DPT(ANSX,0),U)
 S ANSY=$O(^ANSR("PT",ANSX,""))
 Q:'ANSY
 Q:'$D(^ANSR(ANSY,0))!'$D(^("DX"))
 S ANSPUNIT=$P(^ANSR(ANSY,"DX"),U,2),ANSUNIT=$S(ANSPUNIT:^ANSD(59.1,ANSPUNIT,0),1:"NOT SPECIFIED")
 S ANSPROOM=$P(^ANSR(ANSY,"DX"),U,3),ANSROOM=$S(ANSPUNIT&ANSPROOM:^ANSD(59.1,ANSPUNIT,"R",ANSPROOM,0),1:"UNK")
 S ANSBED=$S(ANSPUNIT&ANSPROOM&($P(^ANSR(ANSY,"DX"),U,4)):^ANSD(59.1,ANSPUNIT,"R",ANSPROOM,"B",$P(^ANSR(ANSY,"DX"),U,4),0),1:"UNK")
 D CURASS
 S ^TMP("ANSPA",$J,ANSINPT,ANSUNIT,ANSROOM,ANSBED,ANSCADT)=""
 Q
INPAT ;PRINT INPATIENT ARRAY HEADING
 W !!,?5,"You may choose one of the following inpatients:"
 W !,"================================================================================"
 W !,"LAST ASSESS",!,"DATE",?7,"SHFT",?17,"NAME",?50,"UNIT",?67,"ROOM",?77,"BED"
 W !,"-----  ----",?13,"-----------------------------------",?50,"---------------",?67,"--------",?77,"---"
 S ANSZ=0,(ANSINPT,ANSUNIT,ANSROOM,ANSBED,ANSCADT)=""
 F  S ANSINPT=$O(^TMP("ANSPA",$J,ANSINPT)) Q:ANSINPT=""!$D(DUOUT)  D PARRAY
 Q
PARRAY ;SET PRINT ARRAY VARIALBES
 S (ANSUNIT,ANSROOM,ANSBED,ANSCADT)=""
 S ANSUNIT=$O(^TMP("ANSPA",$J,ANSINPT,ANSUNIT))
 S:ANSUNIT ANSROOM=$O(^TMP("ANSPA",$J,ANSINPT,ANSUNIT,ANSROOM))
 S:ANSROOM ANSBED=$O(^TMP("ANSPA",$J,ANSINPT,ANSUNIT,ANSROOM,ANSBED))
 S:ANSBED ANSCADT=$O(^TMP("ANSPA",$J,ANSINPT,ANSUNIT,ANSROOM,ANSBED,ANSCADT))
 S ANSZ=ANSZ+1
 D:'$D(DUOUT) LIST
 Q
LIST ;PRINT LIST OF INPATIENTS
 I ANSCADT["NONE" W !,"NONE"
 E  W !,$E(ANSCADT,4,5)_"-"_$E(ANSCADT,6,7),?9,$P(ANSCADT,".",2)
 W ?13,$E(ANSINPT,1,35),?50,ANSUNIT,?67,ANSROOM,?77,ANSBED
 D LIST1:ANSZ>17
 Q
LIST1 I ANSINPT]"" D
 .W !!,?10,"There are additional inpatients."
 .D PAUSE^ANSDIC S ANSZ=0
 Q
CURASS ;FIND DATE AND SHIFT OF MOST RECENT ASSESSMENT
 S (ANSCA,ANSCADT)="",(AST,AST1)=0
 I '$D(^ANSR(ANSY,"AT")) S ANSCADT="   NONE" Q
 F  S ANSCA=$O(^ANSR(ANSY,"AT",ANSCA)) Q:ANSCA=""  S AST=AST+1
 D ANSCADT
 Q
ANSCADT F I=0:1:AST-1 S ANSCADT=$O(^ANSR(ANSY,"AT",ANSCADT))
 Q
MSG ;EP;
 S ANSCOUNT=1,DIR(0)="YO",DIR("A")="Do you want to see a list of current inpatients",DIR("B")="NO"
 W !
 D DIR^ANSDIC
 Q:$D(DTOUT)!$D(DUOUT)!($G(Y)'=1)
 D INPATAR
 K ^TMP("ANSPA",$J),ANSX,ANSINPT,ANSUNIT,ANSROOM,ANSBED,ANSPUNIT,ANSPROOM,ANSPBED,ANSZ
 Q