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

YSGAFOBX.m

Go to the documentation of this file.
  1. YSGAFOBX ;ALB/SCK-GAF score event handler ;7/11/98
  1. ;;5.01;MENTAL HEALTH;**43,50,59,119**;Dec 30, 1994;Build 40
  1. ;
  1. ; ^VA(200 supported by DBIA #10060
  1. ; ^DPT( supported by DBIA #10035
  1. ;
  1. Q
  1. EN(YSDA) ;
  1. ; Entry point for handling the GAF score entry to the
  1. ; DIAGNOSTICS RESULTS -MENTAL HEALTH file (#627.8)
  1. ; This entry point will trigger the GAF A08 HL7 update message transmission
  1. ; Input - IEN of the entry in file #627.8
  1. ;
  1. ; Output
  1. ; If no problems are encountered, a confirmation message of the
  1. ; HL7 message transmission will be sent to the specified mail
  1. ; group indicating the patient and HL7 message number.
  1. ;
  1. ; The Mail Group is "YS GAF TRANSMISSION ACK".
  1. ;
  1. ; If a problem occurs, an error message indicating the patient
  1. ; observation and event DT, and error will be sent to the same
  1. ; mail group
  1. ;
  1. ;
  1. ;
  1. START ;; Check input
  1. ;
  1. Q ; no longer sending HL7 messages
  1. ;
  1. S YSDA=+$G(YSDA)
  1. Q:('$D(^YSD(627.8,YSDA,0)))
  1. ;
  1. N DFN,YSDXDT,YSOBX,YSINFO,RETURN,YSEVDT
  1. ;
  1. ;; Build data array
  1. ;; Send error message if DFN not defined
  1. S DFN=+$P($G(^YSD(627.8,YSDA,0)),"^",2)
  1. I 'DFN D Q
  1. . D RESPONSE(YSDA,"-1^DFN was not defined",DFN)
  1. ;
  1. ;; Send error message if AXIS 5 score not defined
  1. S YSOBX(5)=$P($G(^YSD(627.8,YSDA,60)),"^",3)
  1. I ('+YSOBX(5)) D Q
  1. . D RESPONSE(YSDA,"-1^AXIS 5 (GAF) was not defined",DFN)
  1. ;
  1. ;; Send error message if observation DT not defined
  1. S YSOBX(14)=$P($G(^YSD(627.8,YSDA,0)),"^",3)
  1. I ('+YSOBX(14)) D Q
  1. . D RESPONSE(YSDA,"-1^Date/Time of Diagnosis was not defined",DFN)
  1. ;
  1. S YSOBX(11)="F"
  1. S YSOBX(3)="GAF~Global Assessment of Function~AXIS 5"
  1. S YSOBX(4)=$P($G(^YSD(627.8,YSDA,60)),"^",4)
  1. S YSOBX(2)="ST"
  1. S YSOBX(16)=$P($G(^YSD(627.8,YSDA,0)),"^",4)
  1. ;
  1. ;; Set HL7 required data
  1. S YSEVDT=$$NOW^XLFDT
  1. S YSINFO("SERVER PROTOCOL")="YS GAF"
  1. S RETURN=$$EN^YSGAFHL7(DFN,"A08",YSEVDT,"YSOBX","YSINFO")
  1. D RESPONSE(YSDA,RETURN,DFN)
  1. Q
  1. ;
  1. RESPONSE(YSIEN,TXT,DFN) ; Send error message for problem with GAF HL7 transmission
  1. ;
  1. N XMCHAN,XMDUZ,MSGTXT,XMSUB,XMDUZ,XMTEXT,XMY
  1. ;
  1. ;; Create Mail message and send to GAF mail group
  1. S XMSUB=$S(+TXT>0:"GAF Score Sent",1:"GAF Score Transmission Problem")
  1. S XMDUZ="GAF HL7 TRANSMISSION"
  1. S XMY("G.YS GAF TRANSMISSION ACK")=""
  1. S XMCHAN=1
  1. ;
  1. ;D DEM^VADPT
  1. I +TXT>0 D
  1. . S MSGTXT(1)="GAF Score for "_$P($G(^DPT(DFN,0)),"^")
  1. . S MSGTXT(2)="Observation Dt: "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
  1. . S MSGTXT(3)="HL7 Message Number: #"_+TXT
  1. E D
  1. . S MSGTXT(1)="A problem occurred during transmission of a GAF score to the NPCD"
  1. . S MSGTXT(2)=" Error Msg = "_$P(TXT,"^",2)
  1. . S MSGTXT(3)=" User = "_$P($G(^VA(200,DUZ,0)),"^")
  1. . S MSGTXT(4)=" Patient = "_$P($G(^DPT(DFN,0)),"^")
  1. . S MSGTXT(5)=" Obs. Date = "_$$FMTE^XLFDT(+$P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
  1. . S MSGTXT(6)=" File Date = "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^"),"1P")
  1. ;
  1. S XMTEXT="MSGTXT("
  1. D ^XMD
  1. Q