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

AGMPHL03.m

Go to the documentation of this file.
AGMPHL03 ; IHS/SD/TPF - MPI ADT-A03 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 ADMISSIONS (A01) AND DISCHARGES (A03)
CREATE(DFN,DGPMT,DGPMCA,SUCCESS) ;EP - CREATE AND PLACE IN OUTGOING QUEUE
 ;CALLED BY PROTOCOL 'AGMP MPI ADMIT DISCHARG' WHICH SUBSCRIBES
 ;TO PROTOCOL 'BSDAM MOVEMENT EVENTS' FOR ADMISSIONS AND DISCHARGES
 ;DFN
 ;DGPMT  = TYPE OF MOVEMENT
 ;        1 = ADMISSION
 ;        2 = WARD TRANSFER
 ;        3 = DISCHARGE
 ;        4 = CHECK-IN LODGER
 ;        5 = CHECK-OUT LODGER
 ;        6 = SERVICE TRANSFER
 ;
 ;DGPMDA = MOVEMENTS IFN
 ;DGPMCA = ADMISSION IFN
 ;
 Q:(U_1_U_3_U)'[(U_DGPMT_U)
 ;
 I $$DEMOPAT^AGMPHLU($G(DFN)) Q  ; 9/13/2017 - GCD - CR 7713 - Don't upload demo patients.
 ;
 ;GET DATE OF ADMISSION OR DISCHARGE
 ;
 I $E(DGPMCA)="T" S SDT=$TR(DGPMCA,"T")  ;CALL CAME FROM AGMPHLU
 E  S SDT=$$GET1^DIQ(405,+DGPMCA_",",.01,"I")
 ;
 S SDT=$$CONDT^AGMPHLU(SDT)  ;CONVERT DATE FOR MPI
 I DGPMT=1 D CREATMSG^AGMPIHLO(DFN,"A01",,.SUCCESS)
 E  D CREATMSG^AGMPIHLO(DFN,"A03",,.SUCCESS)
 I 'SUCCESS D
 .S AGERROR="MPI DFN="_DFN_" :: "_"ERROR WHEN CREATING "_$S(DGPMT=1:"A01",1:"A03")
 .D NOTIF^AGMPIHLO(DFN,AGERROR)
 Q