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

AGMPHL01.m

Go to the documentation of this file.
AGMPHL01 ; IHS/SD/TPF - MPI ADT-A01 ACK PROCESSOR FOR HLO ; 12/15/2007
 ;;7.2;IHS PATIENT REGISTRATION;**1,6**;JAN 07, 2011;Build 23
 Q
 ;
PROC(HLMSGIEN) ;EP - CALLED FROM AGMPIBGP
 N DATA,HLMSTATE,MSGID,MSGSEG,ICNEUID,RETCODE,NEXTSEG,RESEND,ORGHLMSG
 D PARSE(.DATA,HLMSGIEN,.HLMSTATE)
 D MSGCMPLT^AGMPIBGP(HLMSGIEN)  ;SET THE ACK SUCCESSFUL
 ;NOW DO THE ORIGINATING MESSAGE
 S ORGHLMSG=HLMSGIEN  ;PRESERVE HLMSGIEN THAT WAS PASSED
 S HLMSGIEN=$P($G(DATA(1,3,1,1,1))," ",2)  ;MSG ID OF THE MSG THIS ACK IS RESPONDING TO
 I HLMSGIEN="" D  Q
 .S ERROR="NO ORIGINATING MSG ID FOUND FOR HLMSGIEN '"_ORGHLMSG_"'"
 .D NOTIF^AGMPIHLO(ORGHLMSG,ERROR)
 S HLMSGIEN=$P($G(^HLB(HLMSGIEN,0)),U,2)   ;GET THE CORRECT ORIGINATING MESSAGE
 D MSGCMPLT^AGMPIBGP(HLMSGIEN)
 Q
PARSE(DATA,MIEN,HLMSTATE) ;EP
 N SEG,CNT
 Q:'$$STARTMSG^HLOPRS(.HLMSTATE,MIEN)
 M DATA("HDR")=HLMSTATE("HDR")
 S CNT=0
 F  Q:'$$NEXTSEG^HLOPRS(.HLMSTATE,.SEG)  D
 .S CNT=CNT+1
 .M DATA(CNT)=SEG
 Q
 ;THIS CALL HANDLES CHECKINS (A01) AND CHECKOUTS (A03)
CREATE(SDAMEVT,DFN,SDT,SUCCESS) ;EP - CREATE AND PLACE IN OUTGOING QUEUE
 ;CALLED BY PROTOCOL 'AGMP MPI CHECKIN CHECKOUT' WHICH SUBSCRIBES
 ;TO PROTOCOL 'BSDAM APPOINTMENT EVENTS' FOR CHECK INS AND CHECK OUTS
 ;DFN
 ;SDT = APPOINTMENT DATE
 ;SDAMEVT = EVENT
 ;          1 = make appt
 ;          2 = cancel appt
 ;          3 = no-show
 ;          4 = check-in
 ;          5 = check-out
 ;
 Q:(U_4_U_5_U)'[(U_SDAMEVT_U)  ;ONLY CARE ABOUT CHECKINS AND CHECKOUTS
 ;
 I $$DEMOPAT^AGMPHLU($G(DFN)) Q  ; 9/13/2017 - GCD - CR 7713 - Don't upload demo patients.
 ;
 S SDT=$$CONDT^AGMPHLU(SDT)  ;CONVERT DATE FOR MPI
 I SDAMEVT=4 D CREATMSG^AGMPIHLO(DFN,"A01",,.SUCCESS) I 1 ;I 1 USED TO RESTORE THE VALUE OF $T AFTER THE CALL
 E  D CREATMSG^AGMPIHLO(DFN,"A03",,.SUCCESS)
 I 'SUCCESS D
 .S AGERROR="MPI DFN="_DFN_" :: "_"ERROR WHEN CREATING "_$S(SDAMEVT=4:"A01",1:"A03")
 .D NOTIF^AGMPIHLO(DFN,AGERROR)
 Q