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

APCLACC.m

Go to the documentation of this file.
  1. APCLACC ; IHS/CMI/LAB - active users by community ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;IHS/CMI/LAB - added a template creation option
  1. START ;
  1. D INIT
  1. G:$D(APCLQUIT) EOJ
  1. SUF ;S (APCLSUF,APCLFS)="",DIR(0)="SBO^F:FACILITY;S:SERVICE UNIT",DIR("A")="Report for a particular Facility or for a Service Unit?" D ^DIR K DIR
  1. S (APCLSUF,APCLFS)="",DIR(0)="S^F:ONE OR MORE FACILITIES;S:ONE OR MORE SERVICE UNITS",DIR("A")="Report on patients registered at",DIR("B")="F" K DA D ^DIR K DIR
  1. G:$D(DIRUT) EOJ
  1. S APCLFS=Y
  1. G:Y="S" S
  1. F ;
  1. K APCLSU,APCLSUF
  1. S X="LOCATION OF ENCOUNTER",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 EOJ
  1. D PEP^AMQQGTX0(+Y,"APCLSU(")
  1. I '$D(APCLSU) G SUF
  1. I $D(APCLSU("*")) K APCLSU G SUF
  1. S X=0 F S X=$O(APCLSU(X)) Q:X'=+X I $P(^AUTTLOC(X,0),U,5) S APCLSUF($P(^AUTTLOC(X,0),U,5))="" ;set all service units in APCLSUF
  1. G SUR
  1. S ;
  1. K APCLSU
  1. S X="SERVICE UNIT",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 EOJ
  1. D PEP^AMQQGTX0(+Y,"APCLSU(")
  1. I '$D(APCLSU) G SUF
  1. I $D(APCLSU("*")) K APCLSU G SUF
  1. S X=0 F S X=$O(APCLSU(X)) Q:X'=+X S APCLSUF(X)=""
  1. SUR ;
  1. W !
  1. S APCLSSUR=""
  1. W ! S DIR("A")="Do you want to include only patients living in these"_$S(APCLFS="F":" Facility's",1:"")_" SERVICE UNIT's"
  1. S DIR(0)="YO"
  1. S DIR("?")="If you want to only include those people living in the SU indicated or the SU of the Facility indicated enter Y" D ^DIR K DIR
  1. G:$D(DIRUT) SUF
  1. S APCLSSUR=Y
  1. IND ;
  1. W ! S APCLIND="",DIR(0)="YO",DIR("A")="Do you wish to include only INDIAN patients",DIR("?")="If you wish to exclude Non-Indians from the report enter a Y" D ^DIR K DIR
  1. G:$D(DIRUT) SUF
  1. S APCLIND=Y
  1. FY ;
  1. S Y=DT X ^DD("DD") S APCLDTP=Y
  1. S %DT("A")="** Patients are to be considered ACTIVE 'as of' what date: ",%DT="AEPX" W ! D ^%DT
  1. I Y=-1 G IND
  1. S APCLFYE=Y X ^DD("DD") S APCLFYEY=Y
  1. RPT ;report type
  1. S APCLRPTT=""
  1. S DIR(0)="S^F:Full Report;T:Create a Template of the Active Patients",DIR("A")="Which report type do you want",DIR("B")="F" KILL DA D ^DIR KILL DIR
  1. G:$D(DIRUT) FY
  1. S APCLRPTT=Y
  1. I APCLRPTT="T" W !!,$C(7),"The name of the template will be: ACTIVE USERS AS OF "_$$FMTE^XLFDT(APCLFYE,"2E")_" and it will be attached to the IHS PATIENT file" G ZIS
  1. SBT ;subtotal by tribe?
  1. G:APCLSORT'="C" SBC
  1. W ! S APCLSUB="" S DIR(0)="YO",DIR("A")="Do you wish to Sub-Total by Tribe",DIR("?")="If you want sub-totals by tribe for each community enter a Y" D ^DIR K DIR
  1. G:$D(DIRUT) FY
  1. S APCLSUB=Y
  1. G ZIS
  1. SBC ;subtotal by community
  1. W ! S APCLSUB="" S DIR(0)="YO",DIR("A")="Do you wish to Sub-Total by Current Community of Residence",DIR("?")="If you want sub-totals by community for each Tribe enter a Y" D ^DIR K DIR
  1. G:$D(DIRUT) FY
  1. S APCLSUB=Y
  1. ZIS ;
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCLDEMO)
  1. I APCLDEMO=-1 G RPT
  1. W !!!,"THIS REPORT WILL SEARCH THE ENTIRE PATIENT FILE!",!!,"IT IS STRONGLY RECOMMENDED THAT YOU QUEUE THIS REPORT FOR A TIME WHEN THE",!,"SYSTEM IS NOT IN HEAVY USE!",!
  1. S XBRP="^APCLACC1",XBRC="^APCLACC2",XBRX="EOJ^APCLACC",XBNS="APCL"
  1. D ^XBDBQUE
  1. D EOJ
  1. Q
  1. ;
  1. INIT ;
  1. ACC ;
  1. I '$D(DUZ(2)) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",! S APCLQUIT="" Q
  1. I 'DUZ(2) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",! S APCLQUIT="" Q
  1. W:$D(IOF) @IOF
  1. I '$D(APCLSORT) W $C(7),$C(7),!!,"Report Type Missing!!",! S APCLQUIT="" Q
  1. W !,"This option will produce either:"
  1. W !?5,"1) A Report of Registered Patients and Active Users sorted by",!?8,$S(APCLSORT="C":"Community of Residence",APCLSORT="T":"Tribe of Membership",1:"Service Unit of Residence"),", OR"
  1. W !?5,"2) A Template of Active Users for use in QMan Searches"
  1. W !!,"Your Report or Template can be generated for one or more Facilities or for",!,"one or more Service Units."
  1. W !!,"To determine Active Users for your Report or Template, the system will select",!,"patients who have had a visit at the Facility(s) or Service Unit(s) specified",!
  1. W "within the past 3 years of the date you specify. IHS, CHS and Tribal"
  1. W !,"visits will all be included. Home, telephone, employee health, and chart review",!,"visits are excluded."
  1. W !!,"You will be asked if the patients must live in the Service Unit specified",!,"and if you only want Indian patients included."
  1. W " You must answer YES to both",!,"questions in order to conform to the official IHS definition of Active Users."
  1. ;W "The report will be sorted by ",$S(APCLSORT="C":"COMMUNITY OF RESIDENCE",APCLSORT="T":"TRIBE OF MEMBERSHIP",1:"SERVICE UNIT OF RESIDENCE"),"."
  1. Q
  1. ;
  1. EOJ ;ENTRY POINT
  1. ACCEOJ K DIC,%DT,IO("Q"),I,J,K,JK,X,Y,POP,DIRUT,ZTSK,H,M,S,TS,ZTQUEUED
  1. K APCLSVJ,APCLCOMM,APCLDIC("B"),APCLDICB,APCLJ,APCLDFN,APCLGOT1,APCLHRN,APCLTRI,APCLTRIC,APCLSU,APCL80D,APCLPG,APCLFYEY,APCLFS,APCLFYB,APCLFYE,APCLRPTT,APCLSTMP
  1. K APCLQUIT,APCLPCP,APCLCOMN,APCLGOTA,APCLSKIP,APCLV,APCLVDFN,APCL1,APCL2,APCLDTP,APCLSUP,APCLVD,APCLSUB,APCLBT,APCLJOB
  1. K APCLVAR,APCLVAR1,APCLVAR2,APCLIND,APCLT,APCLP,APCLI,APCLSUF,APCLCOMN,APCLFYBY,APCLFYB,APCLSORT,APCLFYBI,APCLFYEI,APCLSUN,APCLMAJ,APCLMIN,APCLSSUR,APCLSUR
  1. Q
  1. ;
  1. Q