NURSUT5 ;HIRMFO/WAA-API FOR NURS LOCATION (#211.4) FILE ;2/29/00
;;4.0;NURSING SERVICE;**31**;APR 25, 1997
;
;Nursing Unit Function
; Input Values:
; FUNCT = Piece1_^_Piece2
; Piece1 must contain an "L" or "Q"
; Piece1 "L" means Look-up of specified entry
; in File 211.4, and
; Piece2 must contain the IEN for
; the entry in File 211.4.
;
; Piece1 "Q" means do a DIC style query on File
; 211.4, and
; Piece2 must contain "I","A" or
; ""(i.e., null). This will be the screen
; used on the look-up. The API will do a
; DIC style look-up for the ward.
; "I" means look-up only inactive wards.
; "A" means look-up only active wards.
; "" means look-up all wards.
;
; In both cases (Query or Look-up) the data will be returned
; in ARRAY, which is called by reference, in the following
; format.
;
; .ARRAY = Recommend the return array should be namespaced.
;
;Return Values:
; ARRAY = -1 means that the Look-up or Query failed
; ARRAY = IEN means that the Look-up or Query was
; successful.
;
;Return Array:
;ARRAY(IEN,.01) = Pointer to File 44_"^"_External value of Hospital
; Location file(44), Name field(.01)
;ARRAY(IEN,.02) = Facility pointer to File 4_"^"_External name of
; facility
;ARRAY(IEN,.03) = Pointer to File 212.7_"^"_External value of NURS
; Product Line file(212.7), Name field(.01)
;ARRAY(IEN,1) = Patient care status internal value_"^"_External
; value of Patient care status
;ARRAY(IEN,1.5) = Ward status Internal value_"^"_External value
; of Ward status
;ARRAY(IEN,2) = Total number of MAS ward pointers
; X = the IEN of the entry within the MAS ward Multiple.
;ARRAY(IEN,2,X,.01) = Pointer to File 42_"^"_External value of Ward
; Location file(42), Name field(.01)
;ARRAY(IEN,2,X,1) = Pointer to File 213.3_"^"_External value of
; NURS AMIS Ward file(213.3), Bed Section
; field(.01)
;ARRAY(IEN,4)=Total number of entries within the AMIS ward pointer.
; Y = the IEN of the entry within the AMIS Bed section
; Multiple
;ARRAY(IEN,4,Y,.01) = Pointer to file 213.3_"^"_ External
; value of NURS AMIS Ward file(213.3),
; Bed Section field(.01)
;ARRAY(IEN,11) = Professional Percentage
;ARRAY(IEN,12) = Pointer to File 211.5_"^"_External value of NURS
; Clinical Background file(211.5), Description
; field(.01)
;ARRAY(IEN,37) = Indicates whether or not active staff is assigned
; to this ward.
;
WARD(FUNCT,ARRAY) ; Main Entry
N ACT,NODE,DISYS,I,NURACTV,NURMDSW,X,XXX,YY,ZZ
S ARRAY=-1
S ACT=$P(FUNCT,U)
I ACT="Q" D
. ; DIC Query Lookup for data
. N Y,SCREEN,DIC,X,DUOUT,DTOUT
. S SCREEN=$P(FUNCT,U,2) Q:"AI"'[SCREEN
. S DIC="^NURSF(211.4,",DIC(0)="AEMNXQ"
. I SCREEN'="" S DIC("S")="I $$GET1^DIQ(211.4,+Y,1.5,""I"")=SCREEN"
. D ^DIC
. I Y'=-1 S ARRAY=+Y
. Q
I ACT="L" D
. ; Lookup/load ARRAY
. N IEN
. S IEN=+$P(FUNCT,U,2)
. I $G(^NURSF(211.4,IEN,0))="" S IEN=-1
. S ARRAY=IEN
. Q
Q:ARRAY=-1
D LOAD
Q
LOAD ; This will load the data into ARRAY
Q:ARRAY=-1
N I,J,IEN,LINE
S IEN=ARRAY
S J=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),.01,"E")
S ARRAY(IEN,.01)=+$G(^NURSF(211.4,IEN,0))_U_$P(J,"NUR ",2)
S ARRAY(IEN,.02)=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),3,"I")_U
S ARRAY(IEN,.02)=ARRAY(IEN,.02)_$$GET1^DIQ(211.4,IEN,.02,"E")
S LINE=$G(^NURSF(211.4,IEN,1))
I LINE'="" D
. I $P(LINE,U,4)'="" S ARRAY(IEN,.03)=$P(LINE,U,4)_U_$$GET1^DIQ(212.7,$P(LINE,U,4),.01,"E")
. I $P(LINE,U)'="" S ARRAY(IEN,1)=$P(LINE,U)_U_$$GET1^DIQ(211.4,IEN,1,"E")
. I $P(LINE,U,2)'="" S ARRAY(IEN,11)=$P(LINE,U,2)
. I $P(LINE,U,3)'="" S ARRAY(IEN,12)=$P(LINE,U,3)_U_$$GET1^DIQ(211.5,$P(LINE,U,3),.01,"E")
. Q
I $G(^NURSF(211.4,IEN,"I"))'="" S ARRAY(IEN,1.5)=$P(^("I"),U)_U_$$GET1^DIQ(211.4,IEN,1.5,"E")
S ARRAY(IEN,37)=$$GET1^DIQ(211.4,IEN,37,"E")
F NODE=3,4 I +$P($G(^NURSF(211.4,IEN,NODE,0)),U,4) D SUB
Q
SUB ; Get sub node data for 3, and 4
N X,Z,SNODE
S (X,Z)=0
S SNODE=$S(NODE=3:2,NODE=4:4,1:0)
Q:'SNODE
F S X=$O(^NURSF(211.4,IEN,NODE,X)) Q:X<1 D
. N I
. I NODE=3 D
.. N VALUE
.. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U) Q:'VALUE
.. S ARRAY(IEN,SNODE,X,.01)=VALUE_U_$$GET1^DIQ(42,VALUE,.01,"E")
.. Q
. D ; Modularize this call
.. N VALUE,PIECE,FIELD
.. S PIECE=$S(NODE=3:2,1:1)
.. S FIELD=$S(NODE=3:1,1:.01)
.. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U,PIECE) Q:'VALUE
.. S ARRAY(IEN,SNODE,X,FIELD)=VALUE_U_$$GET1^DIQ(213.3,VALUE,.01,"E")
. S Z=Z+1
. Q
S ARRAY(IEN,SNODE)=Z
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HNURSUT5 5101 printed Oct 16, 2024@18:23:11 Page 2
NURSUT5 ;HIRMFO/WAA-API FOR NURS LOCATION (#211.4) FILE ;2/29/00
+1 ;;4.0;NURSING SERVICE;**31**;APR 25, 1997
+2 ;
+3 ;Nursing Unit Function
+4 ; Input Values:
+5 ; FUNCT = Piece1_^_Piece2
+6 ; Piece1 must contain an "L" or "Q"
+7 ; Piece1 "L" means Look-up of specified entry
+8 ; in File 211.4, and
+9 ; Piece2 must contain the IEN for
+10 ; the entry in File 211.4.
+11 ;
+12 ; Piece1 "Q" means do a DIC style query on File
+13 ; 211.4, and
+14 ; Piece2 must contain "I","A" or
+15 ; ""(i.e., null). This will be the screen
+16 ; used on the look-up. The API will do a
+17 ; DIC style look-up for the ward.
+18 ; "I" means look-up only inactive wards.
+19 ; "A" means look-up only active wards.
+20 ; "" means look-up all wards.
+21 ;
+22 ; In both cases (Query or Look-up) the data will be returned
+23 ; in ARRAY, which is called by reference, in the following
+24 ; format.
+25 ;
+26 ; .ARRAY = Recommend the return array should be namespaced.
+27 ;
+28 ;Return Values:
+29 ; ARRAY = -1 means that the Look-up or Query failed
+30 ; ARRAY = IEN means that the Look-up or Query was
+31 ; successful.
+32 ;
+33 ;Return Array:
+34 ;ARRAY(IEN,.01) = Pointer to File 44_"^"_External value of Hospital
+35 ; Location file(44), Name field(.01)
+36 ;ARRAY(IEN,.02) = Facility pointer to File 4_"^"_External name of
+37 ; facility
+38 ;ARRAY(IEN,.03) = Pointer to File 212.7_"^"_External value of NURS
+39 ; Product Line file(212.7), Name field(.01)
+40 ;ARRAY(IEN,1) = Patient care status internal value_"^"_External
+41 ; value of Patient care status
+42 ;ARRAY(IEN,1.5) = Ward status Internal value_"^"_External value
+43 ; of Ward status
+44 ;ARRAY(IEN,2) = Total number of MAS ward pointers
+45 ; X = the IEN of the entry within the MAS ward Multiple.
+46 ;ARRAY(IEN,2,X,.01) = Pointer to File 42_"^"_External value of Ward
+47 ; Location file(42), Name field(.01)
+48 ;ARRAY(IEN,2,X,1) = Pointer to File 213.3_"^"_External value of
+49 ; NURS AMIS Ward file(213.3), Bed Section
+50 ; field(.01)
+51 ;ARRAY(IEN,4)=Total number of entries within the AMIS ward pointer.
+52 ; Y = the IEN of the entry within the AMIS Bed section
+53 ; Multiple
+54 ;ARRAY(IEN,4,Y,.01) = Pointer to file 213.3_"^"_ External
+55 ; value of NURS AMIS Ward file(213.3),
+56 ; Bed Section field(.01)
+57 ;ARRAY(IEN,11) = Professional Percentage
+58 ;ARRAY(IEN,12) = Pointer to File 211.5_"^"_External value of NURS
+59 ; Clinical Background file(211.5), Description
+60 ; field(.01)
+61 ;ARRAY(IEN,37) = Indicates whether or not active staff is assigned
+62 ; to this ward.
+63 ;
WARD(FUNCT,ARRAY) ; Main Entry
+1 NEW ACT,NODE,DISYS,I,NURACTV,NURMDSW,X,XXX,YY,ZZ
+2 SET ARRAY=-1
+3 SET ACT=$PIECE(FUNCT,U)
+4 IF ACT="Q"
Begin DoDot:1
+5 ; DIC Query Lookup for data
+6 NEW Y,SCREEN,DIC,X,DUOUT,DTOUT
+7 SET SCREEN=$PIECE(FUNCT,U,2)
if "AI"'[SCREEN
QUIT
+8 SET DIC="^NURSF(211.4,"
SET DIC(0)="AEMNXQ"
+9 IF SCREEN'=""
SET DIC("S")="I $$GET1^DIQ(211.4,+Y,1.5,""I"")=SCREEN"
+10 DO ^DIC
+11 IF Y'=-1
SET ARRAY=+Y
+12 QUIT
End DoDot:1
+13 IF ACT="L"
Begin DoDot:1
+14 ; Lookup/load ARRAY
+15 NEW IEN
+16 SET IEN=+$PIECE(FUNCT,U,2)
+17 IF $GET(^NURSF(211.4,IEN,0))=""
SET IEN=-1
+18 SET ARRAY=IEN
+19 QUIT
End DoDot:1
+20 if ARRAY=-1
QUIT
+21 DO LOAD
+22 QUIT
LOAD ; This will load the data into ARRAY
+1 if ARRAY=-1
QUIT
+2 NEW I,J,IEN,LINE
+3 SET IEN=ARRAY
+4 SET J=$$GET1^DIQ(44,+$GET(^NURSF(211.4,IEN,0)),.01,"E")
+5 SET ARRAY(IEN,.01)=+$GET(^NURSF(211.4,IEN,0))_U_$PIECE(J,"NUR ",2)
+6 SET ARRAY(IEN,.02)=$$GET1^DIQ(44,+$GET(^NURSF(211.4,IEN,0)),3,"I")_U
+7 SET ARRAY(IEN,.02)=ARRAY(IEN,.02)_$$GET1^DIQ(211.4,IEN,.02,"E")
+8 SET LINE=$GET(^NURSF(211.4,IEN,1))
+9 IF LINE'=""
Begin DoDot:1
+10 IF $PIECE(LINE,U,4)'=""
SET ARRAY(IEN,.03)=$PIECE(LINE,U,4)_U_$$GET1^DIQ(212.7,$PIECE(LINE,U,4),.01,"E")
+11 IF $PIECE(LINE,U)'=""
SET ARRAY(IEN,1)=$PIECE(LINE,U)_U_$$GET1^DIQ(211.4,IEN,1,"E")
+12 IF $PIECE(LINE,U,2)'=""
SET ARRAY(IEN,11)=$PIECE(LINE,U,2)
+13 IF $PIECE(LINE,U,3)'=""
SET ARRAY(IEN,12)=$PIECE(LINE,U,3)_U_$$GET1^DIQ(211.5,$PIECE(LINE,U,3),.01,"E")
+14 QUIT
End DoDot:1
+15 IF $GET(^NURSF(211.4,IEN,"I"))'=""
SET ARRAY(IEN,1.5)=$PIECE(^("I"),U)_U_$$GET1^DIQ(211.4,IEN,1.5,"E")
+16 SET ARRAY(IEN,37)=$$GET1^DIQ(211.4,IEN,37,"E")
+17 FOR NODE=3,4
IF +$PIECE($GET(^NURSF(211.4,IEN,NODE,0)),U,4)
DO SUB
+18 QUIT
SUB ; Get sub node data for 3, and 4
+1 NEW X,Z,SNODE
+2 SET (X,Z)=0
+3 SET SNODE=$SELECT(NODE=3:2,NODE=4:4,1:0)
+4 if 'SNODE
QUIT
+5 FOR
SET X=$ORDER(^NURSF(211.4,IEN,NODE,X))
if X<1
QUIT
Begin DoDot:1
+6 NEW I
+7 IF NODE=3
Begin DoDot:2
+8 NEW VALUE
+9 SET VALUE=$PIECE($GET(^NURSF(211.4,IEN,NODE,X,0)),U)
if 'VALUE
QUIT
+10 SET ARRAY(IEN,SNODE,X,.01)=VALUE_U_$$GET1^DIQ(42,VALUE,.01,"E")
+11 QUIT
End DoDot:2
+12 ; Modularize this call
Begin DoDot:2
+13 NEW VALUE,PIECE,FIELD
+14 SET PIECE=$SELECT(NODE=3:2,1:1)
+15 SET FIELD=$SELECT(NODE=3:1,1:.01)
+16 SET VALUE=$PIECE($GET(^NURSF(211.4,IEN,NODE,X,0)),U,PIECE)
if 'VALUE
QUIT
+17 SET ARRAY(IEN,SNODE,X,FIELD)=VALUE_U_$$GET1^DIQ(213.3,VALUE,.01,"E")
End DoDot:2
+18 SET Z=Z+1
+19 QUIT
End DoDot:1
+20 SET ARRAY(IEN,SNODE)=Z
+21 QUIT