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

SCMCHLS.m

Go to the documentation of this file.
  1. SCMCHLS ;BPOI/DJB - PCMM HL7 Segment Utils;12/13/99
  1. ;;5.3;Scheduling;**177,210,212,293,515,524**;08/13/93;Build 29
  1. ;
  1. ;Ref rtn: SCDXMSG1
  1. ;
  1. ;--> Build HL7 segments
  1. BLDEVN ;Build EVN segment
  1. S VAFEVN=$$EN^VAFHLEVN(EVNTHL7,EVNTDATE,VAFSTR,HL("Q"),HL("FS"))
  1. Q
  1. BLDPID ;Build PID segment
  1. ;S VAFPID=$$EN^VAFHLPID(DFN,VAFSTR)
  1. S VAFPID=$$EN^VAFCPID(DFN,VAFSTR) ;Use CIRN version
  1. D SETMAR^SCMSVUT0(.VAFPID,HL("Q"),HL("FS"))
  1. Q
  1. BLDZPC ;Build ZPC segment
  1. ;djb/bp Patch 210. Sequentially number multiple ZPC segments.
  1. ;new code begin
  1. S SCSEQ=$G(SCSEQ)+1 ;Increment ZPC sequence number.
  1. ; S VAFZPC=$$ZPC^SCMCHLZ("",ID,DATA,SCSEQ)
  1. S VAFZPC=$$ZPC^SCMCHLZ("",.ID,.DATA,SCSEQ)
  1. ;new code end
  1. ;old code begin
  1. ;S VAFZPC=$$ZPC^SCMCHLZ("",ID,DATA)
  1. ;old code end
  1. Q
  1. ;
  1. ;--> Copy HL7 segments into HL7 message
  1. CPYEVN ;Copy EVN segment
  1. ;Add 1 as 3rd subscript so number of subscripts matches ZPC segment
  1. M @XMITARRY@(SUB,SEGNAME,1)=VAFEVN
  1. Q
  1. CPYPID ;Copy PID segment
  1. ;Add 1 as 3rd subscript so number of subscripts matches ZPC segment
  1. M @XMITARRY@(SUB,SEGNAME,1)=VAFPID
  1. Q
  1. CPYZPC ;Copy ZPC segment
  1. ; PATCH 515 DLL USE ORIG TRIG
  1. ; old code = M @XMITARRY@($P(ID,"-",1),"ZPC",ID)=VAFZPC
  1. M @XMITARRY@(SUB,"ZPC",ID)=VAFZPC ; og/sd/524
  1. Q
  1. ;
  1. ;--> Delete HL7 segment variables
  1. DELEVN ;Delete EVN variable
  1. KILL VAFEVN
  1. Q
  1. DELPID ;Delete PID variable
  1. KILL VAFPID
  1. Q
  1. DELZPC ;Delete ZPC variable
  1. KILL VAFZPC
  1. Q
  1. ;
  1. SEGMENTS(EVNTTYPE,SEGARRY) ;Build list of HL7 segments for a given event type
  1. ;
  1. ; Input: EVNTTYPE - Event type to build list for A08 & A23 are the
  1. ; only types currently supported.
  1. ; Default=A08
  1. ; SEGARRY - Array to place output in (full global reference)
  1. ; Defaul=^TMP("SCMC SEGMENTS",$J)
  1. ;Output: SEGARRY(Seq,Name)=Fields
  1. ; Seq - Sequence number to order segments as they should
  1. ; be placed in the HL7 message.
  1. ; Name - Name of HL7 segment.
  1. ; Fields - List of fields used by PCMM. VAFSTR would be set
  1. ; to this value.
  1. ; Note: MSH segment is not included
  1. ;
  1. ;Check input
  1. S EVNTTYPE=$G(EVNTTYPE)
  1. S:(EVNTTYPE'="A23") EVNTTYPE="A08"
  1. S SEGARRY=$G(SEGARRY)
  1. S:(SEGARRY="") SEGARRY="^TMP(""SCMC SEGMENTS"","_$J_")"
  1. ;
  1. ;Segments used by A08
  1. S @SEGARRY@(1,"EVN")="1,2"
  1. S @SEGARRY@(2,"PID")="1,2,3,4,5,6,7,8,10N,11,12,13,14,16,17,19,22"
  1. S @SEGARRY@(3,"ZPC")="1,2,3,4,5,6,8" ;bp/ar and alb/rpm Patch 212
  1. Q
  1. ;
  1. UNWIND(XMITARRY,INSRTPNT) ;Remove all data that was put into transmit array.
  1. ;
  1. ; Input: XMITARRY - Array containing HL7 message (full global ref).
  1. ; Default=^TMP("HLS",$J).
  1. ; INSRTPNT - Where to begin deletion from.
  1. ; Default=1
  1. ;Output: None
  1. ;
  1. ;Check input
  1. S:$G(XMITARRY)="" XMITARRY="^TMP(""HLS"","_$J_")"
  1. S:$G(INSRTPNT)="" INSRTPNT=1
  1. ;
  1. ;Remove insertion point from array
  1. KILL @XMITARRY@(INSRTPNT)
  1. ;Remove everything from insertion point to end of array
  1. F S INSRTPNT=$O(@XMITARRY@(INSRTPNT)) Q:INSRTPNT="" KILL @XMITARRY@(INSRTPNT)
  1. ;Done
  1. Q
  1. COUNT(VALER) ;counts the number of errored encounters found.
  1. ;
  1. ; Input: VALER - Array containing error messages.
  1. ;Output: Number of errors
  1. ;
  1. NEW VAR,CNT
  1. S CNT=0
  1. S VAR=""
  1. F S VAR=$O(@VALER@(VAR)) Q:VAR']"" S CNT=CNT+1
  1. Q CNT