source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSGAFOBX.m@ 674

Last change on this file since 674 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1YSGAFOBX ;ALB/SCK-GAF score event handler ;7/11/98
2 ;;5.01;MENTAL HEALTH;**43,50,59**;Dec 30, 1994
3 ;
4 ; ^VA(200 supported by DBIA #10060
5 ; ^DPT( supported by DBIA #10035
6 ;
7 Q
8EN(YSDA) ;
9 ; Entry point for handling the GAF score entry to the
10 ; DIAGNOSTICS RESULTS -MENTAL HEALTH file (#627.8)
11 ; This entry point will trigger the GAF A08 HL7 update message transmission
12 ; Input - IEN of the entry in file #627.8
13 ;
14 ; Output
15 ; If no problems are encountered, a confirmation message of the
16 ; HL7 message transmission will be sent to the specified mail
17 ; group indicating the patient and HL7 message number.
18 ;
19 ; The Mail Group is "YS GAF TRANSMISSION ACK".
20 ;
21 ; If a problem occurrs, an error message indicating the patient
22 ; observation and event DT, and error will be sent to the same
23 ; mail group
24 ;
25 ;
26 ;
27START ;; Check input
28 S YSDA=+$G(YSDA)
29 Q:('$D(^YSD(627.8,YSDA,0)))
30 ;
31 N DFN,YSDXDT,YSOBX,YSINFO,RETURN,YSEVDT
32 ;
33 ;; Build data array
34 ;; Send error message if DFN not defined
35 S DFN=+$P($G(^YSD(627.8,YSDA,0)),"^",2)
36 I 'DFN D Q
37 . D RESPONSE(YSDA,"-1^DFN was not defined",DFN)
38 ;
39 ;; Send error message if AXIS 5 score not defined
40 S YSOBX(5)=$P($G(^YSD(627.8,YSDA,60)),"^",3)
41 I ('+YSOBX(5)) D Q
42 . D RESPONSE(YSDA,"-1^AXIS 5 (GAF) was not defined",DFN)
43 ;
44 ;; Send error message if observation DT not defined
45 S YSOBX(14)=$P($G(^YSD(627.8,YSDA,0)),"^",3)
46 I ('+YSOBX(14)) D Q
47 . D RESPONSE(YSDA,"-1^Date/Time of Diagnosis was not defined",DFN)
48 ;
49 S YSOBX(11)="F"
50 S YSOBX(3)="GAF~Global Assessment of Function~AXIS 5"
51 S YSOBX(4)=$P($G(^YSD(627.8,YSDA,60)),"^",4)
52 S YSOBX(2)="ST"
53 S YSOBX(16)=$P($G(^YSD(627.8,YSDA,0)),"^",4)
54 ;
55 ;; Set HL7 required data
56 S YSEVDT=$$NOW^XLFDT
57 S YSINFO("SERVER PROTOCOL")="YS GAF"
58 S RETURN=$$EN^YSGAFHL7(DFN,"A08",YSEVDT,"YSOBX","YSINFO")
59 D RESPONSE(YSDA,RETURN,DFN)
60 Q
61 ;
62RESPONSE(YSIEN,TXT,DFN) ; Send error message for problem with GAF HL7 transmission
63 ;
64 N XMCHAN,XMDUZ,MSGTXT,XMSUB,XMDUZ,XMTEXT,XMY
65 ;
66 ;; Create Mail message and send to GAF mail group
67 S XMSUB=$S(+TXT>0:"GAF Score Sent",1:"GAF Score Transmission Problem")
68 S XMDUZ="GAF HL7 TRANSMISSION"
69 S XMY("G.YS GAF TRANSMISSION ACK")=""
70 S XMCHAN=1
71 ;
72 ;D DEM^VADPT
73 I +TXT>0 D
74 . S MSGTXT(1)="GAF Score for "_$P($G(^DPT(DFN,0)),"^")
75 . S MSGTXT(2)="Observation Dt: "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
76 . S MSGTXT(3)="HL7 Message Number: #"_+TXT
77 E D
78 . S MSGTXT(1)="A problem occured during transmission of a GAF score to the NPCD"
79 . S MSGTXT(2)=" Error Msg = "_$P(TXT,"^",2)
80 . S MSGTXT(3)=" User = "_$P($G(^VA(200,DUZ,0)),"^")
81 . S MSGTXT(4)=" Patient = "_$P($G(^DPT(DFN,0)),"^")
82 . S MSGTXT(5)=" Obs. Date = "_$$FMTE^XLFDT(+$P($G(^YSD(627.8,YSIEN,0)),"^",3),"1P")
83 . S MSGTXT(6)=" File Date = "_$$FMTE^XLFDT($P($G(^YSD(627.8,YSIEN,0)),"^"),"1P")
84 ;
85 S XMTEXT="MSGTXT("
86 D ^XMD
87 Q
Note: See TracBrowser for help on using the repository browser.