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

NURSUT5.m

Go to the documentation of this file.
  1. NURSUT5 ;HIRMFO/WAA-API FOR NURS LOCATION (#211.4) FILE ;2/29/00
  1. ;;4.0;NURSING SERVICE;**31**;APR 25, 1997
  1. ;
  1. ;Nursing Unit Function
  1. ; Input Values:
  1. ; FUNCT = Piece1_^_Piece2
  1. ; Piece1 must contain an "L" or "Q"
  1. ; Piece1 "L" means Look-up of specified entry
  1. ; in File 211.4, and
  1. ; Piece2 must contain the IEN for
  1. ; the entry in File 211.4.
  1. ;
  1. ; Piece1 "Q" means do a DIC style query on File
  1. ; 211.4, and
  1. ; Piece2 must contain "I","A" or
  1. ; ""(i.e., null). This will be the screen
  1. ; used on the look-up. The API will do a
  1. ; DIC style look-up for the ward.
  1. ; "I" means look-up only inactive wards.
  1. ; "A" means look-up only active wards.
  1. ; "" means look-up all wards.
  1. ;
  1. ; In both cases (Query or Look-up) the data will be returned
  1. ; in ARRAY, which is called by reference, in the following
  1. ; format.
  1. ;
  1. ; .ARRAY = Recommend the return array should be namespaced.
  1. ;
  1. ;Return Values:
  1. ; ARRAY = -1 means that the Look-up or Query failed
  1. ; ARRAY = IEN means that the Look-up or Query was
  1. ; successful.
  1. ;
  1. ;Return Array:
  1. ;ARRAY(IEN,.01) = Pointer to File 44_"^"_External value of Hospital
  1. ; Location file(44), Name field(.01)
  1. ;ARRAY(IEN,.02) = Facility pointer to File 4_"^"_External name of
  1. ; facility
  1. ;ARRAY(IEN,.03) = Pointer to File 212.7_"^"_External value of NURS
  1. ; Product Line file(212.7), Name field(.01)
  1. ;ARRAY(IEN,1) = Patient care status internal value_"^"_External
  1. ; value of Patient care status
  1. ;ARRAY(IEN,1.5) = Ward status Internal value_"^"_External value
  1. ; of Ward status
  1. ;ARRAY(IEN,2) = Total number of MAS ward pointers
  1. ; X = the IEN of the entry within the MAS ward Multiple.
  1. ;ARRAY(IEN,2,X,.01) = Pointer to File 42_"^"_External value of Ward
  1. ; Location file(42), Name field(.01)
  1. ;ARRAY(IEN,2,X,1) = Pointer to File 213.3_"^"_External value of
  1. ; NURS AMIS Ward file(213.3), Bed Section
  1. ; field(.01)
  1. ;ARRAY(IEN,4)=Total number of entries within the AMIS ward pointer.
  1. ; Y = the IEN of the entry within the AMIS Bed section
  1. ; Multiple
  1. ;ARRAY(IEN,4,Y,.01) = Pointer to file 213.3_"^"_ External
  1. ; value of NURS AMIS Ward file(213.3),
  1. ; Bed Section field(.01)
  1. ;ARRAY(IEN,11) = Professional Percentage
  1. ;ARRAY(IEN,12) = Pointer to File 211.5_"^"_External value of NURS
  1. ; Clinical Background file(211.5), Description
  1. ; field(.01)
  1. ;ARRAY(IEN,37) = Indicates whether or not active staff is assigned
  1. ; to this ward.
  1. ;
  1. WARD(FUNCT,ARRAY) ; Main Entry
  1. N ACT,NODE,DISYS,I,NURACTV,NURMDSW,X,XXX,YY,ZZ
  1. S ARRAY=-1
  1. S ACT=$P(FUNCT,U)
  1. I ACT="Q" D
  1. . ; DIC Query Lookup for data
  1. . N Y,SCREEN,DIC,X,DUOUT,DTOUT
  1. . S SCREEN=$P(FUNCT,U,2) Q:"AI"'[SCREEN
  1. . S DIC="^NURSF(211.4,",DIC(0)="AEMNXQ"
  1. . I SCREEN'="" S DIC("S")="I $$GET1^DIQ(211.4,+Y,1.5,""I"")=SCREEN"
  1. . D ^DIC
  1. . I Y'=-1 S ARRAY=+Y
  1. . Q
  1. I ACT="L" D
  1. . ; Lookup/load ARRAY
  1. . N IEN
  1. . S IEN=+$P(FUNCT,U,2)
  1. . I $G(^NURSF(211.4,IEN,0))="" S IEN=-1
  1. . S ARRAY=IEN
  1. . Q
  1. Q:ARRAY=-1
  1. D LOAD
  1. Q
  1. LOAD ; This will load the data into ARRAY
  1. Q:ARRAY=-1
  1. N I,J,IEN,LINE
  1. S IEN=ARRAY
  1. S J=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),.01,"E")
  1. S ARRAY(IEN,.01)=+$G(^NURSF(211.4,IEN,0))_U_$P(J,"NUR ",2)
  1. S ARRAY(IEN,.02)=$$GET1^DIQ(44,+$G(^NURSF(211.4,IEN,0)),3,"I")_U
  1. S ARRAY(IEN,.02)=ARRAY(IEN,.02)_$$GET1^DIQ(211.4,IEN,.02,"E")
  1. S LINE=$G(^NURSF(211.4,IEN,1))
  1. I LINE'="" D
  1. . I $P(LINE,U,4)'="" S ARRAY(IEN,.03)=$P(LINE,U,4)_U_$$GET1^DIQ(212.7,$P(LINE,U,4),.01,"E")
  1. . I $P(LINE,U)'="" S ARRAY(IEN,1)=$P(LINE,U)_U_$$GET1^DIQ(211.4,IEN,1,"E")
  1. . I $P(LINE,U,2)'="" S ARRAY(IEN,11)=$P(LINE,U,2)
  1. . I $P(LINE,U,3)'="" S ARRAY(IEN,12)=$P(LINE,U,3)_U_$$GET1^DIQ(211.5,$P(LINE,U,3),.01,"E")
  1. . Q
  1. I $G(^NURSF(211.4,IEN,"I"))'="" S ARRAY(IEN,1.5)=$P(^("I"),U)_U_$$GET1^DIQ(211.4,IEN,1.5,"E")
  1. S ARRAY(IEN,37)=$$GET1^DIQ(211.4,IEN,37,"E")
  1. F NODE=3,4 I +$P($G(^NURSF(211.4,IEN,NODE,0)),U,4) D SUB
  1. Q
  1. SUB ; Get sub node data for 3, and 4
  1. N X,Z,SNODE
  1. S (X,Z)=0
  1. S SNODE=$S(NODE=3:2,NODE=4:4,1:0)
  1. Q:'SNODE
  1. F S X=$O(^NURSF(211.4,IEN,NODE,X)) Q:X<1 D
  1. . N I
  1. . I NODE=3 D
  1. .. N VALUE
  1. .. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U) Q:'VALUE
  1. .. S ARRAY(IEN,SNODE,X,.01)=VALUE_U_$$GET1^DIQ(42,VALUE,.01,"E")
  1. .. Q
  1. . D ; Modularize this call
  1. .. N VALUE,PIECE,FIELD
  1. .. S PIECE=$S(NODE=3:2,1:1)
  1. .. S FIELD=$S(NODE=3:1,1:.01)
  1. .. S VALUE=$P($G(^NURSF(211.4,IEN,NODE,X,0)),U,PIECE) Q:'VALUE
  1. .. S ARRAY(IEN,SNODE,X,FIELD)=VALUE_U_$$GET1^DIQ(213.3,VALUE,.01,"E")
  1. . S Z=Z+1
  1. . Q
  1. S ARRAY(IEN,SNODE)=Z
  1. Q