| [623] | 1 | SCMCHLS ;BP/DJB - PCMM HL7 Segment Utils ; 12/13/99 12:40pm
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**177,210,212,293,515**;AUG 13, 1993;Build 14
 | 
|---|
 | 3 |  ;
 | 
|---|
 | 4 |  ;Ref rtn: SCDXMSG1
 | 
|---|
 | 5 |  ;
 | 
|---|
 | 6 |  ;--> Build HL7 segments
 | 
|---|
 | 7 | BLDEVN ;Build EVN segment
 | 
|---|
 | 8 |  S VAFEVN=$$EN^VAFHLEVN(EVNTHL7,EVNTDATE,VAFSTR,HL("Q"),HL("FS"))
 | 
|---|
 | 9 |  Q
 | 
|---|
 | 10 | BLDPID ;Build PID segment
 | 
|---|
 | 11 |  ;S VAFPID=$$EN^VAFHLPID(DFN,VAFSTR)
 | 
|---|
 | 12 |  S VAFPID=$$EN^VAFCPID(DFN,VAFSTR) ;Use CIRN version
 | 
|---|
 | 13 |  D SETMAR^SCMSVUT0(.VAFPID,HL("Q"),HL("FS"))
 | 
|---|
 | 14 |  Q
 | 
|---|
 | 15 | BLDZPC ;Build ZPC segment
 | 
|---|
 | 16 |  ;djb/bp Patch 210. Sequentially number multiple ZPC segments.
 | 
|---|
 | 17 |  ;new code begin
 | 
|---|
 | 18 |  S SCSEQ=$G(SCSEQ)+1 ;Increment ZPC sequence number.
 | 
|---|
 | 19 |  ; S VAFZPC=$$ZPC^SCMCHLZ("",ID,DATA,SCSEQ)
 | 
|---|
 | 20 |  S VAFZPC=$$ZPC^SCMCHLZ("",.ID,.DATA,SCSEQ)
 | 
|---|
 | 21 |  ;new code end
 | 
|---|
 | 22 |  ;old code begin
 | 
|---|
 | 23 |  ;S VAFZPC=$$ZPC^SCMCHLZ("",ID,DATA)
 | 
|---|
 | 24 |  ;old code end
 | 
|---|
 | 25 |  Q
 | 
|---|
 | 26 |  ;
 | 
|---|
 | 27 |  ;--> Copy HL7 segments into HL7 message
 | 
|---|
 | 28 | CPYEVN ;Copy EVN segment
 | 
|---|
 | 29 |  ;Add 1 as 3rd subscript so number of subscripts matches ZPC segment
 | 
|---|
 | 30 |  M @XMITARRY@(SUB,SEGNAME,1)=VAFEVN
 | 
|---|
 | 31 |  Q
 | 
|---|
 | 32 | CPYPID ;Copy PID segment
 | 
|---|
 | 33 |  ;Add 1 as 3rd subscript so number of subscripts matches ZPC segment
 | 
|---|
 | 34 |  M @XMITARRY@(SUB,SEGNAME,1)=VAFPID
 | 
|---|
 | 35 |  Q
 | 
|---|
 | 36 | CPYZPC ;Copy ZPC segment
 | 
|---|
 | 37 |  ; PATCH 515 DLL USE ORIG TRIG 
 | 
|---|
 | 38 |  ; old code = M @XMITARRY@($P(ID,"-",1),"ZPC",ID)=VAFZPC
 | 
|---|
 | 39 |  M @XMITARRY@(NUM,"ZPC",ID)=VAFZPC
 | 
|---|
 | 40 |  Q
 | 
|---|
 | 41 |  ;
 | 
|---|
 | 42 |  ;--> Delete HL7 segment variables
 | 
|---|
 | 43 | DELEVN ;Delete EVN variable
 | 
|---|
 | 44 |  KILL VAFEVN
 | 
|---|
 | 45 |  Q
 | 
|---|
 | 46 | DELPID ;Delete PID variable
 | 
|---|
 | 47 |  KILL VAFPID
 | 
|---|
 | 48 |  Q
 | 
|---|
 | 49 | DELZPC ;Delete ZPC variable
 | 
|---|
 | 50 |  KILL VAFZPC
 | 
|---|
 | 51 |  Q
 | 
|---|
 | 52 |  ;
 | 
|---|
 | 53 | SEGMENTS(EVNTTYPE,SEGARRY) ;Build list of HL7 segments for a given event type
 | 
|---|
 | 54 |  ;
 | 
|---|
 | 55 |  ; Input: EVNTTYPE - Event type to build list for A08 & A23 are the
 | 
|---|
 | 56 |  ;                   only types currently supported.
 | 
|---|
 | 57 |  ;                   Default=A08
 | 
|---|
 | 58 |  ;         SEGARRY - Array to place output in (full global reference)
 | 
|---|
 | 59 |  ;                   Defaul=^TMP("SCMC SEGMENTS",$J)
 | 
|---|
 | 60 |  ;Output: SEGARRY(Seq,Name)=Fields
 | 
|---|
 | 61 |  ;             Seq - Sequence number to order segments as they should
 | 
|---|
 | 62 |  ;                   be placed in the HL7 message.
 | 
|---|
 | 63 |  ;            Name - Name of HL7 segment.
 | 
|---|
 | 64 |  ;          Fields - List of fields used by PCMM. VAFSTR would be set
 | 
|---|
 | 65 |  ;                   to this value.
 | 
|---|
 | 66 |  ;  Note: MSH segment is not included
 | 
|---|
 | 67 |  ;
 | 
|---|
 | 68 |  ;Check input
 | 
|---|
 | 69 |  S EVNTTYPE=$G(EVNTTYPE)
 | 
|---|
 | 70 |  S:(EVNTTYPE'="A23") EVNTTYPE="A08"
 | 
|---|
 | 71 |  S SEGARRY=$G(SEGARRY)
 | 
|---|
 | 72 |  S:(SEGARRY="") SEGARRY="^TMP(""SCMC SEGMENTS"","_$J_")"
 | 
|---|
 | 73 |  ;
 | 
|---|
 | 74 |  ;Segments used by A08
 | 
|---|
 | 75 |  S @SEGARRY@(1,"EVN")="1,2"
 | 
|---|
 | 76 |  S @SEGARRY@(2,"PID")="1,2,3,4,5,6,7,8,10N,11,12,13,14,16,17,19,22"
 | 
|---|
 | 77 |  S @SEGARRY@(3,"ZPC")="1,2,3,4,5,6,8" ;bp/ar and alb/rpm Patch 212
 | 
|---|
 | 78 |  Q
 | 
|---|
 | 79 |  ;
 | 
|---|
 | 80 | UNWIND(XMITARRY,INSRTPNT) ;Remove all data that was put into transmit array.
 | 
|---|
 | 81 |  ;
 | 
|---|
 | 82 |  ; Input: XMITARRY - Array containing HL7 message (full global ref).
 | 
|---|
 | 83 |  ;                   Default=^TMP("HLS",$J).
 | 
|---|
 | 84 |  ;        INSRTPNT - Where to begin deletion from.
 | 
|---|
 | 85 |  ;                   Default=1
 | 
|---|
 | 86 |  ;Output: None
 | 
|---|
 | 87 |  ;
 | 
|---|
 | 88 |  ;Check input
 | 
|---|
 | 89 |  S:$G(XMITARRY)="" XMITARRY="^TMP(""HLS"","_$J_")"
 | 
|---|
 | 90 |  S:$G(INSRTPNT)="" INSRTPNT=1
 | 
|---|
 | 91 |  ;
 | 
|---|
 | 92 |  ;Remove insertion point from array
 | 
|---|
 | 93 |  KILL @XMITARRY@(INSRTPNT)
 | 
|---|
 | 94 |  ;Remove everything from insertion point to end of array
 | 
|---|
 | 95 |  F  S INSRTPNT=$O(@XMITARRY@(INSRTPNT)) Q:INSRTPNT=""  KILL @XMITARRY@(INSRTPNT)
 | 
|---|
 | 96 |  ;Done
 | 
|---|
 | 97 |  Q
 | 
|---|
 | 98 | COUNT(VALER) ;counts the number of errored encounters found.
 | 
|---|
 | 99 |  ;
 | 
|---|
 | 100 |  ; Input: VALER - Array containing error messages.
 | 
|---|
 | 101 |  ;Output: Number of errors
 | 
|---|
 | 102 |  ;
 | 
|---|
 | 103 |  NEW VAR,CNT
 | 
|---|
 | 104 |  S CNT=0
 | 
|---|
 | 105 |  S VAR=""
 | 
|---|
 | 106 |  F  S VAR=$O(@VALER@(VAR)) Q:VAR']""  S CNT=CNT+1
 | 
|---|
 | 107 |  Q CNT
 | 
|---|