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

APCLDV3.m

Go to the documentation of this file.
  1. APCLDV3 ; IHS/CMI/LAB - list IPV/DV screenings ;
  1. ;;2.0;IHS PCC SUITE;**8,10**;MAY 14, 2009;Build 88
  1. ;
  1. INFORM ;
  1. W !,$$CTR($$USR)
  1. W !,$$LOC()
  1. W !!,$$CTR("LISTING OF PATIENT'S RECEIVING IPV SCREENING,INCLUDING REFUSALS",80)
  1. W !!,"This report will list all patients you select who have had IPV screening "
  1. W !,"(Exam code 34) or a refusal documented in a specified time frame."
  1. W !,"You will select the patients based on age, gender, result, provider,"
  1. W !,"or clinic where the screeing was done."
  1. W !!,"NOTE: All screenings done in the time period for the patient's selected "
  1. W !,"will be displayed on the report."
  1. W !
  1. D XIT
  1. S APCLEXC=$O(^AUTTEXAM("C",34,0))
  1. I 'APCLEXC W !!,"Exam code 34 is missing from the EXAM table. Cannot run report.",! H 3 D XIT Q
  1. ;
  1. DATES K APCLED,APCLBD
  1. W !,"Please enter the date range during which the screening was done.",!,"To get all screenings ever put in a long date range like 01/01/1980",!,"to the present date.",!
  1. K DIR W ! S DIR(0)="DO^::EXP",DIR("A")="Enter Beginning Date for Screening"
  1. D ^DIR Q:Y<1 S APCLBD=Y
  1. K DIR S DIR(0)="DO^:DT:EXP",DIR("A")="Enter Ending Date for Screening"
  1. D ^DIR Q:Y<1 S APCLED=Y
  1. ;
  1. I APCLED<APCLBD D G DATES
  1. . W !!,$C(7),"Sorry, Ending Date MUST not be earlier than Beginning Date."
  1. ;
  1. FAC ;
  1. K APCLQ
  1. S APCLLOCT=""
  1. S DIR(0)="S^A:ALL Locations/Facilities;S:One SERVICE UNIT'S Locations/Facilities;O:ONE Location/Facility",DIR("A")="Include Visits to Which Location/Facilities",DIR("B")="A"
  1. S DIR("A")="Include screenings done at which facilities",DIR("B")="O" K DA D ^DIR K DIR,DA
  1. G:$D(DIRUT) DATES
  1. S APCLLOCT=Y
  1. I APCLLOCT="A" G COMM
  1. D @APCLLOCT^APCLDV1
  1. G:$D(APCLQ) FAC
  1. COMM ;
  1. K APCLQ
  1. S APCLCOMT=""
  1. W !!,"You can just include patients living in certain communities",!,"or include all patients regardless of where they live."
  1. S DIR(0)="S^A:ALL Patient Communitiess;S:Selected Set (taxonomy) of Communities;O:ONE Community",DIR("A")="Include Visits to Which Location/Facilities",DIR("B")="A"
  1. S DIR("A")="Include screenings done at which facilities",DIR("B")="O" K DA D ^DIR K DIR,DA
  1. G:$D(DIRUT) FAC
  1. S APCLCOMT=Y
  1. I APCLCOMT="A" G EXCL
  1. D @(APCLCOMT_"C")^APCLDV1
  1. G:$D(APCLQ) COMM
  1. EXCL ;
  1. S APCLEXBH=""
  1. W !!,"Would you like to include screenings done in the behavioral health clinics: "
  1. W !,"Mental Health (14); Alcohol and Substance Abuse (43); Medical"
  1. W !,"Social Services (48); Behavioral Health (C4) "
  1. S DIR(0)="Y",DIR("A")="and Telebehavioral Health (C9)",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G DATES
  1. S APCLEXBH=Y
  1. SEX ;
  1. S APCLSEX=""
  1. S DIR(0)="S^F:FEMALES Only;M:MALES Only;U:UNKNOWN GENDER Only;B:ALL GENDERS",DIR("A")="Include which patients in the list",DIR("B")="F" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G EXCL
  1. S APCLSEX=Y
  1. I APCLSEX="B" S APCLSEX="MFU"
  1. AGE ;Age Screening
  1. K APCLAGE,APCLAGET
  1. W ! S DIR(0)="YO",DIR("A")="Would you like to restrict the report by Patient age range",DIR("B")="YES"
  1. S DIR("?")="If you wish to include visits from ALL age ranges, anwser No. If you wish to list visits for only patients within a particular age range, enter Yes."
  1. D ^DIR K DIR
  1. G:$D(DIRUT) SEX
  1. I 'Y G RESULT
  1. ;
  1. AGER ;Age Screening
  1. W !
  1. S DIR(0)="FO^1:7",DIR("A")="Enter an Age Range (e.g. 5-12,1-1)" D ^DIR
  1. I Y="" W !!,"No age range entered." G AGE
  1. I Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter a numeric range in the format nnn-nnn. e.g. 0-5, 0-99, 5-20." G AGER
  1. S APCLAGET=Y
  1. RESULT ;result screenig
  1. K APCLREST
  1. W !!,"You can limit the list to only patients who have had a screening"
  1. W !,"in the time period on which the result was any combination of the"
  1. W !,"following: (e.g. to get only those patients who have had a result of "
  1. W !,"Present enter 2 to get all patients who have had a screening result of"
  1. W !,"Past or Present, enter 2,3)",!
  1. W !?3,"1) Normal/Negative"
  1. W !?3,"2) Present"
  1. W !?3,"3) Past"
  1. W !?3,"4) Present and Past"
  1. W !?3,"5) Refused"
  1. W !?3,"6) Unable to Screen"
  1. W !?3,"7) Screenings done with no result entered"
  1. W !
  1. W !
  1. K DIR S DIR(0)="L^1:7",DIR("A")="Which result values do you want included on this list",DIR("B")="" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G AGE
  1. I Y="" G AGE
  1. S APCLREST=Y
  1. S A=Y,C="" F I=1:1 S C=$P(A,",",I) Q:C="" S APCLREST(C)=""
  1. CLINIC ;
  1. K APCLCLNT
  1. W ! S DIR(0)="Y",DIR("A")="Include visits to ALL clinics",DIR("B")="Yes" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:$D(DIRUT) RESULT
  1. I Y=1 G PRIMPRV
  1. CLINIC1 ;
  1. S X="CLINIC",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" G XIT
  1. D PEP^AMQQGTX0(+Y,"APCLCLNT(")
  1. I '$D(APCLCLNT) G CLINIC
  1. I $D(APCLCLNT("*")) K APCLCLNT
  1. PRIMPRV ;
  1. S (APCLDISC,APCLPSRT,APCLPPUN)="" K APCLPROV
  1. S DIR(0)="SO^O:One Provider Only;P:Any/All Providers (including unknown);U:Unknown Provider Only"
  1. S DIR("A")="Report should include visits whose PRIMARY PROVIDER on the visit is"
  1. S DIR("?")="If you wish to count only one primary provider of service enter a 'O'. To include ALL providers enter an 'A'. To include all providers of one discipline enter a 'D'." D ^DIR K DIR
  1. G:$D(DIRUT) XIT
  1. S APCLPSRT=Y
  1. I Y="P" K APCLPROV G PRVSCR
  1. I Y="U" S APCLPPUN=1 G PRVSCR
  1. PRV1 ;
  1. I $P(^DD(9000010.06,.01,0),U,2)[200 S DIC="^VA(200,",DIC(0)="AEMQ",D="AK.PROVIDER",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D MIX^DIC1 K DIC,D
  1. I $P(^DD(9000010.06,.01,0),U,2)[6 S DIC="^DIC(6,",DIC(0)="AEMQ",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D ^DIC K DIC
  1. I $D(DTOUT)!(Y=-1) G PRIMPRV
  1. S APCLPROV=+Y
  1. PRVSCR ;
  1. S (APCLSSRT,APCLSPUN)="" K APCLSPRV
  1. S DIR(0)="SO^O:One Provider Only;P:Any/All Providers (including unknown);U:Unknown Provider Only"
  1. S DIR("A")="Select which providers WHO PERFORMED THE SCREENING should be included"
  1. S DIR("?")="If you wish to count only one Provider enter a 'O'. To include ALL providers enter an 'A'. To include all providers of one discipline enter a 'D'." D ^DIR K DIR
  1. G:$D(DIRUT) XIT
  1. S APCLSSRT=Y
  1. I Y="P" K APCLSPRV G DESPRV
  1. I Y="U" S APCLSPUN=1 G DESPRV
  1. SCRPRV1 ;
  1. I $P(^DD(9000010.06,.01,0),U,2)[200 S DIC="^VA(200,",DIC(0)="AEMQ",D="AK.PROVIDER",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D MIX^DIC1 K DIC,D
  1. I $P(^DD(9000010.06,.01,0),U,2)[6 S DIC="^DIC(6,",DIC(0)="AEMQ",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D ^DIC K DIC
  1. I $D(DTOUT)!(Y=-1) G PRVSCR
  1. S APCLSPRV=+Y
  1. DESPRV ;
  1. S APCLDESP=""
  1. W !!,"Would you like to limit the list to just patients who have"
  1. S DIR(0)="Y",DIR("A")="a particular designated primary care provider",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G PRIMPRV
  1. I 'Y S APCLDESP="" G TEMP
  1. DESPRV1 ;
  1. I $P(^DD(9000010.06,.01,0),U,2)[200 S DIC="^VA(200,",DIC(0)="AEMQ",D="AK.PROVIDER",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D MIX^DIC1 K DIC,D
  1. I $P(^DD(9000010.06,.01,0),U,2)[6 S DIC="^DIC(6,",DIC(0)="AEMQ",DIC("A")="Enter PROVIDER (Lastname,Firstname): " D ^DIC K DIC
  1. I $D(DTOUT)!(Y=-1) G DESPRV
  1. S APCLDESP=+Y
  1. TEMP ;TEMPLATE OR LIST
  1. S APCLTMPL="",APCLSTMP=""
  1. S DIR(0)="SO^L:List of Patient Screenings;S:Create a Search Template of Patients",DIR("B")="L",DIR("A")="Select Report Type"
  1. D ^DIR K DIR
  1. I $D(DIRUT) G DESPRV
  1. S APCLTMPL=Y
  1. I APCLTMPL="S" D ^APCLSTMP G:APCLSTMP="" TEMP G ZIS
  1. LIST1 ;
  1. S APCLSORT=""
  1. W !
  1. S DIR(0)="S^H:Health Record Number;N:Patient Name;P:Provider who screened;C:Clinic;R:Result of Exam;D:Date Screened;A:Age of Patient at Screening;G:Gender of Patient;T:Terminal Digit HRN"
  1. S DIR("A")="How would you like the list to be sorted",DIR("B")="H"
  1. KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G PRIMPRV
  1. S APCLSORT=Y
  1. DP ;
  1. S APCLDP=""
  1. W !
  1. S DIR(0)="Y",DIR("A")="Display the Patient's Designated Providers on the list",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G LIST1
  1. S APCLDP=Y
  1. ZIS ;
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCLDEMO)
  1. I APCLDEMO=-1 G DP
  1. S XBRP="PRINT^APCLDV3P",XBRC="PROC^APCLDV31",XBRX="XIT^APCLDV3",XBNS="APCL"
  1. D ^XBDBQUE
  1. D XIT
  1. Q
  1. XIT ;
  1. D EN^XBVK("APCL")
  1. D ^XBFMK
  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
  1. ;----------
  1. EOP ;EP - End of page.
  1. Q:$E(IOST)'="C"
  1. Q:IO'=IO(0)
  1. Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
  1. NEW DIR
  1. K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
  1. W !
  1. S DIR("A")="End of Report. Press Enter",DIR(0)="E" D ^DIR
  1. Q
  1. ;----------
  1. USR() ;EP - Return name of current user from ^VA(200.
  1. Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
  1. ;----------
  1. LOC() ;EP - Return location name from file 4 based on DUZ(2).
  1. Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
  1. ;----------