BUD6RPL1 ; IHS/CMI/LAB - UDS print lists ;
;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
;
;
TOL ;EP
I '$D(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS")) D T6H W !!,"No Incomplete visits to report.",!! Q
S BUDP=0
S BUD6L="" F S BUD6L=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L)) Q:BUD6L=""!(BUDQUIT) D
.D T6H Q:BUDQUIT
.W !!,"Line ",BUD6L," ",$P($T(@BUD6L),";;",2)
.S BUDCOM="" F S BUDCOM=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM)) Q:BUDCOM=""!(BUDQUIT) D
..S BUDAGE="" F S BUDAGE=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE)) Q:BUDAGE=""!(BUDQUIT) D
...S BUDSEX="" F S BUDSEX=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX)) Q:BUDSEX=""!(BUDQUIT) D
....S DFN=0 F S DFN=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN)) Q:DFN'=+DFN!(BUDQUIT) D T6W
....Q
...Q
..Q
.Q
Q
T6W ;
W !,$E($P(^DPT(DFN,0),U,1),1,22),?24,$S($$HRN^AUPNPAT(DFN,BUDSITE)]"":$$HRN^AUPNPAT(DFN,BUDSITE,2),1:$$HRN^AUPNPAT(DFN,DUZ(2),2)),?36,$E(BUDCOM,1,12),?51,$P(^DPT(DFN,0),U,2)
W ?55,$$AGE^AUPNPAT(DFN,BUDCAD),?60,$P($$RACE^BUD6RPTC(DFN),U,2)
S BUDV=0 F S BUDV=$O(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV)) Q:BUDV'=+BUDV!(BUDQUIT) D
.I $Y>(IOSL-3) D T6H Q:BUDQUIT
.W !?5,$$FMTE^XLFDT($P($P(^AUPNVSIT(BUDV,0),U),".")),?25,^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV),?40,$P(^AUPNVSIT(BUDV,0),U,7),?45,$E($$CLINIC^APCLV(BUDV,"E"),1,14),?60,$E($$LOCENC^APCLV(BUDV,"E"),1,14)
.Q
Q
T6H ;
G:'BUDGPG T6H1
K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BUDQUIT=1 Q
T6H1 ;
W:$D(IOF) @IOF S BUDGPG=BUDGPG+1
W !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
W !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
W !,$$CTR("Incomplete Visit List w/Services relevant to Table 6",80),!
W $$CTR($P(^DIC(4,BUDSITE,0),U),80),!
S X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED) W $$CTR(X,80),!
W $TR($J("",80)," ","-")
I BUDP=0 W !,"List of all incomplete visits with a service relevant to Table 6.",!,"These services are not included in Table 6."
W !,"PATIENT NAME",?24,"HRN",?36,"COMMUNITY",?50,"SEX",?55,"AGE",?60,"RACE/ETHN"
W !?5,"VISIT DATE",?25,"PROV TYPE",?41,"SRV",?45,"CLINIC",?62,"LOCATION"
W !,$TR($J("",80)," ","-")
S BUDP=1
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
USR() ;EP - Return name of current user from ^VA(200.
Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
;----------
1 ;;Symptomatic HIV
2 ;;Asymptomatic HIV
3 ;;Tuberculosis
4 ;;Syphilis and other venereal diseases
5 ;;Asthma
6 ;;Chronic bronchitis and emphysema
7 ;;Abnormal breast findings, female
8 ;;Abnormal cervical findings
9 ;;Diabetes mellitus
10 ;;Heart disease (selected)
11 ;;Hypertension
12 ;;Contact dermatitis and other eczema
13 ;;Dehydration
14 ;;Exposure to heat or cold
15 ;;Otitis media and eustachian tube disorders
16 ;;Selected perinatal medical conditions
17 ;;Lack of expected normal physiological development
18 ;;Alcohol related disorders
19 ;;Other substance related disorders (excluding tobacco use disorder)
20 ;;Other Mental disorders, excluding drug or alcohol dependence
21 ;;HIV Test
22 ;;Mammogram
23 ;;Pap Smear
24 ;;Selected Immunizations
25 ;;Contraceptive Management
26 ;;Health supervision of infant or child (ages 0 through 11)
27 ;;Dental: I. Emergency Services
28 ;;Dental: II. Oral Exams
29 ;;Dental: Prophylaxis - adult or child
30 ;;Dental: Sealants
31 ;;Dental: Flouride treatment
32 ;;Dental: III. Restorative Services
33 ;;Dental: IV. Oral Surger (extractions only)
34 ;;Dental: V. Rehabilitative services (Endo, Perio, Porstho, Ortho)
BUD6RPL1 ; IHS/CMI/LAB - UDS print lists ;
+1 ;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
+2 ;
+3 ;
TOL ;EP
+1 IF '$DATA(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS"))
DO T6H
WRITE !!,"No Incomplete visits to report.",!!
QUIT
+2 SET BUDP=0
+3 SET BUD6L=""
FOR
SET BUD6L=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L))
IF BUD6L=""!(BUDQUIT)
QUIT
Begin DoDot:1
+4 DO T6H
IF BUDQUIT
QUIT
+5 WRITE !!,"Line ",BUD6L," ",$PIECE($TEXT(@BUD6L),";;",2)
+6 SET BUDCOM=""
FOR
SET BUDCOM=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM))
IF BUDCOM=""!(BUDQUIT)
QUIT
Begin DoDot:2
+7 SET BUDAGE=""
FOR
SET BUDAGE=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE))
IF BUDAGE=""!(BUDQUIT)
QUIT
Begin DoDot:3
+8 SET BUDSEX=""
FOR
SET BUDSEX=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX))
IF BUDSEX=""!(BUDQUIT)
QUIT
Begin DoDot:4
+9 SET DFN=0
FOR
SET DFN=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN))
IF DFN'=+DFN!(BUDQUIT)
QUIT
DO T6W
+10 QUIT
End DoDot:4
+11 QUIT
End DoDot:3
+12 QUIT
End DoDot:2
+13 QUIT
End DoDot:1
+14 QUIT
T6W ;
+1 WRITE !,$EXTRACT($PIECE(^DPT(DFN,0),U,1),1,22),?24,$SELECT($$HRN^AUPNPAT(DFN,BUDSITE)]"":$$HRN^AUPNPAT(DFN,BUDSITE,2),1:$$HRN^AUPNPAT(DFN,DUZ(2),2)),?36,$EXTRACT(BUDCOM,1,12),?51,$PIECE(^DPT(DFN,0),U,2)
+2 WRITE ?55,$$AGE^AUPNPAT(DFN,BUDCAD),?60,$PIECE($$RACE^BUD6RPTC(DFN),U,2)
+3 SET BUDV=0
FOR
SET BUDV=$ORDER(^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV))
IF BUDV'=+BUDV!(BUDQUIT)
QUIT
Begin DoDot:1
+4 IF $Y>(IOSL-3)
DO T6H
IF BUDQUIT
QUIT
+5 WRITE !?5,$$FMTE^XLFDT($PIECE($PIECE(^AUPNVSIT(BUDV,0),U),".")),?25,^XTMP("BUD6RPT1",BUDJ,BUDH,"ORPHANS",BUD6L,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV),?40,$PIECE(^AUPNVSIT(BUDV,0),U,7),?45,$EXTRACT($$CLINIC^APCLV(BUDV,"E"),1,14),?60,...
... $EXTRACT($$LOCENC^APCLV(BUDV,"E"),1,14)
+6 QUIT
End DoDot:1
+7 QUIT
T6H ;
+1 IF 'BUDGPG
GOTO T6H1
+2 KILL DIR
IF $EXTRACT(IOST)="C"
IF IO=IO(0)
IF '$DATA(ZTQUEUED)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BUDQUIT=1
QUIT
T6H1 ;
+1 IF $DATA(IOF)
WRITE @IOF
SET BUDGPG=BUDGPG+1
+2 WRITE !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
+3 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
+4 WRITE !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
+5 WRITE !,$$CTR("Incomplete Visit List w/Services relevant to Table 6",80),!
+6 WRITE $$CTR($PIECE(^DIC(4,BUDSITE,0),U),80),!
+7 SET X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED)
WRITE $$CTR(X,80),!
+8 WRITE $TRANSLATE($JUSTIFY("",80)," ","-")
+9 IF BUDP=0
WRITE !,"List of all incomplete visits with a service relevant to Table 6.",!,"These services are not included in Table 6."
+10 WRITE !,"PATIENT NAME",?24,"HRN",?36,"COMMUNITY",?50,"SEX",?55,"AGE",?60,"RACE/ETHN"
+11 WRITE !?5,"VISIT DATE",?25,"PROV TYPE",?41,"SRV",?45,"CLINIC",?62,"LOCATION"
+12 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+13 SET BUDP=1
+14 QUIT
CTR(X,Y) ;EP - Center X in a field Y wide.
+1 QUIT $JUSTIFY("",$SELECT($DATA(Y):Y,1:IOM)-$LENGTH(X)\2)_X
+2 ;----------
USR() ;EP - Return name of current user from ^VA(200.
+1 QUIT $SELECT($GET(DUZ):$SELECT($DATA(^VA(200,DUZ,0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
+2 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
+1 QUIT $SELECT($GET(DUZ(2)):$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
+2 ;----------
1 ;;Symptomatic HIV
2 ;;Asymptomatic HIV
3 ;;Tuberculosis
4 ;;Syphilis and other venereal diseases
5 ;;Asthma
6 ;;Chronic bronchitis and emphysema
7 ;;Abnormal breast findings, female
8 ;;Abnormal cervical findings
9 ;;Diabetes mellitus
10 ;;Heart disease (selected)
11 ;;Hypertension
12 ;;Contact dermatitis and other eczema
13 ;;Dehydration
14 ;;Exposure to heat or cold
15 ;;Otitis media and eustachian tube disorders
16 ;;Selected perinatal medical conditions
17 ;;Lack of expected normal physiological development
18 ;;Alcohol related disorders
19 ;;Other substance related disorders (excluding tobacco use disorder)
20 ;;Other Mental disorders, excluding drug or alcohol dependence
21 ;;HIV Test
22 ;;Mammogram
23 ;;Pap Smear
24 ;;Selected Immunizations
25 ;;Contraceptive Management
26 ;;Health supervision of infant or child (ages 0 through 11)
27 ;;Dental: I. Emergency Services
28 ;;Dental: II. Oral Exams
29 ;;Dental: Prophylaxis - adult or child
30 ;;Dental: Sealants
31 ;;Dental: Flouride treatment
32 ;;Dental: III. Restorative Services
33 ;;Dental: IV. Oral Surger (extractions only)
34 ;;Dental: V. Rehabilitative services (Endo, Perio, Porstho, Ortho)