1 | NURAAGS1 ;HIRMFO/RM,MD-MULTIDIVISIONAL GENERIC SORT ROUTINE FOR ADMIN REPORTS ;5/2/97
|
---|
2 | ;;4.0;NURSING SERVICE;**1**;Apr 25, 1997
|
---|
3 | SETCAT ; SET CATEGORY VARIABLE NURSCATY
|
---|
4 | N X,Y
|
---|
5 | S X=$P($G(^NURSF(211.8,NURNODE4,1,NURNODE5,0)),U,3),Y=$G(^NURSF(211.3,+X,0))
|
---|
6 | I Y'="" S NURSCATY=$P(Y,U,5) S:NURSCATY="O" NURSCATY=NURSCATY_" "_$$UP^XLFSTR($P(Y,U,6))
|
---|
7 | E S NURSCATY=" BLANK"
|
---|
8 | Q
|
---|
9 | SETLOC ; SET LOCATION VARIABLE NLOCN
|
---|
10 | S NLOCN=$S($D(^NURSF(211.8,NURNODE4,0)):$P(^(0),U),1:"")
|
---|
11 | I +NLOCN S NPWARD=NLOCN D EN7^NURSAUTL S NLOCN(1)=$S(NPWARD'="":$E(NPWARD,1,10),1:" BLANK")
|
---|
12 | Q
|
---|
13 | SETPOS ; SET SERVICE POSITION AND PRIORITY SEQUENCE VARIABLES NSPOSN,NPRI
|
---|
14 | 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
|
---|
15 | E S (NSPOSN,NPRI)=" BLANK" Q
|
---|
16 | 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)
|
---|
17 | E S NSPOSN=" BLANK"
|
---|
18 | I $P(^NURSF(211.3,$P(^NURSF(211.8,NURNODE4,1,NURNODE5,0),U,3),0),U,3)'="" S NPRI=$P(^(0),U,3)
|
---|
19 | E S NPRI=" BLANK"
|
---|
20 | Q
|
---|
21 | SETFAC ; SET FACILITY VARIBLE NURFAC(2)
|
---|
22 | I $G(NURMDSW) S NURFAC(2)=$$EN11^NURSUT3($G(NURNODE4)) S:NURFAC(2)="" NURFAC(2)=" BLANK"
|
---|
23 | E S NURFAC(2)=" BLANK"
|
---|
24 | Q
|
---|
25 | SETPROG ; SET PRODUCT LINE VARIBLE NURPROG(2)
|
---|
26 | I $G(NURPLSW) D
|
---|
27 | . I NURNEN=3!(NURNEN=4) D
|
---|
28 | . . S NURPROG(2)=$O(^NURSF(211.4,"B",+$P(^NURSF(211.8,NURNODE4,0),U),""))
|
---|
29 | . . S NURPROG(2)=+$P($G(^NURSF(211.4,+NURPROG(2),1)),U,4)
|
---|
30 | . . Q
|
---|
31 | . I NURNEN=1!(NURNEN=2) D
|
---|
32 | . . S NURPROG(2)=$P($G(^NURSF(211.8,+NURNODE4,1,+NURNODE5,0)),U,3)
|
---|
33 | . . S NURPROG(2)=+$P($G(^NURSF(211.3,+NURPROG(2),0)),U,7)
|
---|
34 | . . Q
|
---|
35 | . S:NURPROG(2)="" NURPROG(2)=+$O(^NURSF(212.7,"B","NURSING",0))
|
---|
36 | . S NURPROG(2)=$$GET1^DIQ(212.7,+NURPROG(2),.01,"I")
|
---|
37 | . S:NURPROG(2)="" NURPROG(2)=" BLANK"
|
---|
38 | . Q
|
---|
39 | E S NURPROG(2)=" BLANK"
|
---|
40 | Q
|
---|
41 | SETCERT ; SET ^TMP($J FOR CERTIFICATION REPORTS
|
---|
42 | 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)
|
---|
43 | E S NSPEC(1)=" BLANK"
|
---|
44 | I $P($G(^NURSF(210,DA,12,D0,0)),U,4)'="" S NSPEC=$P(^(0),U,4)
|
---|
45 | E S NSPEC=" BLANK"
|
---|
46 | I 'NSP,NSPC'=NSPEC(1) Q
|
---|
47 | I 'NSP(1),NSPEC>NSPC(2)!(NSPEC<NSPC(1)) Q
|
---|
48 | I NSPEC(1)'=" BLANK" D SETUTIL
|
---|
49 | Q
|
---|
50 | SETMIL ; SET ^TMP($J FOR MILITARY REPORTS
|
---|
51 | I $D(^NURSF(210,DA,10,D0,0)),$P(^(0),U,1)'="" S NSPEC(1)=$P(^(0),U,1)
|
---|
52 | E S NSPEC(1)=" BLANK"
|
---|
53 | 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)
|
---|
54 | E S NSPEC=" BLANK"
|
---|
55 | I 'NSP,NSPC'=NSPEC(1) Q
|
---|
56 | I 'NSP(1),NSPC(1)'=NSPEC Q
|
---|
57 | D SETUTIL
|
---|
58 | Q
|
---|
59 | SETUTIL ;
|
---|
60 | W:$E(IOST)="C"&($R(100)) "."
|
---|
61 | 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)
|
---|
62 | I NURNEN=1 S:$G(NURSORT)="" NURSORT=1 D
|
---|
63 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC(1),NSPEC))
|
---|
64 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC(1),NSPEC)=X
|
---|
65 | . S ^TMP($J,"L1",X,NNM,DA,NURNODE4,NURNODE5)=""
|
---|
66 | . Q
|
---|
67 | I NURNEN=2 S:$G(NURSORT)="" NURSORT=1 D
|
---|
68 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC(1)))
|
---|
69 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC(1))=X
|
---|
70 | . S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
---|
71 | . Q
|
---|
72 | I NURNEN=3 S:$G(NURSORT)="" NURSORT=1 D
|
---|
73 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC(1)))
|
---|
74 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC(1))=X
|
---|
75 | . S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
---|
76 | . Q
|
---|
77 | I NURNEN=4 S:$G(NURSORT)="" NURSORT=1 D
|
---|
78 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN))
|
---|
79 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN)=X
|
---|
80 | . S ^TMP($J,"L1",X,NSPEC(1),NSPEC,NNM,DA,NURNODE4,NURNODE5)=""
|
---|
81 | . Q
|
---|
82 | Q
|
---|
83 | SETLIC ; SET VARIABLES FOR LICENSE REPORTS
|
---|
84 | I $D(^NURSF(210,DA,4,D0,0)),$P(^(0),U,3)'="" S NSPEC=$P(^(0),U,3)_D0
|
---|
85 | E S NSPEC=" BLANK"_D0
|
---|
86 | Q
|
---|
87 | SETUPTL ; BUILD TMP ARRAY
|
---|
88 | W:$E(IOST)="C"&($R(100)) "."
|
---|
89 | 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)
|
---|
90 | I NURNEN=1 S:$G(NURSORT)="" NURSORT=1 D
|
---|
91 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,NNM))
|
---|
92 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NURSCATY,NSPEC,NNM)=X
|
---|
93 | . S ^TMP($J,"L1",X,DA,NURNODE4,NURNODE5)=""
|
---|
94 | . Q
|
---|
95 | I NURNEN=2 S:$G(NURSORT)="" NURSORT=1 D
|
---|
96 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC))
|
---|
97 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NPRI,NSPOSN,NSPEC)=X
|
---|
98 | . S ^TMP($J,"L1",X,NNM,DA,NURNODE4)=""
|
---|
99 | . Q
|
---|
100 | I NURNEN=3 S:$G(NURSORT)="" NURSORT=1 D
|
---|
101 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC))
|
---|
102 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NURSCATY,NSPEC)=X
|
---|
103 | . S ^TMP($J,"L1",X,NNM,DA,NURNODE4,NURNODE5)=""
|
---|
104 | . Q
|
---|
105 | I NURNEN=4 S:$G(NURSORT)="" NURSORT=1 D
|
---|
106 | . N X S X=$G(^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN))
|
---|
107 | . I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP($J,"L",NURFAC(2),NURPROG(2),NLOCN(1),NPRI,NSPOSN)=X
|
---|
108 | . S ^TMP($J,"L1",X,NSPEC,NNM,DA,NURNODE4)=""
|
---|
109 | . Q
|
---|
110 | Q
|
---|
111 | CHKPOS ; SELECT ACTIVE POSITIONS
|
---|
112 | 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
|
---|
113 | Q
|
---|