SCRPW75 ;BP-CIOFO/KEITH,ESW - Clinic Appointment Availability Extract (cont.) ; 5/15/03 3:15pm ;;5.3;Scheduling;**206,223,241,249,291**;AUG 13, 1993 ; NAVA(SDBDT,SDEDT,SDEX) ;Gather next available appointment wait time information ;Input: SDBDT=beginning date ;Input: SDEDT=ending date ;Input: SDEX='0' for user report, '1' for Austin extract ;Output: ^TMP("SDNAVA",$J) array in the format: ; ^TMP("SDNAVA",$J,division)='x' ; ^TMP("SDNAVA",$J,division,credit_pair)='x' ; ^TMP("SDNAVA",$J,division,credit_pair,clinic_ifn)='x' ; ^TMP("SDNAVA",$J,division;credit_pair,clinic_ifn,date_scheduled)='x' ; where 'x' consists of: ; piece 1 = flag '0' appts. ; 2 = ave. flag '0' wait time ; 3 = flag '1' appts. ; 4 = ave. flag '1' wait time ; 5 = flag '2' appts. ; 6 = ave. flag '2' wait time ; 7 = flag '3' appts. ; 8 = ave. flag '3' wait time ; 9 = follow-up next ava. appts. ; 10 = follow-up next ava. wait time ; 11 = follow-up non-next ava. appts. <2 days ; 12 = follow-up non-next ava. appts. <2 days wait time* ; 13 = follow-up non-next ava. appts. 2-7 days ; 14 = follow-up non-next ava. appts. 2-7 days wait time* ; 15 = follow-up non-next ava. appts. 8-30 days ; 16 = follow-up non-next ava. appts. 8-30 days wait time* ; 17 = follow-up non-next ava. appts. 31-60 days ; 18 = follow-up non-next ava. appts. 31-60 days wait time* ; 19 = follow-up non-next ava. appts. >60 days ; 20 = follow-up non-next ava. appts. >60 days wait time* ; 21 = non-follow-up next ava. appts. ; 22 = non-follow-up next ava. wait time ; 23 = non-follow-up non-next ava. appts. <2 days ; 24 = non-follow-up non-next ava. appts. <2 days wait time* ; 25 = non-follow-up non-next ava. appts. <2 days wait time** ; 26 = non-follow-up non-next ava. appts. 2-7 days ; 27 = non-follow-up non-next ava. appts. 2-7 days wait time* ; 28 = non-follow-up non-next ava. appts. 2-7 days wait time** ; 29 = non-follow-up non-next ava. appts. 8-30 days ; 30 = non-follow-up non-next ava. appts. 8-30 days wait time* ; 31 = non-follow-up non-next ava. appts. 8-30 days wait time** ; 32 = non-follow-up non-next ava. appts. 31-60 days ; 33 = non-follow-up non-next ava. appts. 31-60 days wait time* ; 34 = non-follow-up non-next ava. appts. 31-60 days wait time** ; 35 = non-follow-up non-next ava. appts. >60 days ; 36 = non-follow-up non-next ava. appts. >60 days wait time* ; 37 = non-follow-up non-next ava. appts. >60 days wait time** ; 38 = percent of non-next ava. appts. within 30 days ; 39 = percent of next ava. appts. within 30 days ; ; ^TMP("SDNAVB",$J) array in the format: ; ^TMP("SDNAVB",$J,division,credit_pair,clinic_ifn)='y' ; where 'y' consists of: ; piece 1 = % non-follow-up next ava. appts. within 30 days* ; 2 = % non-follow-up next ava. appts. within 30 days** ; 3 = % non-follow-up non-next ava. appts. within 30 days* ; 4 = % non-follow-up non-next ava. appts. within 30 days** ; 5 = sum of squared wait time next ava. appts.** ; 6 = sum of squared wait time non-follow-up appts.* ; 7 = sum of squared wait time non-follow-up appts.** ; 8 = total non-follow-up appointments ; ; * desired date to appointment date ; ** transaction date to appointment date ; N SDT,SDCT,DFN,SDADT,SDAP,SDAP0,SDWAIT,SDSFU,SDCWT3,SDAVE N SDCL,SDFLAG,SDX,SDY,SDZ,SDI,SC0,SDCP,SDSDEV,SDSDDT,SDAVE2 S SDT=SDBDT-1,(SDOUT,SDCT)=0 K ^TMP("SDWNAVA",$J),^TMP("SDXNAVA",$J),^TMP("SDYNAVA",$J),^TMP("SDZNAVA",$J),^TMP("SDNAVA",$J),^TMP("SDNAVB",$J) ;Iterate through 'date scheduled' xref F S SDT=$O(^DPT("ASADM",SDT)) Q:SDOUT!'SDT!(SDT>SDEDT) S DFN=0 D .F S DFN=$O(^DPT("ASADM",SDT,DFN)) Q:SDOUT!'DFN S SDADT=0 D ..I $G(SDREPORT(5))=1 I '$D(^TMP("SDIPLST",$J,DFN)) Q ;only selected patient if (5) ..Q:$E($P($G(^DPT(DFN,0)),U,9),1,5)="00000" ;exclude test patients ..F S SDADT=$O(^DPT("ASADM",SDT,DFN,SDADT)) Q:SDOUT!'SDADT D ...;Check for 'stop task' request ...S SDCT=SDCT+1 I SDCT#1000=0 D STOP Q:SDOUT ...;Get appointment node ...S SDAP0=$G(^DPT(DFN,"S",SDADT,0)) Q:$P(SDAP0,U,19)'=SDT ...I '$G(SDREPORT(5)) Q:$P(SDAP0,U,2)="C"!($P(SDAP0,U,2)="CA") ;quit if cancelled by clinic ...S SDCL=+SDAP0 Q:SDCL<1 ;get clinic ...;'next ava.' appointment indicator ...S SDFLAG=+$P(SDAP0,U,26) ...;'date desired' and 'follow up visit' indicator ...S SDX=$G(^DPT(DFN,"S",SDADT,1)) ...S SDSDDT=+$P(SDX,U),SDSFU=$P(SDX,U,2),SDSDEV="" ...;Calculate wait time 1 (transaction date to appointment) ...S SDWAIT=$S(SDADT60 days ; Q:SDSDEV<2 1 Q:SDSDEV<8 2 Q:SDSDEV<31 3 Q:SDSDEV<61 4 Q 5