Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BDPNODP

BDPNODP.m

Go to the documentation of this file.
  1. BDPNODP ;IHS/CMI/LAB - listing of patients with no desg prov
  1. ;;2.0;IHS PCC SUITE;**7**;MAY 14, 2009
  1. ;
  1. ;
  1. INFORM ;
  1. W !!,"This report will generate a list of patients who do not have a designated"
  1. W !,"provider assigned. The user will be able to run this report on a selected"
  1. W !,"set of patients or on a search template of patients. The user will also"
  1. W !,"be able to select which designated provider category to report on. For"
  1. W !,"example you can run this report for all females over 18 with no designated"
  1. W !,"Women's Health Case Manager or run the report for all patients living in"
  1. W !,"a particular community with no designated primary care provider."
  1. W !!
  1. ST ;
  1. W !,"Please note that you will get a chance later to further refine the set"
  1. W !,"of patients to include in this report.",!
  1. S BDPSEAT=""
  1. S DIR(0)="S^A:All Patients;S:Search template (cohort) of Patients",DIR("A")="Run the report for",DIR("B")="A"
  1. KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) D XIT Q
  1. I Y="A" G PGEN
  1. ST1 ;
  1. S BDPSEAT=""
  1. W ! S DIC("S")="I $P(^(0),U,4)=2!($P(^(0),U,4)=9000001)" S DIC="^DIBT(",DIC("A")="Enter Patient SEARCH TEMPLATE name: ",DIC(0)="AEMQ"
  1. D ^DIC K DIC,DA,DR,DICR
  1. I Y=-1 G ST
  1. S BDPSEAT=+Y
  1. PGEN ;
  1. S BDPSC=""
  1. W !!,"You will now be able to select criteria for which patients to "
  1. W !,"include in the report. If you are running this report on a search"
  1. W !,"template of patients and do not want additional criteria applied"
  1. W !,"you can bypass the criteria selection."
  1. S DIR(0)="Y",DIR("A")="Do you want to apply search criteria for which subset of patients to include",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G ST
  1. S BDPSC=Y
  1. I BDPSC=0 G CAT
  1. CONT ;
  1. S BDPNCAN=1 D ADD^APCLVL01 I $D(BDPQUIT) D DEL^APCLVL K BDPQUIT G ST
  1. S APCLTCW=0,APCLPTVS="P",APCLTYPE="P",APCLCTYP="T"
  1. K ^APCLVRPT(APCLRPT,11) S APCLCNTL="S" D ^APCLVL4 K APCLCNTL I $D(APCLQUIT) D DEL^APCLVL G ST
  1. CAT ;which category
  1. W !!,"Enter the designated provider category for which you would like a list"
  1. W !,"of patients who do not have a provider assigned.",!
  1. S DIR(0)="90360.1,.01",DIR("A")="Enter the Designated Provider Category"
  1. KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G ST
  1. S BDPCAT=+Y
  1. S BDPCATN=$P(Y,U,2)
  1. SORT ;
  1. S BDPSORT=""
  1. S DIR(0)="S^N:Patient Name;H:HRN;C:Current Community;A:Age of the Patient"
  1. S DIR("A")="How do you want the list of patients sorted",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G CAT
  1. S BDPSORT=Y
  1. ZIS ;
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.BDPDEMO)
  1. I BDPDEMO=-1 G SORT
  1. S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to ",DIR("B")="P" K DA D ^DIR K DIR
  1. I $D(DIRUT) G XIT
  1. S BDPBROW=Y
  1. I $G(Y)="B" D BROWSE,XIT Q
  1. W !! S XBRP="PRINT^BDPNODP",XBRC="PROC^BDPNODP",XBNS="BDP",XBRX="XIT^BDPNODP"
  1. D ^XBDBQUE
  1. D XIT
  1. Q
  1. BROWSE ;
  1. S XBRP="VIEWR^XBLM(""PRINT^BDPNODP"")"
  1. S XBNS="BDP",XBRC="PROC^BDPNODP",XBRX="XIT^BDPNODP",XBIOP=0 D ^XBDBQUE
  1. Q
  1. ;
  1. PAUSE ;
  1. S DIR(0)="E",DIR("A")="Press return to continue or '^' to quit" D ^DIR K DIR,DA
  1. S:$D(DIRUT) BDPQUIT=1
  1. W:$D(IOF) @IOF
  1. Q
  1. XIT ;
  1. D EN^XBVK("BDP")
  1. K L,M,S,T,X,X1,X2,Y,Z,B
  1. D KILL^AUPNPAT
  1. D ^XBFMK
  1. Q
  1. PROC ;
  1. S BDPJOB=$J,BDPBTH=$H,BDPTOT=0,DFN=0,BDPBT=$H
  1. D XTMP^APCLOSUT("BDPNODP","BDP - NO DESIGNATED PROV REPORT")
  1. ;loop through either the template or the patient file and apply screens
  1. I $G(BDPSEAT) D STP Q
  1. S DFN=0 F S DFN=$O(^AUPNPAT(DFN)) Q:DFN'=+DFN D
  1. .Q:$$DEMO^APCLUTL(DFN,$G(BDPDEMO))
  1. .I BDPSC D SCREENS
  1. .Q:$D(BDPSKIP)
  1. .;check to see if they have a desginated provider in the category selected.
  1. .K R
  1. .D ALLDP^BDPAPI(DFN,BDPCATN,.R)
  1. .I $D(R) Q ;has the provider
  1. .S BDPSRTV=""
  1. .D @BDPSORT
  1. .S ^XTMP("BDPNODP",BDPJOB,BDPBTH,BDPSRTV,DFN)=""
  1. .Q
  1. Q
  1. STP ;
  1. S DFN=0 F S DFN=$O(^DIBT(BDPSEAT,1,DFN)) Q:DFN'=+DFN D
  1. .Q:$$DEMO^APCLUTL(DFN,$G(BDPDEMO))
  1. .I BDPSC D SCREENS
  1. .;check to see if they have a desginated provider in the category selected.
  1. .K R
  1. .D ALLDP^BDPAPI(DFN,$P(^BDPTCAT(BDPCAT,0),U,1),.R)
  1. .I $D(R) Q ;has the provider
  1. .S BDPSRTV=""
  1. .D @BDPSORT
  1. .S ^XTMP("BDPNODP",BDPJOB,BDPBTH,BDPSRTV,DFN)=""
  1. .Q
  1. Q
  1. SCREENS ;
  1. K BDPSKIP
  1. S APCLI=0 F S APCLI=$O(^APCLVRPT(APCLRPT,11,APCLI)) Q:APCLI'=+APCLI!($D(BDPSKIP)) D
  1. .I '$P(^APCLVSTS(APCLI,0),U,8) D SINGLE Q
  1. .D MULT
  1. .Q
  1. Q
  1. SINGLE ;
  1. K X,APCLSPEC S X="",APCLX=0
  1. X:$D(^APCLVSTS(APCLI,1)) ^(1)
  1. I X="" S BDPSKIP="" Q
  1. I '$D(APCLSPEC),'$D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",X)) S BDPSKIP="" Q
  1. I $D(APCLSPEC),X="" S BDPSKIP=1 Q
  1. Q
  1. MULT ;
  1. K APCLFOUN,BDPSKIP,APCLSPEC,X S APCLX=0,X=""
  1. X:$D(^APCLVSTS(APCLI,1)) ^(1)
  1. I $O(X(""))="" S BDPSKIP="" Q
  1. I '$D(APCLSPEC) S Y="" F S Y=$O(X(Y)) Q:Y="" I $D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",Y)) S APCLFOUN="" Q
  1. I $D(APCLSPEC),$D(X) S APCLFOUN=1 Q
  1. S:'$D(APCLFOUN) BDPSKIP=""
  1. Q
  1. N ;
  1. S BDPSRTV=$P(^DPT(DFN,0),U,1)
  1. Q
  1. H ;
  1. S BDPSRTV=$$HRN^AUPNPAT(DFN,DUZ(2))
  1. Q
  1. C S BDPSRTV=$$COMMRES^AUPNPAT(DFN,"E") Q
  1. A S BDPSRTV=$$AGE^AUPNPAT(DFN,DT) Q
  1. ;
  1. PRINT ;
  1. S BDP80D="-------------------------------------------------------------------------------"
  1. S BDPPG=0
  1. I '$D(^XTMP("BDPNODP",BDPJOB,BDPBTH)) D HEAD W !!,"NO PATIENTS TO REPORT" G DONE
  1. D HEAD
  1. S BDPPROV=0 F S BDPPROV=$O(^XTMP("BDPNODP",BDPJOB,BDPBTH,BDPPROV)) Q:BDPPROV=""!($D(BDPQ)) D
  1. .F S DFN=$O(^XTMP("BDPNODP",BDPJOB,BDPBTH,BDPPROV,DFN)) Q:DFN=""!($D(BDPQ)) D DFN
  1. DONE D DONE^APCLOSUT
  1. K ^XTMP("BDPNODP",BDPJOB,BDPBTH),BDPJOB,BDPBTH
  1. Q
  1. DFN ;
  1. I $Y>(IOSL-3) D HEAD Q:$D(BDPQ)
  1. D LVST
  1. W $E($P(^DPT(DFN,0),U),1,20),?24,$$UP^XLFSTR($$DOB^AUPNPAT(DFN,"E")),?40,$$HRN^AUPNPAT(DFN,DUZ(2)),?50,$E($$COMMRES^AUPNPAT(DFN,"E"),1,15),?66,BDPDT,!
  1. Q
  1. I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BDPQ="" Q
  1. HEAD1 ;
  1. I BDPPG W:$D(IOF) @IOF
  1. S BDPPG=BDPPG+1
  1. W $P(^VA(200,DUZ,0),U,2),?30,$$FMTE^XLFDT($$NOW^XLFDT),?70,"PAGE "_BDPPG,!
  1. W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
  1. W $$CTR("PATIENTS WITH NO "_BDPCATN_" DESIGNATED PROVIDER",80),!
  1. I BDPSEAT W !,$$CTR("SEARCH TEMPLATE USED: "_$P(^DIBT(BDPSEAT,0),U,1),80),!
  1. W !?50,"CURRENT",!
  1. W "NAME",?24,"DOB",?40,"HRN",?50,"COMMUNITY",?66,"LAST VISIT",!,BDP80D,!
  1. Q
  1. LVST ;ENTRY POINT from [BDP PRIM PROV LISTING print template
  1. S BDPAST=""
  1. S BDPVDFN=""
  1. S BDPAST=$O(^AUPNVSIT("AA",DFN,""))
  1. I BDPAST="" S BDPAST="NONE FOUND" Q
  1. S BDPVDFN=$O(^AUPNVSIT("AA",DFN,BDPAST,""))
  1. S Y=$P(^AUPNVSIT(BDPVDFN,0),U)
  1. D DD^%DT S BDPDT=$E(Y,1,12)
  1. Q
  1. CTR(X,Y) ;EP - Center X in a field Y wide.
  1. Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X