source: WorldVistAEHR/trunk/r/NURSING_SERVICE-NUR/NURSUT5.m@ 1204

Last change on this file since 1204 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.9 KB
RevLine 
[613]1NURSUT5 ;HIRMFO/WAA-API FOR NURS LOCATION (#211.4) FILE ;2/29/00
2 ;;4.0;NURSING SERVICE;**31**;APR 25, 1997
3 ;
4 ;Nursing Unit Function
5 ; Input Values:
6 ; FUNCT = Piece1_^_Piece2
7 ; Piece1 must contain an "L" or "Q"
8 ; Piece1 "L" means Look-up of specified entry
9 ; in File 211.4, and
10 ; Piece2 must contain the IEN for
11 ; the entry in File 211.4.
12 ;
13 ; Piece1 "Q" means do a DIC style query on File
14 ; 211.4, and
15 ; Piece2 must contain "I","A" or
16 ; ""(i.e., null). This will be the screen
17 ; used on the look-up. The API will do a
18 ; DIC style look-up for the ward.
19 ; "I" means look-up only inactive wards.
20 ; "A" means look-up only active wards.
21 ; "" means look-up all wards.
22 ;
23 ; In both cases (Query or Look-up) the data will be returned
24 ; in ARRAY, which is called by reference, in the following
25 ; format.
26 ;
27 ; .ARRAY = Recommend the return array should be namespaced.
28 ;
29 ;Return Values:
30 ; ARRAY = -1 means that the Look-up or Query failed
31 ; ARRAY = IEN means that the Look-up or Query was
32 ; successful.
33 ;
34 ;Return Array:
35 ;ARRAY(IEN,.01) = Pointer to File 44_"^"_External value of Hospital
36 ; Location file(44), Name field(.01)
37 ;ARRAY(IEN,.02) = Facility pointer to File 4_"^"_External name of
38 ; facility
39 ;ARRAY(IEN,.03) = Pointer to File 212.7_"^"_External value of NURS
40 ; Product Line file(212.7), Name field(.01)
41 ;ARRAY(IEN,1) = Patient care status internal value_"^"_External
42 ; value of Patient care status
43 ;ARRAY(IEN,1.5) = Ward status Internal value_"^"_External value
44 ; of Ward status
45 ;ARRAY(IEN,2) = Total number of MAS ward pointers
46 ; X = the IEN of the entry within the MAS ward Multiple.
47 ;ARRAY(IEN,2,X,.01) = Pointer to File 42_"^"_External value of Ward
48 ; Location file(42), Name field(.01)
49 ;ARRAY(IEN,2,X,1) = Pointer to File 213.3_"^"_External value of
50 ; NURS AMIS Ward file(213.3), Bed Section
51 ; field(.01)
52 ;ARRAY(IEN,4)=Total number of entries within the AMIS ward pointer.
53 ; Y = the IEN of the entry within the AMIS Bed section
54 ; Multiple
55 ;ARRAY(IEN,4,Y,.01) = Pointer to file 213.3_"^"_ External
56 ; value of NURS AMIS Ward file(213.3),
57 ; Bed Section field(.01)
58 ;ARRAY(IEN,11) = Professional Percentage
59 ;ARRAY(IEN,12) = Pointer to File 211.5_"^"_External value of NURS
60 ; Clinical Background file(211.5), Description
61 ; field(.01)
62 ;ARRAY(IEN,37) = Indicates whether or not active staff is assigned
63 ; to this ward.
64 ;
65WARD(FUNCT,ARRAY) ; Main Entry
66 N ACT,NODE,DISYS,I,NURACTV,NURMDSW,X,XXX,YY,ZZ
67 S ARRAY=-1
68 S ACT=$P(FUNCT,U)
69 I ACT="Q" D
70 . ; DIC Query Lookup for data
71 . N Y,SCREEN,DIC,X,DUOUT,DTOUT
72 . S SCREEN=$P(FUNCT,U,2) Q:"AI"'[SCREEN
73 . S DIC="^NURSF(211.4,",DIC(0)="AEMNXQ"
74 . I SCREEN'="" S DIC("S")="I $$GET1^DIQ(211.4,+Y,1.5,""I"")=SCREEN"
75 . D ^DIC
76 . I Y'=-1 S ARRAY=+Y
77 . Q
78 I ACT="L" D
79 . ; Lookup/load ARRAY
80 . N IEN
81 . S IEN=+$P(FUNCT,U,2)
82 . I $G(^NURSF(211.4,IEN,0))="" S IEN=-1
83 . S ARRAY=IEN
84 . Q
85 Q:ARRAY=-1
86 D LOAD
87 Q
88LOAD ; This will load the data into ARRAY
89 Q:ARRAY=-1
90 N I,J,IEN,LINE
91 S IEN=ARRAY
92 S J=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),.01,"E")
93 S ARRAY(IEN,.01)=+$G(^NURSF(211.4,IEN,0))_U_$P(J,"NUR ",2)
94 S ARRAY(IEN,.02)=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),3,"I")_U
95 S ARRAY(IEN,.02)=ARRAY(IEN,.02)_$$GET1^DIQ(211.4,IEN,.02,"E")
96 S LINE=$G(^NURSF(211.4,IEN,1))
97 I LINE'="" D
98 . I $P(LINE,U,4)'="" S ARRAY(IEN,.03)=$P(LINE,U,4)_U_$$GET1^DIQ(212.7,$P(LINE,U,4),.01,"E")
99 . I $P(LINE,U)'="" S ARRAY(IEN,1)=$P(LINE,U)_U_$$GET1^DIQ(211.4,IEN,1,"E")
100 . I $P(LINE,U,2)'="" S ARRAY(IEN,11)=$P(LINE,U,2)
101 . I $P(LINE,U,3)'="" S ARRAY(IEN,12)=$P(LINE,U,3)_U_$$GET1^DIQ(211.5,$P(LINE,U,3),.01,"E")
102 . Q
103 I $G(^NURSF(211.4,IEN,"I"))'="" S ARRAY(IEN,1.5)=$P(^("I"),U)_U_$$GET1^DIQ(211.4,IEN,1.5,"E")
104 S ARRAY(IEN,37)=$$GET1^DIQ(211.4,IEN,37,"E")
105 F NODE=3,4 I +$P($G(^NURSF(211.4,IEN,NODE,0)),U,4) D SUB
106 Q
107SUB ; Get sub node data for 3, and 4
108 N X,Z,SNODE
109 S (X,Z)=0
110 S SNODE=$S(NODE=3:2,NODE=4:4,1:0)
111 Q:'SNODE
112 F S X=$O(^NURSF(211.4,IEN,NODE,X)) Q:X<1 D
113 . N I
114 . I NODE=3 D
115 .. N VALUE
116 .. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U) Q:'VALUE
117 .. S ARRAY(IEN,SNODE,X,.01)=VALUE_U_$$GET1^DIQ(42,VALUE,.01,"E")
118 .. Q
119 . D ; Modularize this call
120 .. N VALUE,PIECE,FIELD
121 .. S PIECE=$S(NODE=3:2,1:1)
122 .. S FIELD=$S(NODE=3:1,1:.01)
123 .. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U,PIECE) Q:'VALUE
124 .. S ARRAY(IEN,SNODE,X,FIELD)=VALUE_U_$$GET1^DIQ(213.3,VALUE,.01,"E")
125 . S Z=Z+1
126 . Q
127 S ARRAY(IEN,SNODE)=Z
128 Q
Note: See TracBrowser for help on using the repository browser.