source: WorldVistAEHR/trunk/r/VISUAL_IMPAIRMENT_SERVICE_TEAM-ANRV/ANRVRP8.m@ 1639

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

initial load of WorldVistAEHR

File size: 4.7 KB
Line 
1ANRVRP8 ;BIRM/LDT - VIST ROSTER OUTPATIENT APPOINTMENTS ; 17 Feb 98 / 2:26 PM
2 ;;4.0; Visual Impairment Service Team ;;12 Jun 98
3EN1 ;Entry point for Roster Outpatient Appointment.
4 W @IOF,!!,"OUTPATIENT APPOINTMENT LIST",!!,"The right margin for this report is 132.",!!
5 D SEL1 G:SEL="^" QUIT
6BDT W ! S %DT="AEX",%DT("A")="BEGINNING date for report: " D ^%DT K %DT G:Y<0 QUIT S BDT=Y
7EDT S %DT="AEX",%DT(0)=BDT,%DT("A")="ENDING date for report: " D ^%DT K %DT G:Y<0 QUIT S EDT=Y
8 D SEL2 G:'$D(ANRVLP) QUIT
9DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!!" G QUIT
10 I $D(IO("Q")) K IO("Q") S ZTDESC="VIST ROSTER OUTPATIENT APPOINTMENTS",ZTRTN="DEQ^ANRVRP8" S:$D(ANRVLP) ZTSAVE("ANRVLP(")="" F G="BDT","EDT","SEL" S:$D(@G) ZTSAVE(G)=""
11 I D ^%ZTLOAD K ZTSK G QUIT
12 U IO
13DEQ ;Entry point when queued.
14 K ^TMP("ANRV",$J)
15 S ANRVP=0 F S ANRVP=$O(ANRVLP(ANRVP)) Q:'ANRVP S DFN=$P($G(^ANRV(2040,ANRVP,0)),U),VASD("T")=EDT,VASD("F")=BDT D 9^VADPT,SETTMP
16 S HDR="VIST ROSTER OUTPATIENT APPOINTMENTS"
17 S (PG,QFLG)=0,$P(LN,"-",133)="" D NOW^%DTC S Y=$E(%,1,12) X ^DD("DD") S HDT=Y D HDR
18 I '$D(^TMP("ANRV",$J)) W !,"NO DATA TO PRINT!" G QUIT
19 D REPORT
20 ;
21QUIT K %,%H,%I,%T,%Y,ANRVP,ANRV,ANRVAP,ANRVLP,APP,BDT,DFN,EDT,HDR,HDT,JJ,LN,NAME,NN,PG,POP,QFLG,RVDT,SEL,SUB1,SUB2,X,Y,XX,XXX D KVAR^VADPT,KVA^VADPT
22 W:$E(IOST)'="C" @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
23 Q
24 ;
25SETTMP ;Set TMP global
26 I $D(^UTILITY("VASD",$J)) D
27 .I SEL="P" S SUB1=VADM(1),^TMP("ANRV",$J,SUB1,0)=VADM(1)_U_$P(VADM(2),U,2) D
28 ..S RVDT=$O(^ANRV(2040,ANRVP,6," "),-1) S:RVDT]"" RVDT=$G(^ANRV(2040,ANRVP,6,RVDT,0)) I RVDT]"" S Y=$P(RVDT,U) X ^DD("DD") S $P(^TMP("ANRV",$J,SUB1,0),U,3)=Y,$P(^(0),U,4)=$P(RVDT,U,2)
29 ..S APP=0 F S APP=$O(^UTILITY("VASD",$J,APP)) Q:'APP S ^TMP("ANRV",$J,SUB1,APP)=$G(^UTILITY("VASD",$J,APP,"E"))
30 .I SEL="D" S SUB2=VADM(1),APP=0 F S APP=$O(^UTILITY("VASD",$J,APP)) Q:'APP S %DT="NTX",X=$P(^UTILITY("VASD",$J,APP,"E"),U) D ^%DT S SUB1=Y,^TMP("ANRV",$J,SUB1,SUB2,0)=VADM(1)_U_$P(VADM(2),U,2) D
31 ..S RVDT=$O(^ANRV(2040,ANRVP,6," "),-1) S:RVDT]"" RVDT=$G(^ANRV(2040,ANRVP,6,RVDT,0)) I RVDT]"" S Y=$P(RVDT,U) X ^DD("DD") S $P(^TMP("ANRV",$J,SUB1,SUB2,0),U,3)=Y,$P(^(0),U,4)=$P(RVDT,U,2)
32 ..S ^TMP("ANRV",$J,SUB1,SUB2,APP)=$G(^UTILITY("VASD",$J,APP,"E"))
33 Q
34 ;
35HDR ;Report header
36 I $E(IOST)="C",PG>0 S DIR(0)="E" D ^DIR K DIR I 'Y S QFLG=1 Q
37 S PG=PG+1 W:$Y!($E(IOST)="C") @IOF Q:(PG>1)&($E(IOST)="C") W !,HDR," FROM " S Y=BDT X ^DD("DD") W Y," TO " S Y=EDT X ^DD("DD") W Y,?100,"Page ",PG
38 W !,"NAME",?32,"SSN",?45,"LAST ANNUAL REVIEW",?65,"STATUS",?81,"APPT. DATE/TIME",?100,"CLINIC",!,LN
39 Q
40 ;
41REPORT ;Print Report
42 I SEL="P" S NAME="" F S NAME=$O(^TMP("ANRV",$J,NAME)) Q:NAME="" D D:$Y+4>IOSL HDR Q:QFLG
43 .F XX=1:1:4 S ANRV(XX)=$P($G(^TMP("ANRV",$J,NAME,0)),U,XX)
44 .W !!,ANRV(1),?32,ANRV(2),?48,ANRV(3),?65,$S(ANRV(4)="035":"COMPLETE (035)",ANRV(4)="036":"DECLINED (036)",ANRV(4)="037":"NO SHOW (037)",1:"")
45 .S NN=0 F S NN=$O(^TMP("ANRV",$J,NAME,NN)) Q:'NN D
46 ..F XXX=1:1:4 S ANRVAP(XXX)=$P($G(^TMP("ANRV",$J,NAME,NN)),U,XXX)
47 ..W ?81,ANRVAP(1),?100,ANRVAP(2),!
48 I SEL="D" S APP=0,NAME="" F S APP=$O(^TMP("ANRV",$J,APP)) Q:'APP F S NAME=$O(^TMP("ANRV",$J,APP,NAME)) Q:NAME="" D D:$Y+5>IOSL HDR Q:QFLG
49 .F XX=1:1:4 S ANRV(XX)=$P($G(^TMP("ANRV",$J,APP,NAME,0)),U,XX)
50 .W !!,ANRV(1),?32,ANRV(2),?48,ANRV(3),?65,$S(ANRV(4)="035":"COMPLETE (035)",ANRV(4)="036":"DECLINED (036)",ANRV(4)="037":"NO SHOW (037)",1:"")
51 .S NN=0 F S NN=$O(^TMP("ANRV",$J,APP,NAME,NN)) Q:'NN D
52 ..F XXX=1:1:4 S ANRVAP(XXX)=$P($G(^TMP("ANRV",$J,APP,NAME,NN)),U,XXX)
53 ..W ?81,ANRVAP(1),?100,ANRVAP(2),!
54 Q
55SEL1 W !!,"Do you want to sort by (P)atient or (D)ate/time of appointment?",!
56 S DIR(0)="SAOBM^P:PATIENT;D:DATE/TIME",DIR("A")="Choose P or D: ",DIR("?")="^D HELPSEL^ANRVRP8" D ^DIR K DIR
57 S SEL=Y S:SEL="" SEL="^" G:SEL="^" QUIT2 Q
58SEL2 W !!,"Do you want to list outpatient appointments for:",!?7,"(A)ll patients, or",!?7,"(S)elect patients.",!
59 S DIR(0)="SAOBM^A:ALL;S:SELECT",DIR("A")="Choose A or S: ",DIR("?")="^D HELP2^ANRVRP8" D ^DIR K DIR
60 I Y="A" G SETLP
61ASKPT ;Ask for selected patients.
62 W !
63 S DIC="^ANRV(2040,",DIC(0)="QEAM",DIC("S")="I $P($G(^ANRV(2040,+Y,13)),U,2)'=""I""" D ^DIC K DIC I Y<0 Q
64 S ANRVLP(+Y)="" G ASKPT
65 Q
66QUIT2 K %,X,Y Q
67SETLP ;Set ANRVLP for all patients who are not inactive for AMIS
68 S JJ=0 F S JJ=$O(^ANRV(2040,JJ)) Q:'JJ I $P($G(^ANRV(2040,JJ,13)),U,2)'="I" S ANRVLP(JJ)=""
69 Q
70HELPSEL ;
71 W !!,"Enter:",!?7,"""P"" to sort outpatient appointments by patient in alphabetic order.",!?7,"""D"" to sort outpatient appointments by date/time of clinic appointment.",!?7,"""^"" or <return> to halt." Q
72HELP2 ;
73 W !!,"Enter:",!?7,"""A"" to list ALL patients from the VIST ROSTER file with",!?11,"outpatient appointments.",!?7,"""S"" to select only specific patients.",!?7,"""^"" or <return> to halt." Q
Note: See TracBrowser for help on using the repository browser.