VistA-FOIAVistA/r/REGISTRATION-DGQE-DG-DPT-GR.../DGMTOFA1.m

44 lines
2.2 KiB
Mathematica

DGMTOFA1 ;ALB/CAW - Output for Means/Copay Test List/Letter ; 8/24/92
;;5.3;Registration;**19,33,166,182**;Aug 13, 1993
;
;
EN S (DGTMP,DGTMP1,DGTMP2,DGTMP3)="",(DGSTOP,DGPAGE)=0,$P(DGLINE,"-",IOM+1)=""
I '$D(^TMP("DGMTO",$J)) D HDR W !!,"THERE ARE NO PATIENTS THAT WILL NEED A "_$S(DGMTYPT=1:"MEANS",1:"COPAY")_" TEST AT THEIR NEXT APPOINTMENT FOR THIS DATE RANGE" Q
F S DGTMP=$O(^TMP("DGMTO",$J,DGTMP)) Q:'DGTMP!(DGSTOP) F S DGTMP1=$O(^TMP("DGMTO",$J,DGTMP,DGTMP1)) Q:DGTMP1=""!(DGSTOP) D HDR D Q:DGSTOP W:$E(IOST,1)="P" @IOF I $E(IOST,1,2)="C-" D PAUSE G ENQ:'Y
.F S DGTMP2=$O(^TMP("DGMTO",$J,DGTMP,DGTMP1,DGTMP2)) Q:DGTMP2=""!(DGSTOP) F S DGTMP3=$O(^TMP("DGMTO",$J,DGTMP,DGTMP1,DGTMP2,DGTMP3)) Q:'DGTMP3!(DGSTOP) S DGINFO=^(DGTMP3) D Q:DGSTOP
..S:$P(DGINFO,U,5)="P" $P(DGINFO,U,4)="PEND. ADJ." S DFN=+DGINFO D PID^VADPT
..S SDAPTYP=$P($G(^SD(409.1,+$P(DGINFO,U,6),0)),U,4)
..S DGNXTMT=$P(DGINFO,U,7),DGNXTMT=$$FDATE^DGMTUTL($E(DGNXTMT,1,12))
..W !,$E(DGTMP2,1,15),?17,VA("PID"),?29,$$FDATE^DGMTUTL($E(DGTMP3,1,12)),?46,SDAPTYP,?50,$P(DGINFO,U,4),?59,$S($P(DGINFO,U,2)="":"",1:$$FDATE^DGMTUTL($P(DGINFO,U,3)))
..W ?70,DGNXTMT
..D CHK
D LETTER
ENQ Q
;
HDR ; Header
U IO W:$E(IOST,1,2)["C-" @IOF
S DGPAGE=DGPAGE+1
I DGMTYPT=1 W "Patients Requiring Means Test At Next Appointment"
I DGMTYPT=2 W "Copay Exemptions That Will Need Updating At Next Appointment"
W ?70,"Page: "_DGPAGE
W !,"Date Range: "_$$FDATE^DGMTUTL(DGBEG)_" to "_$$FDATE^DGMTUTL($P(DGEND,".")) D NOW^%DTC W ?51,"Run Date: "_$E($$FDATE^DGMTUTL(%),1,20)
I $D(^TMP("DGMTO",$J)) D
.W !!,"","CLINIC: "_DGTMP1,?50,"DIVISION: "_$P($$SITE^VASITE(DGBEG,DGTMP),U,2)
.W !!?46,"APPT",?59,"INCOMPLETE",?70,"FUTURE"
.W !,"PATIENT",?17,"PATIENT ID",?29,"APPT DATE/TIME",?46,"TYPE",?51,"STATUS",?59,"TEST",?70," TEST"
W !,DGLINE
Q
;
CHK ;Check to pause on screen
I ($Y+5)>IOSL,$E(IOST,1,2)="C-" D PAUSE S DGP=Y D:DGP HDR I 'DGP S DGSTOP=1 Q
I $E(IOST,1,2)="P-",($Y+5)>IOSL W @IOF D HDR Q
Q
PAUSE ;
W ! S DIR(0)="E" D ^DIR K DIR W !
Q
;
LETTER ; Check and print letter
I $D(DGYN),DGYN S (DGTMP,DFN)="" D
.;F S DGTMP=$O(^TMP("DGMTL",$J,DGTMP)) Q:DGTMP="" F S DFN=$O(^TMP("DGMTL",$J,DGTMP,DFN)) Q:'DFN D CHECK^DGMTLTR
Q