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

NURSCPLC.m

Go to the documentation of this file.
NURSCPLC ;HIRMFO/RM,FT,MD-PATIENT CENSUS...WARD, AND HOSPITAL ;12/14/98
 ;;4.0;NURSING SERVICE;**20,22**;Apr 25, 1997
EN2 ; ENTRY FOR WARD PATIENT CENSUS
 Q:'$D(^DIC(213.9,1,"OFF"))  Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
 S (NURSZAP,NURPLSW,NURMDSW,NURQUIT,NURQUEUE)=0
 D EN9^NURSAGSP
 I NURMDSW S DIC(0)="AEMQZ",NURPLSCR=1 D EN5^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
 I NURMDSW=0,NURPLSW=1 S NURPLCSR=1 D PRD^NURSAGSP K NURPLSCR I $G(NUROUT) G QUIT
 W ! D EN1^NURSAGSP G:$G(NUROUT) QUIT
 W ! D EN6^NURSUT0 I $G(NURQUIT) S NUROUT=1 G QUIT
 W ! S ZTDESC="Nursing Patient Census",ZTRTN="START^NURSCPLC" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
 U IO S (NURSW1,NURPAGE,NUROUT)=0 K ^TMP($J)
 I NURHOSP S NURIEN=0 F  S NURIEN=$O(^NURSF(214,"AF","A",NURIEN)) Q:NURIEN'>0  S DFN="" F  S DFN=$O(^NURSF(214,"AF","A",NURIEN,DFN)) Q:DFN'>0  S NPWARD=NURIEN D EN6^NURSAUTL S NURSWARD=$E(NPWARD,1,20) W:$E(IOST)="C"&($R(100)) "." D SORT
 E  S NURSWARD="" F  S NURSWARD=$O(NURSNLOC(NURSWARD)) Q:NURSWARD=""  S NURIEN=0 F  S NURIEN=$O(NURSNLOC(NURSWARD,NURIEN)) Q:NURIEN'>0  S DFN=0 F  S DFN=$O(^NURSF(214,"AF","A",NURIEN,DFN)) Q:DFN'>0  W:$E(IOST)="C"&($R(100)) "." D SORT
 I $E(IOST)="P" F NURI=1:1 Q:NURI>NCOPY  D PRINT S (NURPAGE,NURSW1)=0 W:$G(NCOPY)>1 @IOF
 I $E(IOST)="C" D PRINT
QUIT ; KILL LOCAL VARIABLES
 D CLOSE^NURSUT1,^NURSKILL
 Q
SORT ; SORT OF PATIENT CENSUS
 S NURFAC(2)=$S($$EN12^NURSUT3(NURIEN)'="":$$EN12^NURSUT3(NURIEN),1:" BLANK")
 S NURPROG(4)=+$P(^NURSF(211.4,+NURIEN,1),U,4),NURPROG(4)=$$GET1^DIQ(212.7,+NURPROG(4),.01,"I") S:NURPROG(4)="" NURPROG(4)=" BLANK"
 I NURMDSW,$G(NURFAC)=0,NURFAC(2)'=NURFAC(1) Q
 I NURPLSW,$G(NURPROG)=0,NURPROG(4)'=NURPROG(1) Q
 D 1^VADPT
 S NBED=$S(VAIN(5)="":"  BLANK",1:VAIN(5)),N1=$S(VADM(1)="":"  BLANK",1:VADM(1))
 S:$G(NURSORT)="" NURSORT=1
 N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(4),NURSWARD))
 I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(4),NURSWARD)=X,^TMP($J,"NURLOC",NURSWARD)=""
 S ^TMP($J,"L1",X,NBED,N1,DFN)=""
 K VAIN,VADM Q
 I 'NURQUEUE,NURSW1,$E(IOST)="C" D ENDPG^NURSUT1 Q:NUROUT
 S NURSHD="PATIENT CENSUS"_$S($D(^TMP($J,"NURLOC",NL1)):" FOR "_$E(NL1,1,12),1:"")
 S NURSW1=1
 S NURPAGE=NURPAGE+1 W:$E(IOST)="C"!(NURPAGE>1) @IOF
 I NURMDSW,$G(NURHOSP) W !,?$$CNTR^NURSUT2($G(NURFAC(2))),$S($G(NURFAC(2))=" BLANK":"NO FACILITY",1:$G(NURFAC(2)))
 W !,$E(DT,4,5),"/",$E(DT,6,7),"/",$E(DT,2,3),?28,NURSHD,?68,"PAGE: ",NURPAGE,!
 W !,"ROOM/BED",?17,"PATIENT NAME",?42,"SSN",?55,"ABSENCE",?64,"BED SEC",?73,"ACUITY"
 W !,$$REPEAT^XLFSTR("-",80),!
PROD I NURPLSW,$G(NURPROG(4))'=" BLANK" W !?$$CNTR^NURSUT2(NURPROG(4)),$S($E(NURPROG(4),1)=" ":$E(NURPROG(4),2,99),1:$G(NURPROG(4))) W !,?$$CNTR^NURSUT2(NURPROG(4)),$$REPEAT^XLFSTR("-",$L(NURPROG(4))+1),!
 Q
PRINT ;PRINT ROUTINE
 I $O(^TMP($J,""))="",'$D(NURSNLOC) S NL1="THE HOSPITAL",NURPROG(4)=$S($G(NURPROG)=0:NURPROG(1),1:" BLANK"),NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:" BLANK") D HEADER W $C(7),!,"THERE IS NO DATA FOR THIS REPORT" Q
 I $O(^TMP($J,""))="",$D(NURSNLOC) S NURPROG(4)=$S($G(NURPROG)=0:NURPROG(1),1:" BLANK") S NL1="" F  S NL1=$O(NURSNLOC(NL1)) Q:NL1=""  D:NURSW1=0 HEADER S NURSW1=1 D NODATA^NURSUT1
 I $O(^TMP($J,""))'="",$D(NURSNLOC) D  I NURSW1=1 D ENDPG^NURSUT1 S NURSW1=0
 .  S (NURX,NURY,NURZ)="" F  S NURY=$O(^TMP($J,"L",NURY)) Q:NURY=""  F  S NURZ=$O(^TMP($J,"L",NURY,NURZ)) Q:NURZ=""  F  S NURX=$O(^TMP($J,"L",NURY,NURZ,NURX)) Q:NURX=""
 .  S NL1="" F  S NL1=$O(NURSNLOC(NL1)) Q:NL1=""  I '$D(^TMP($J,"NURLOC",NL1)) D
 .  .  S NURPROG(4)=$S($G(NURPROG)=0:NURPROG(1),1:" BLANK"),NURFAC(2)=$S($G(NURFAC)=0:NURFAC(1),1:"") D:NURSW1=0 HEADER S NURSW1=1 D NODATA^NURSUT1
 .  .  Q
 .  Q
 S NURFAC(2)="" F  S NURFAC(2)=$O(^TMP($J,"L",NURFAC(2))) Q:NURFAC(2)=""  D NM Q:$G(NUROUT)  S NURSW1=0
 Q
NM S NURPROG(4)="" F  S NURPROG(4)=$O(^TMP($J,"L",NURFAC(2),NURPROG(4))) Q:NURPROG(4)=""  D NN Q:$G(NUROUT)  W !!
 Q
NN S NL1="" F  S NL1=$O(^TMP($J,"L",NURFAC(2),NURPROG(4),NL1)) Q:NL1=""  S NURSORT=$G(^TMP($J,"L",NURFAC(2),NURPROG(4),NL1)) I NURSORT D HEADER Q:NUROUT  D NO Q:$G(NUROUT)
 Q
NO S NBED="" F  S NBED=$O(^TMP($J,"L1",NURSORT,NBED)) Q:NBED=""  D NP Q:NUROUT
 Q
NP S N1="" F  S N1=$O(^TMP($J,"L1",NURSORT,NBED,N1)) Q:N1=""  D NQ Q:NUROUT
 Q
NQ S DFN=0 F  S DFN=$O(^TMP($J,"L1",NURSORT,NBED,N1,DFN)) Q:DFN'>0  D PRINT1 Q:NUROUT
 Q
PRINT1 D DEM^VADPT S SSN=VA("PID") D ^NURSAPCH
 S NSEC=$S('$D(^NURSF(214,DFN,0)):"",$P(^(0),"^",4)="":"",'$D(^NURSF(213.3,$P(^NURSF(214,DFN,0),"^",4),0)):"",1:$P(^NURSF(213.3,$P(^NURSF(214,DFN,0),"^",4),1),"^",1)) D FNDCLAS
 D:$Y>(IOSL-6)!('NURSW1) HEADER Q:NUROUT  W !,$S(NBED'="  BLANK":NBED,1:""),?17,$S(N1'="  BLANK":$E(N1,1,19),1:""),?38,SSN,?56,$S($D(NURSX):NURSX,1:""),?66,NSEC,?75,NURCAT
 Q
FNDCLAS D EN6^NURSCUTL S NURSCLAS("CL")=1 D EN2^NURSCUTL S NURCAT=$S(NURSCLAS'="":$P(^NURSA(214.6,NURSCLAS,0),"^",3),1:"")
 Q