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

SRHLZIU.m

Go to the documentation of this file.
  1. SRHLZIU ;B'HAM ISC/DLR - Surgery Interface Sender of Scheduling Information Unsolicited ; [ 05/19/98 9:35 AM ]
  1. ;;3.0; Surgery ;**41**;24 Jun 93
  1. ; Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
  1. MSG(CASE,SRSTATUS,SREVENT) ;Send ZSQ message.
  1. ;This message is sent for every event point within the surgery options.
  1. ;There will be a ZIU message sent for each of the following surgery
  1. ;events: S12 New Appointment; S13 Reschedule; S14 Modification;
  1. ;S15 Cancellation; and S17 Deletion. The events codes are set to
  1. ;SREVENT within the surgery routine options.
  1. ;
  1. START ;
  1. I $$V^SRHLU D MSG^SRHLVZIU(CASE,SRSTATUS,SREVENT) Q
  1. S HLDAP=$O(^HL(771,"B","SR SURGERY",0)) Q:$G(HLDAP)=""
  1. Q:$P($G(^HL(771,HLDAP,0)),U,2)'="a"
  1. K ^TMP("HLS",$J)
  1. N HLSUB,HLREP,SRX,SRDSP,SRET,UPDATE,PRT,OUT
  1. ;V. 1.6 interface
  1. ;EID - IEN of event protocol
  1. ;HL - array of output parameters
  1. ;INT - only for VISTA-to-VISTA message exchange
  1. ;SRET - Surgery Event Trigger
  1. D EVNTP
  1. S EID=$O(^ORD(101,"B",SRET,0)),HL="HL",INT=0
  1. D INIT^HLFNC2(EID,.HL,INT) S HLCOMP=$E(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4),HLFS=HL("FS"),HLQ=HL("Q"),HLECH=HL("ECH")
  1. ;Q:'$O(HL("")) ;read HL for the error message
  1. D SEG
  1. D CHECK I $D(UPDATE) D GEN,DISPLAY
  1. EXIT ;
  1. K EID,HL,INT,^TMP("HLS",$J)
  1. Q
  1. GEN ;generate the message
  1. ;HLEID - IEN of event protocol
  1. ;HLARYTYP - acknowledgement array (see V. 1.6 HL7 doc)
  1. ;HLFORMAT - is HLMA is pre-formatted HL7 form
  1. ;HLMTIEN - IEN in 772
  1. ;HLRESLT - message ID and/or the error message (for output)
  1. ;HLP("CONTPTR") - continuation pointer field value (not used)
  1. ;HLP("PRIORITY") - priority field value (not used)
  1. ;HLP("SECURITY") - security information (not used)
  1. S HLEID=EID,HLARYTYP="GM",HLFORMAT=1,HLMTIEN="",HLRESLT=""
  1. D GENERATE^HLMA(HLEID,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
  1. Q
  1. SEG ;segments
  1. N SRI
  1. S SRI=1
  1. D ZCH^SRHLUO1(.SRI,.SREVENT,.SRSTATUS,"HLS")
  1. D PID^SRHLUO(.SRI,"HLS")
  1. D AL1^SRHLUO(.SRI,"HLS")
  1. D OBX^SRHLUO(.SRI,"HLS")
  1. D DG1^SRHLUO(.SRI,"HLS")
  1. D ZIS^SRHLUO2(.SRI,"HLS")
  1. D ZIG^SRHLUO1(.SRI,"HLS")
  1. D ZIP^SRHLUO1(.SRI,"HLS")
  1. D ZIL^SRHLUO1(.SRI,"HLS")
  1. Q
  1. CHECK ;checks ^XTMP for duplicate modification messages
  1. N X
  1. I $D(^XTMP("SRHL7"_CASE,EID,0)) D
  1. .S X=0 F S X=$O(^TMP("HLS",$J,X)) Q:'X!($D(UPDATE)) D
  1. ..I '$D(^XTMP("SRHL7"_CASE,EID,X)) S UPDATE=1 Q
  1. ..I ^TMP("HLS",$J,X)'=^XTMP("SRHL7"_CASE,EID,X) S UPDATE=1
  1. .I $O(^XTMP("SRHL7"_CASE,EID,X)) S UPDATE=1
  1. I '$D(^XTMP("SRHL7"_CASE,EID,0))!$D(UPDATE) K ^XTMP("SRHL7"_CASE,EID) S UPDATE=1,^XTMP("SRHL7"_CASE,EID,0)=DT D
  1. .S X=0 F S X=$O(^TMP("HLS",$J,X)) Q:'X S ^XTMP("SRHL7"_CASE,EID,X)=^TMP("HLS",$J,X)
  1. Q
  1. DISPLAY ;screen message to user
  1. W !,SRDSP
  1. Q
  1. EVNTP ;set Surgery event trigger protocol and display
  1. S SRDSP="Sending a Notification of Appointment "
  1. I SREVENT="S12" S X="Booking"
  1. I SREVENT="S13" S X="Rescheduling"
  1. I SREVENT="S14" S X="Modification"
  1. I SREVENT="S15" S X="Cancellation"
  1. I SREVENT="S17" S X="Deletion"
  1. S SRDSP=SRDSP_X_" for case #"_CASE
  1. S SRET="SR Notification of Appointment "_X
  1. Q