| 1 | HLUTIL1 ;ALB/RJS - HL7 UTILITIES ;1/17/95  11:15
 | 
|---|
| 2 |  ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | DAT1(X) ; Convert a FileMan date to a displayable (mm/dd/yy) format.
 | 
|---|
| 5 |  Q $S(X:$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3),1:"")
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 | DAT2(Y) ; Convert a FileMan date to a displayable (mmm dd yyyy) format.
 | 
|---|
| 8 |  Q:'$G(Y) ""
 | 
|---|
| 9 |  N % D D^DIQ
 | 
|---|
| 10 |  Q $TR(Y,"@"," ")
 | 
|---|
| 11 |  ;
 | 
|---|
| 12 | HLFM(Y) ; Convert a quasi HL7 formatted date to a Fileman date.
 | 
|---|
| 13 |  I Y="" Q ""
 | 
|---|
| 14 |  N % S Y=$TR(Y,".",""),%=$E(Y,9,14)
 | 
|---|
| 15 |  Q $E(Y,1,2)-17_$E(Y,3,8)_$S(+%:+("."_%),1:"")
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 | TASK(X) ; Is the background task currently running?
 | 
|---|
| 18 |  ;  Input:   X  --  Task number for the background job
 | 
|---|
| 19 |  ;  Output:  0  --  No, the job is not currently running
 | 
|---|
| 20 |  ;           1  --  Yes, the job is currently running
 | 
|---|
| 21 |  Q +$G(^%ZTSK(+$G(X),.1))=5
 | 
|---|
| 22 |  ;
 | 
|---|
| 23 | PAUSE() ; Pause for CRT output.
 | 
|---|
| 24 |  ;  Input:   IOST, IOSL
 | 
|---|
| 25 |  ;  Output:  0  --  Continue to display output
 | 
|---|
| 26 |  ;           1  --  Quit
 | 
|---|
| 27 |  Q:$E(IOST,1,2)'["C-" 0
 | 
|---|
| 28 |  N DIR,DIRUT,DTOUT,DUOUT,HLJ
 | 
|---|
| 29 |  F HLJ=$Y:1:(IOSL-5) W !
 | 
|---|
| 30 |  S DIR(0)="E" D ^DIR
 | 
|---|
| 31 |  Q $D(DIRUT)!($D(DUOUT))
 | 
|---|
| 32 | EXPAND(FILE,FIELD,VALUE)        ; - returns internal data in an output format
 | 
|---|
| 33 |  ; Taken from IVMUFNC w/help of CPM
 | 
|---|
| 34 |  N Y,C S Y=VALUE
 | 
|---|
| 35 |  I 'FILE!('FIELD)!(VALUE="") G EXPQ
 | 
|---|
| 36 |  S Y=VALUE,C=$P(^DD(FILE,FIELD,0),"^",2) D Y^DIQ
 | 
|---|
| 37 | EXPQ    Q Y
 | 
|---|
| 38 | EVENT(EID,NODES,RESULT) ;Entry point to get event data from the Protocol file
 | 
|---|
| 39 |  ;
 | 
|---|
| 40 |  ;This is a subroutine call with parameter passing.  It returns each
 | 
|---|
| 41 |  ;of the nodes from the Protocol file for the entry specified by EID
 | 
|---|
| 42 |  ;in the array specified by the RESULT parameter
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  ;Required Input Parameters
 | 
|---|
| 45 |  ;     EID = The IEN of the protocol in the Protocol file for which
 | 
|---|
| 46 |  ;             data is being requested
 | 
|---|
| 47 |  ;   NODES = The node subscripts to be returned separated by commas.
 | 
|---|
| 48 |  ;             Allowable subscripts are 15, 20, 770, 771, 772, 773
 | 
|---|
| 49 |  ;             Example:  15,20,770
 | 
|---|
| 50 |  ;  RESULT = The name of the array in which the nodes will be returned.
 | 
|---|
| 51 |  ;             The node subscripts will be used as the array subscripts.
 | 
|---|
| 52 |  ;             Example:  RESULT(15)=...
 | 
|---|
| 53 |  ;
 | 
|---|
| 54 |  ;Check for required parameter
 | 
|---|
| 55 |  I '$G(EID)!($G(NODES)']"") Q
 | 
|---|
| 56 |  I '$D(^ORD(101,EID,0)) Q
 | 
|---|
| 57 |  ;Get data for nodes requested
 | 
|---|
| 58 |  I NODES[15 S RESULT(15)=$G(^ORD(101,EID,15))
 | 
|---|
| 59 |  I NODES[20 S RESULT(20)=$G(^ORD(101,EID,20))
 | 
|---|
| 60 |  I NODES[770 S RESULT(770)=$G(^ORD(101,EID,770))
 | 
|---|
| 61 |  I NODES[771 S RESULT(771)=$G(^ORD(101,EID,771))
 | 
|---|
| 62 |  I NODES[772 S RESULT(772)=$G(^ORD(101,EID,772))
 | 
|---|
| 63 |  I NODES[773 S RESULT(773)=$G(^ORD(101,EID,773))
 | 
|---|
| 64 |  Q
 | 
|---|