114 lines
5.3 KiB
Mathematica
114 lines
5.3 KiB
Mathematica
NURAAGS1 ;HIRMFO/RM,MD-MULTIDIVISIONAL GENERIC SORT ROUTINE FOR ADMIN REPORTS ;5/2/97
|
|
;;4.0;NURSING SERVICE;**1**;Apr 25, 1997
|
|
SETCAT ; SET CATEGORY VARIABLE NURSCATY
|
|
N X,Y
|
|
S X=$P($G(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),U,3),Y=$G(^NURSF(211.3,+X,0))
|
|
I Y'="" S NURSCATY=$P(Y,U,5) S:NURSCATY="O" NURSCATY=NURSCATY_" "_$$UP^XLFSTR($P(Y,U,6))
|
|
E S NURSCATY=" BLANK"
|
|
Q
|
|
SETLOC ; SET LOCATION VARIABLE NLOCN
|
|
S NLOCN=$S($D(^NURSF(211.8,NURNODE4,0)):$P(^(0),U),1:"")
|
|
I +NLOCN S NPWARD=NLOCN D EN7^NURSAUTL S NLOCN(1)=$S(NPWARD'="":$E(NPWARD,1,10),1:" BLANK")
|
|
Q
|
|
SETPOS ; SET SERVICE POSITION AND PRIORITY SEQUENCE VARIABLES NSPOSN,NPRI
|
|
I $D(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),$P(^(0),U,3)'="",$D(^NURSF(211.3,$P(^NURSF(211.8,NURNODE4,1,NURNODE5,0),U,3),0)) G C
|
|
E S (NSPOSN,NPRI)=" BLANK" Q
|
|
C I $P(^NURSF(211.3,$P(^NURSF(211.8,NURNODE4,1,NURNODE5,0),U,3),0),U,1)'="" S NSPOSN=$P(^(0),U,1)
|
|
E S NSPOSN=" BLANK"
|
|
I $P(^NURSF(211.3,$P(^NURSF(211.8,NURNODE4,1,NURNODE5,0),U,3),0),U,3)'="" S NPRI=$P(^(0),U,3)
|
|
E S NPRI=" BLANK"
|
|
Q
|
|
SETFAC ; SET FACILITY VARIBLE NURFAC(2)
|
|
I $G(NURMDSW) S NURFAC(2)=$$EN11^NURSUT3($G(NURNODE4)) S:NURFAC(2)="" NURFAC(2)=" BLANK"
|
|
E S NURFAC(2)=" BLANK"
|
|
Q
|
|
SETPROG ; SET PRODUCT LINE VARIBLE NURPROG(2)
|
|
I $G(NURPLSW) D
|
|
. I NURNEN=3!(NURNEN=4) D
|
|
. . S NURPROG(2)=$O(^NURSF(211.4,"B",+$P(^NURSF(211.8,NURNODE4,0),U),""))
|
|
. . S NURPROG(2)=+$P($G(^NURSF(211.4,+NURPROG(2),1)),U,4)
|
|
. . Q
|
|
. I NURNEN=1!(NURNEN=2) D
|
|
. . S NURPROG(2)=$P($G(^NURSF(211.8,+NURNODE4,1,+NURNODE5,0)),U,3)
|
|
. . S NURPROG(2)=+$P($G(^NURSF(211.3,+NURPROG(2),0)),U,7)
|
|
. . Q
|
|
. S:NURPROG(2)="" NURPROG(2)=+$O(^NURSF(212.7,"B","NURSING",0))
|
|
. S NURPROG(2)=$$GET1^DIQ(212.7,+NURPROG(2),.01,"I")
|
|
. S:NURPROG(2)="" NURPROG(2)=" BLANK"
|
|
. Q
|
|
E S NURPROG(2)=" BLANK"
|
|
Q
|
|
SETCERT ; SET ^TMP($J FOR CERTIFICATION REPORTS
|
|
S DATA=+$P($G(^NURSF(210,DA,12,D0,0)),U) I DATA>0,$P($G(^NURSF(212.2,+DATA,0)),U,2)'="" S NSPEC(1)=$P(^(0),U,2)
|
|
E S NSPEC(1)=" BLANK"
|
|
I $P($G(^NURSF(210,DA,12,D0,0)),U,4)'="" S NSPEC=$P(^(0),U,4)
|
|
E S NSPEC=" BLANK"
|
|
I 'NSP,NSPC'=NSPEC(1) Q
|
|
I 'NSP(1),NSPEC>NSPC(2)!(NSPEC<NSPC(1)) Q
|
|
I NSPEC(1)'=" BLANK" D SETUTIL
|
|
Q
|
|
SETMIL ; SET ^TMP($J FOR MILITARY REPORTS
|
|
I $D(^NURSF(210,DA,10,D0,0)),$P(^(0),U,1)'="" S NSPEC(1)=$P(^(0),U,1)
|
|
E S NSPEC(1)=" BLANK"
|
|
I $D(^NURSF(210,DA,10,D0,0)),$P(^(0),U,2)'="",$D(^DIC(23,$P(^NURSF(210,DA,10,D0,0),U,2),0)),$P(^(0),U,1)'="" S NSPEC=$P(^(0),U,1)
|
|
E S NSPEC=" BLANK"
|
|
I 'NSP,NSPC'=NSPEC(1) Q
|
|
I 'NSP(1),NSPC(1)'=NSPEC Q
|
|
D SETUTIL
|
|
Q
|
|
SETUTIL ;
|
|
W:$E(IOST)="C"&($R(100)) "."
|
|
I NURPLSW S NURPROG(3)=+$O(^NURSF(212.7,"B","NURSING",0)),NURPROG(3)=$$GET1^DIQ(212.7,NURPROG(3),.01,"I") S:NURPROG(2)=NURPROG(3) NURPROG(2)=" "_NURPROG(2)
|
|
I NURNEN=1 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC(1),NSPEC))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC(1),NSPEC)=X
|
|
. S ^TMP($J,"L1",X,NNM,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
I NURNEN=2 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC(1)))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC(1))=X
|
|
. S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
I NURNEN=3 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC(1)))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC(1))=X
|
|
. S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
I NURNEN=4 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN)=X
|
|
. S ^TMP($J,"L1",X,NSPEC(1),NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
Q
|
|
SETLIC ; SET VARIABLES FOR LICENSE REPORTS
|
|
I $D(^NURSF(210,DA,4,D0,0)),$P(^(0),U,3)'="" S NSPEC=$P(^(0),U,3)_D0
|
|
E S NSPEC=" BLANK"_D0
|
|
Q
|
|
SETUPTL ; BUILD TMP ARRAY
|
|
W:$E(IOST)="C"&($R(100)) "."
|
|
I NURPLSW S NURPROG(3)=+$O(^NURSF(212.7,"B","NURSING",0)),NURPROG(3)=$$GET1^DIQ(212.7,NURPROG(3),.01,"I") S:NURPROG(2)=NURPROG(3) NURPROG(2)=" "_NURPROG(2)
|
|
I NURNEN=1 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,NNM))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,NNM)=X
|
|
. S ^TMP($J,"L1",X,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
I NURNEN=2 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC)=X
|
|
. S ^TMP($J,"L1",X,NNM,DA,NURNODE4)=""
|
|
. Q
|
|
I NURNEN=3 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC)=X
|
|
. S ^TMP($J,"L1",X,NNM,DA,NURNODE4,NURNODE5)=""
|
|
. Q
|
|
I NURNEN=4 S:$G(NURSORT)="" NURSORT=1 D
|
|
. N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN))
|
|
. I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN)=X
|
|
. S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4)=""
|
|
. Q
|
|
Q
|
|
CHKPOS ; SELECT ACTIVE POSITIONS
|
|
S NURNEN(1)=0 I $P(^NURSF(211.8,NURNODE4,1,NURNODE5,0),U)'>DT&('$P(^(0),U,6)!($P(^(0),U,6)'<DT)) S NURNEN(1)=1
|
|
Q
|