source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDPCE2.m@ 767

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

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1SDPCE2 ;MJK/ALB - Process PCE - Bulletin ;01 APR 1993
2 ;;5.3;Scheduling;**27**;08/13/93
3 ;
4 ; **** See SDPCE0 for variable definitions ****
5 ;
6BULL(DFN,SDT,SDCL,SDEVENT,SDERR,SDVSIT,SDACT) ;
7 ; input:
8 ; o Required Variables:
9 ; DFN := ifn of patient
10 ; SDT := visit date [internal date format]
11 ; SDCL := ifn of clinic
12 ; SDEVENT() := event info array
13 ; SDERR() := error info array
14 ; SDACT := activity [free text]
15 ; SDVSIT() := visit info array
16 ;
17 ;
18 N SDBUL,XMDUZ,XMSUB,XMTEXT,SDLN,VA,SDTYPE,SDMSG,SDATA,STATUS
19 ;
20 ; -- check status... if cancelled or no-show quit
21 S SDATA=$G(^DPT(DFN,"S",SDT,0))
22 S STATUS=+$$STATUS^SDAM1(DFN,SDT,SDCL,SDATA,$G(SDDA))
23 IF "^4^5^6^7^9^10^"[U_STATUS_U G BULLQ
24 ;
25 ; -- should message be sent
26 S SDMSG=$$MSG() IF SDMSG="" G BULLQ
27 ;
28 ; -- if no notifications to process then quit
29 IF '$D(SDERR("ERROR")),'$D(SDERR("WARNING")) G BULLQ
30 ;
31 ; -- if (no 'errors' to process) and ('warnings' are NOT to be processed) then quit
32 IF '$D(SDERR("ERROR")),SDMSG'["WARNING" G BULLQ
33 ;
34 ; use site specified mg and bull is only sent if mg defined
35 D XMY^SDUTL2(+$P($G(^DG(43,1,"SCLR")),U,26),0,0) G BULLQ:'$D(XMY)
36 S XMSUB="Scheduling API Error/Warning",XMTEXT="SDBUL("
37 D SET("The following background error has occurred:")
38 D SET("")
39 D SET(" Activity: "_SDACT)
40 D SET(" Visit File Entry #: "_SDVSIT)
41 D SET(" Visit Date: "_$$FTIME^VALM1(SDT))
42 D SET(" Clinic: "_$P($G(^SC(+SDCL,0)),U))
43 D PID^VADPT6
44 D SET(" Patient: "_$P($G(^DPT(+DFN,0)),U)_" ("_VA("BID")_")")
45 D SET("")
46 F SDTYPE="ERROR","WARNING" IF SDMSG[SDTYPE D TYPE(SDTYPE)
47 D ^XMD
48BULLQ K XMY Q
49 ;
50SET(X) ; -- set text into array
51 S SDLN=$G(SDLN)+1,SDBUL(SDLN,0)=X Q
52 ;
53TYPE(SDTYPE) ; -- insert errors/warnings into msg
54 N SDI,X,Y,SDCNT
55 S SDCNT=0
56 D SET(SDTYPE_" #:")
57 D SET($E("-------------",1,$L(SDTYPE)+3))
58 S SDI=0 F S SDI=$O(SDERR(SDTYPE,SDI)) Q:'SDI D
59 . S X=SDERR(SDTYPE,SDI),Y=$P(X,U,2),SDCNT=SDCNT+1
60 . D SET(" "_$P(X,U)_$E(" ",1,8-$L($P(X,U)))_"-> "_$E(Y,1,60)) S Y=$E(Y,61,999)
61 . F Q:Y="" D SET(" "_$E(Y,1,60)) S Y=$E(Y,61,999)
62 IF 'SDCNT D SET(" <none reported>")
63 D SET(""),SET("")
64 Q
65 ;
66MSG() ; -- msg flag 'ERROR' or 'WARNING' or 'ERROR+WARNING'
67 N Y,X
68 S Y=$P($G(^DG(43,1,"SCLR")),U,27),X=""
69 I Y["E" S X=X_"ERROR/"
70 I Y["W" S X=X_"WARNING"
71 Q X
72 ;
Note: See TracBrowser for help on using the repository browser.