- YSGAFOBX ;ALB/SCK-GAF score event handler ;7/11/98
- ;;5.01;MENTAL HEALTH;**43,50,59,119**;Dec 30, 1994;Build 40
- ;
- ; ^VA(200 supported by DBIA #10060
- ; ^DPT( supported by DBIA #10035
- ;
- Q
- EN(YSDA) ;
- ; Entry point for handling the GAF score entry to the
- ; DIAGNOSTICS RESULTS -MENTAL HEALTH file (#627.8)
- ; This entry point will trigger the GAF A08 HL7 update message transmission
- ; Input - IEN of the entry in file #627.8
- ;
- ; Output
- ; If no problems are encountered, a confirmation message of the
- ; HL7 message transmission will be sent to the specified mail
- ; group indicating the patient and HL7 message number.
- ;
- ; The Mail Group is "YS GAF TRANSMISSION ACK".
- ;
- ; If a problem occurs, an error message indicating the patient
- ; observation and event DT, and error will be sent to the same
- ; mail group
- ;
- ;
- ;
- START ;; Check input
- ;
- Q ; no longer sending HL7 messages
- ;
- S YSDA=+$G(YSDA)
- Q:('$D(^YSD(627.8,YSDA,0)))
- ;
- N DFN,YSDXDT,YSOBX,YSINFO,RETURN,YSEVDT
- ;
- ;; Build data array
- ;; Send error message if DFN not defined
- S DFN=+$P($G(^YSD(627.8,YSDA,0)),"^",2)
- I 'DFN D Q
- . D RESPONSE(YSDA,"-1^DFN was not defined",DFN)
- ;
- ;; Send error message if AXIS 5 score not defined
- S YSOBX(5)=$P($G(^YSD(627.8,YSDA,60)),"^",3)
- I ('+YSOBX(5)) D Q
- . D RESPONSE(YSDA,"-1^AXIS 5 (GAF) was not defined",DFN)
- ;
- ;; Send error message if observation DT not defined
- S YSOBX(14)=$P($G(^YSD(627.8,YSDA,0)),"^",3)
- I ('+YSOBX(14)) D Q
- . D RESPONSE(YSDA,"-1^Date/Time of Diagnosis was not defined",DFN)
- ;
- S YSOBX(11)="F"
- S YSOBX(3)="GAF~Global Assessment of Function~AXIS 5"
- S YSOBX(4)=$P($G(^YSD(627.8,YSDA,60)),"^",4)
- S YSOBX(2)="ST"
- S YSOBX(16)=$P($G(^YSD(627.8,YSDA,0)),"^",4)
- ;
- ;; Set HL7 required data
- S YSEVDT=$$NOW^XLFDT
- S YSINFO("SERVER PROTOCOL")="YS GAF"
- S RETURN=$$EN^YSGAFHL7(DFN,"A08",YSEVDT,"YSOBX","YSINFO")
- D RESPONSE(YSDA,RETURN,DFN)
- Q
- ;
- RESPONSE(YSIEN,TXT,DFN) ; Send error message for problem with GAF HL7 transmission
- ;
- N XMCHAN,XMDUZ,MSGTXT,XMSUB,XMDUZ,XMTEXT,XMY
- ;
- ;; Create Mail message and send to GAF mail group
- S XMSUB=$S(+TXT>0:"GAF Score Sent",1:"GAF Score Transmission Problem")
- S XMDUZ="GAF HL7 TRANSMISSION"
- S XMY("G.YS GAF TRANSMISSION ACK")=""
- S XMCHAN=1
- ;
- ;D DEM^VADPT
- I +TXT>0 D
- . S MSGTXT(1)="GAF Score for "_$P($G(^DPT(DFN,0)),"^")
- . S MSGTXT(2)="Observation Dt: "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
- . S MSGTXT(3)="HL7 Message Number: #"_+TXT
- E D
- . S MSGTXT(1)="A problem occurred during transmission of a GAF score to the NPCD"
- . S MSGTXT(2)=" Error Msg = "_$P(TXT,"^",2)
- . S MSGTXT(3)=" User = "_$P($G(^VA(200,DUZ,0)),"^")
- . S MSGTXT(4)=" Patient = "_$P($G(^DPT(DFN,0)),"^")
- . S MSGTXT(5)=" Obs. Date = "_$$FMTE^XLFDT(+$P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
- . S MSGTXT(6)=" File Date = "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^"),"1P")
- ;
- S XMTEXT="MSGTXT("
- D ^XMD
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYSGAFOBX 3065 printed Jan 18, 2025@03:15:43 Page 2
- YSGAFOBX ;ALB/SCK-GAF score event handler ;7/11/98
- +1 ;;5.01;MENTAL HEALTH;**43,50,59,119**;Dec 30, 1994;Build 40
- +2 ;
- +3 ; ^VA(200 supported by DBIA #10060
- +4 ; ^DPT( supported by DBIA #10035
- +5 ;
- +6 QUIT
- EN(YSDA) ;
- +1 ; Entry point for handling the GAF score entry to the
- +2 ; DIAGNOSTICS RESULTS -MENTAL HEALTH file (#627.8)
- +3 ; This entry point will trigger the GAF A08 HL7 update message transmission
- +4 ; Input - IEN of the entry in file #627.8
- +5 ;
- +6 ; Output
- +7 ; If no problems are encountered, a confirmation message of the
- +8 ; HL7 message transmission will be sent to the specified mail
- +9 ; group indicating the patient and HL7 message number.
- +10 ;
- +11 ; The Mail Group is "YS GAF TRANSMISSION ACK".
- +12 ;
- +13 ; If a problem occurs, an error message indicating the patient
- +14 ; observation and event DT, and error will be sent to the same
- +15 ; mail group
- +16 ;
- +17 ;
- +18 ;
- START ;; Check input
- +1 ;
- +2 ; no longer sending HL7 messages
- QUIT
- +3 ;
- +4 SET YSDA=+$GET(YSDA)
- +5 if ('$DATA(^YSD(627.8,YSDA,0)))
- QUIT
- +6 ;
- +7 NEW DFN,YSDXDT,YSOBX,YSINFO,RETURN,YSEVDT
- +8 ;
- +9 ;; Build data array
- +10 ;; Send error message if DFN not defined
- +11 SET DFN=+$PIECE($GET(^YSD(627.8,YSDA,0)),"^",2)
- +12 IF 'DFN
- Begin DoDot:1
- +13 DO RESPONSE(YSDA,"-1^DFN was not defined",DFN)
- End DoDot:1
- QUIT
- +14 ;
- +15 ;; Send error message if AXIS 5 score not defined
- +16 SET YSOBX(5)=$PIECE($GET(^YSD(627.8,YSDA,60)),"^",3)
- +17 IF ('+YSOBX(5))
- Begin DoDot:1
- +18 DO RESPONSE(YSDA,"-1^AXIS 5 (GAF) was not defined",DFN)
- End DoDot:1
- QUIT
- +19 ;
- +20 ;; Send error message if observation DT not defined
- +21 SET YSOBX(14)=$PIECE($GET(^YSD(627.8,YSDA,0)),"^",3)
- +22 IF ('+YSOBX(14))
- Begin DoDot:1
- +23 DO RESPONSE(YSDA,"-1^Date/Time of Diagnosis was not defined",DFN)
- End DoDot:1
- QUIT
- +24 ;
- +25 SET YSOBX(11)="F"
- +26 SET YSOBX(3)="GAF~Global Assessment of Function~AXIS 5"
- +27 SET YSOBX(4)=$PIECE($GET(^YSD(627.8,YSDA,60)),"^",4)
- +28 SET YSOBX(2)="ST"
- +29 SET YSOBX(16)=$PIECE($GET(^YSD(627.8,YSDA,0)),"^",4)
- +30 ;
- +31 ;; Set HL7 required data
- +32 SET YSEVDT=$$NOW^XLFDT
- +33 SET YSINFO("SERVER PROTOCOL")="YS GAF"
- +34 SET RETURN=$$EN^YSGAFHL7(DFN,"A08",YSEVDT,"YSOBX","YSINFO")
- +35 DO RESPONSE(YSDA,RETURN,DFN)
- +36 QUIT
- +37 ;
- RESPONSE(YSIEN,TXT,DFN) ; Send error message for problem with GAF HL7 transmission
- +1 ;
- +2 NEW XMCHAN,XMDUZ,MSGTXT,XMSUB,XMDUZ,XMTEXT,XMY
- +3 ;
- +4 ;; Create Mail message and send to GAF mail group
- +5 SET XMSUB=$SELECT(+TXT>0:"GAF Score Sent",1:"GAF Score Transmission Problem")
- +6 SET XMDUZ="GAF HL7 TRANSMISSION"
- +7 SET XMY("G.YS GAF TRANSMISSION ACK")=""
- +8 SET XMCHAN=1
- +9 ;
- +10 ;D DEM^VADPT
- +11 IF +TXT>0
- Begin DoDot:1
- +12 SET MSGTXT(1)="GAF Score for "_$PIECE($GET(^DPT(DFN,0)),"^")
- +13 SET MSGTXT(2)="Observation Dt: "_$$FMTE^XLFDT($PIECE($GET(^YSD(627.8,YSIEN,0)),"^",3),"1P")
- +14 SET MSGTXT(3)="HL7 Message Number: #"_+TXT
- End DoDot:1
- +15 IF '$TEST
- Begin DoDot:1
- +16 SET MSGTXT(1)="A problem occurred during transmission of a GAF score to the NPCD"
- +17 SET MSGTXT(2)=" Error Msg = "_$PIECE(TXT,"^",2)
- +18 SET MSGTXT(3)=" User = "_$PIECE($GET(^VA(200,DUZ,0)),"^")
- +19 SET MSGTXT(4)=" Patient = "_$PIECE($GET(^DPT(DFN,0)),"^")
- +20 SET MSGTXT(5)=" Obs. Date = "_$$FMTE^XLFDT(+$PIECE($GET(^YSD(627.8,YSIEN,0)),"^",3),"1P")
- +21 SET MSGTXT(6)=" File Date = "_$$FMTE^XLFDT($PIECE($GET(^YSD(627.8,YSIEN,0)),"^"),"1P")
- End DoDot:1
- +22 ;
- +23 SET XMTEXT="MSGTXT("
- +24 DO ^XMD
- +25 QUIT