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

LA7VHLU1.m

Go to the documentation of this file.
  1. LA7VHLU1 ;VA/DALOI/JMC - HL7 segment builder utility ;JUL 06, 2010 3:14 PM
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,61,64,1027**;NOV 01, 1997
  1. ;
  1. ;
  1. SETID(LA76249,LA7ID,LA7X) ; Setup identifier's in TMP global for later storing.
  1. ; Call with LA76249 = ien of message in #62.49
  1. ; LA7ID = root of identifier
  1. ; LA7X = value to add to identifier
  1. N Y
  1. S Y=$O(^TMP("LA7-ID",$J,LA76249,""),-1) ; get last entry
  1. S Y=Y+1
  1. S ^TMP("LA7-ID",$J,LA76249,Y)=LA7ID_LA7X
  1. Q
  1. ;
  1. ;
  1. UTS(LA7628,LA7UID,LA760) ; Update test status on manifest
  1. ; Call with LA7628 = ien of shipping manifest in #62.8
  1. ; LA7UID = accession's UID
  1. ; LA760 = file # 60 ien of ordered test
  1. ;
  1. ; Sets to status 4 (partial). Will deal with 5 (completed) at later time
  1. ; when lab package has capability of designating an accession as completed.
  1. ;
  1. N LA762801,LA7X
  1. ;
  1. S LA762801=0
  1. F S LA762801=$O(^LAHM(62.8,LA7628,10,"UID",LA7UID,LA762801)) Q:'LA762801 D
  1. . S LA7X=$G(^LAHM(62.8,LA7628,10,LA762801,0))
  1. . I $P(LA7X,"^",2)'=LA760 Q ; Not the test we're looking for.
  1. . I $P(LA7X,"^",8)>2,$P(LA7X,"^",8)<5 D STSUP^LA7SMU(LA7628,LA762801,4)
  1. Q
  1. ;
  1. ;
  1. UPID(LA76249) ; Update identifier's associated with the message in #62.49
  1. ; Call with LA76249 = ien of message in #62.49
  1. ;
  1. N FDA,LA7CNT,LA7ERR,LA7I,LA7X
  1. ;
  1. S (LA7CNT,LA7I)=0
  1. F S LA7I=$O(^TMP("LA7-ID",$J,LA76249,LA7I)) Q:'LA7I D
  1. . S LA7CNT=LA7CNT+1
  1. . S LA7X=^TMP("LA7-ID",$J,LA76249,LA7I)
  1. . I LA7CNT=1 S FDA(1,62.49,LA76249_",",5)=LA7X
  1. . ; Add code to store additional identifiers in new multiple field in #62.49
  1. I $D(FDA(1)) D FILE^DIE("","FDA(1)","LA7ERR(1)")
  1. ;
  1. ; Clean up
  1. K ^TMP("LA7-ID",$J,LA76249)
  1. Q
  1. ;
  1. ;
  1. CHKDT(LA7X) ; Check validity of date/time
  1. ; Adjust invalid times to closest valid time - correct for lab problem
  1. ; that generated invalid FileMan date/times.
  1. ; If hours>24 then set to 24 with no minutes/seconds
  1. ; If minutes greater than 59 then set to 59
  1. ; If seconds greater than 59 then set to 59
  1. ;
  1. N I,LA7Y,X
  1. ;
  1. S LA7Y=$P(LA7X,".",2)
  1. ;
  1. ; If time present then check otherwise skip and return input.
  1. I $L(LA7Y) D
  1. . F I=1:2:5 D
  1. . . S LA7Y(I)=$E(LA7Y,I,I+1)
  1. . . I $L(LA7Y(I))=1 S LA7Y(I)=LA7Y(I)_"0"
  1. . . I LA7Y(I)>$S(I=1:24,1:59) S LA7Y(I)=$S(I=1:24,1:59)
  1. . . I I=1,LA7Y(1)=24 S LA7Y=24
  1. . S X="."_LA7Y(1)_LA7Y(3)_LA7Y(5),X=+X
  1. . S $P(LA7X,".",2)=$P(X,".",2)
  1. ;
  1. Q LA7X
  1. ;
  1. ;
  1. REFUNIT(LA7SB,LA761) ; Find reference ranges/units from file #60
  1. ; Call with LA7SB = dataname from "CH" subscript
  1. ; LA761 = pointer to topography file #61
  1. ;
  1. ; Returns LA7Y = reference low^reference high^units^critcal low^critcal high^therapeutic low^therapeutic high
  1. ;
  1. ; Finds first entry in file #60 that is associated with this dataname.
  1. N LA760,LA7X,LA7Y
  1. ;
  1. S LA7Y=""
  1. S LA760=+$O(^LAB(60,"C","CH;"_LA7SB_";1",0))
  1. S LA7X=$G(^LAB(60,LA760,1,LA761,0))
  1. S $P(LA7Y,"^")=$P(LA7X,"^",2)
  1. S $P(LA7Y,"^",2)=$P(LA7X,"^",3)
  1. S $P(LA7Y,"^",3)=$P(LA7X,"^",7)
  1. S $P(LA7Y,"^",4)=$P(LA7X,"^",4)
  1. S $P(LA7Y,"^",5)=$P(LA7X,"^",5)
  1. S $P(LA7Y,"^",6)=$P(LA7X,"^",11)
  1. S $P(LA7Y,"^",7)=$P(LA7X,"^",12)
  1. ;
  1. Q LA7Y
  1. ;
  1. ;
  1. OKTOSND(LRSS,LRSB,LA760) ; Check if test ok to send - is (O)utput or (B)oth
  1. ; Call with LRSS = file #63 subscript
  1. ; LRSB = file #63 data name or field reference
  1. ; LA760 = file #60 ien
  1. ;
  1. ; Returns LA7Y = 0-do not send, 1-yes-ok (default)
  1. ;
  1. N LA760,LA7X,LA7Y
  1. S LA7Y=1
  1. ;
  1. ; If "CH" subscript check file #60 test's type that use this dataname
  1. ; and if find one that is type "O" or "B" then set to yes.
  1. I LRSS="CH" D
  1. . I $G(LA760) D Q
  1. . . I "BO"'[$P(^LAB(60,LA760,0),"^",3) S LA7Y=0
  1. . S (LA760,LA7X)=0
  1. . F S LA760=$O(^LAB(60,"C","CH;"_LRSB_";1",LA760)) Q:'LA760 D
  1. . . I "BO"[$P(^LAB(60,LA760,0),"^",3) S LA7X=1
  1. . S LA7Y=LA7X
  1. ;
  1. Q LA7Y
  1. ;
  1. ;
  1. FAMG(LA76248,LA7TYP) ; Find alert mail group for this alert type
  1. ; Call with LA76248 = ien of entry in file #62.48
  1. ; LA7TYP = type of alert
  1. ; (1-new results)
  1. ; (2-error on message)
  1. ; (3-orders received)
  1. ;
  1. ; Returns LA7MG = name of mail group
  1. ;
  1. N LA7MG,X,Y
  1. S (LA7MG,X)=""
  1. F S X=$O(^LAHM(62.48,+$G(LA76248),20,"B",LA7TYP,X)) Q:'X D
  1. . S Y=$G(^LAHM(62.48,LA76248,20,X,0))
  1. . I $P(Y,"^",2)'="" S LA7MG=$P(Y,"^",2) ; Send to mail group.
  1. ;
  1. ; Fail safe mail group when no mail group specified
  1. I LA7MG="" S LA7MG="LAB MESSAGING"
  1. ;
  1. Q LA7MG
  1. ;
  1. ;
  1. ABFLAGS ;; HL7 Table 0078 Abnormal flags
  1. ;;Below low normal;;
  1. ;;Above high normal;;
  1. ;;Below lower panic limits;;
  1. ;;Above upper panic limits;;
  1. ;;Below absolute low-off instrument scale;;
  1. ;;Above absolute high-off instrument scale;;
  1. ;;Normal;;
  1. ;;Abnormal;;
  1. ;;Very abnormal;;
  1. ;;Significant change up;;
  1. ;;Significant change down;;
  1. ;;Better;;
  1. ;;Worse;;
  1. ;;Susceptible;;
  1. ;;Resistant;;
  1. ;;Intermediate;;
  1. ;;Moderately susceptible;;
  1. ;;Very susceptible;;