1 | BMXUTL2 ; IHS/OIT/HMW - UTIL: PATIENT INFO ;
|
---|
2 | ;;4.1000;BMX;;Apr 17, 2011
|
---|
3 | ;;Stolen from:* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
|
---|
4 | ;; UTILITY: PATIENT FUNCTIONS: CONTRAS, INPATIENT, HIDOSE.
|
---|
5 | ;
|
---|
6 | NEXTAPPT(BMXDFN) ;EP
|
---|
7 | ;---> Return patient's next appointment from Scheduling Package.
|
---|
8 | ;---> Parameters:
|
---|
9 | ; 1 - BMXDFN (req) Patient's IEN (BMXDFN).
|
---|
10 | ;
|
---|
11 | Q:'$G(BMXDFN) ""
|
---|
12 | Q:'$D(^DPT(BMXDFN)) ""
|
---|
13 | ;
|
---|
14 | N BMXAPPT,BMXDT,BMXYES
|
---|
15 | S BMXDT=DT+.2400,BMXYES=0
|
---|
16 | F S BMXDT=$O(^DPT(BMXDFN,"S",BMXDT)) Q:'BMXDT!(BMXYES) D
|
---|
17 | .N BMXDATA,BMXOI,X
|
---|
18 | .S BMXDATA=$G(^DPT(BMXDFN,"S",BMXDT,0))
|
---|
19 | .Q:BMXDATA=""
|
---|
20 | .;
|
---|
21 | .;---> Quit if appointment is cancelled.
|
---|
22 | .Q:$P(BMXDATA,U,2)["C"
|
---|
23 | .;
|
---|
24 | .S X=0 F S X=$O(^SC(+BMXDATA,"S",BMXDT,1,X)) Q:'X D
|
---|
25 | ..Q:+$G(^SC(+BMXDATA,"S",BMXDT,1,X,0))'=BMXDFN
|
---|
26 | ..S BMXYES=BMXDT_U_+BMXDATA
|
---|
27 | ;
|
---|
28 | Q:'BMXYES ""
|
---|
29 | ;
|
---|
30 | S BMXAPPT=$$FMTE^XLFDT(+BMXYES,"1P")_" with "
|
---|
31 | S BMXAPPT=BMXAPPT_$P($G(^SC($P(BMXYES,U,2),0)),U)
|
---|
32 | Q BMXAPPT
|
---|