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

ACDWVIS.m

Go to the documentation of this file.
  1. ACDWVIS ;IHS/ADC/EDE/KML - SET LOC VARS FROM ACDVIS GLOBAL;
  1. ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
  1. ;*******************************************************************
  1. ;//^ACDWCD1, ^ACDWCD2, ^ACDWCD3,^ACDWDRV1,^ACDWDRV2,^ACDWDRV3,^ACDWDRV4
  1. ;//^ACDWSTAF
  1. ;Needs ACDDA as internal DA to file entry
  1. ;*****************************************************************
  1. S ACDN0=^ACDVIS(ACDDA,0) S:$P(ACDN0,U,2)="" $P(ACDN0,U,2)="PHANTOM"
  1. S ACDPG=^ACDVIS(ACDDA,"BWP")
  1. I $D(^ACDF5PI(ACDPG,0)) S ACDPG=$P(^ACDF5PI(ACDPG,0),U),ACDPG=$P(^AUTTLOC(ACDPG,0),U),ACDAUF=$P(^(0),U,10),ACDPG=$P(^DIC(4,ACDPG,0),U)
  1. E S ACDPG="NOT DEFINED"
  1. S Y=$P(ACDN0,U) S ACDCLIV=$$DD^ACDFUNC(Y)
  1. S ACDCOMC=$P(ACDN0,U,2)
  1. S ACDCOMCS="???" S:ACDCOMC ACDCOMCS=$P($G(^ACDCOMP(ACDCOMC,0)),U,2)
  1. S ACDCOMCL=$P($G(^ACDCOMP(ACDCOMC,0)),U)
  1. ;S ACDP(3)=$S($D(^ACDCOMP(ACDCOMC,0)):$P(^(0),U,6),1:""),ACDP(1)=9002170.1,ACDP(2)=5 S ACDCOMCL=$$SETS^ACDFUNC(.ACDP)
  1. S ACDCOMT=$P(ACDN0,U,7)
  1. S ACDP(3)=ACDCOMT,ACDP(1)=9002172.1,ACDP(2)=5 S ACDCOMTL=$$SETS^ACDFUNC(.ACDP)
  1. ;S ACDPROV=$P(ACDN0,U,3) S:'ACDPROV ACDPROV="NONE",ACDDFNP=0 S ACDPROV=$S($D(^DIC(16,ACDPROV,0)):$P(^(0),U),1:"NONE")
  1. S ACDPROV=$P(ACDN0,U,3) S:'ACDPROV ACDPROV="NONE",ACDDFNP=0 S ACDPROV=$S($D(^VA(200,ACDPROV,0)):$P(^(0),U),1:"NONE")
  1. S ACDPROVP=$P(ACDN0,U,3)
  1. S ACDCONT=$P(ACDN0,U,4)
  1. S ACDP(3)=ACDCONT,ACDP(1)=9002172.1,ACDP(2)=3 S ACDCONTL=$$SETS^ACDFUNC(.ACDP)
  1. S (ACDDFN,ACDDFNP)=$P(ACDN0,U,5) S:'ACDDFN ACDDFN="NONE",ACDDFNP=0 S ACDDFN=$S($D(^DPT(ACDDFN,0)):$P(^(0),U),1:"NONE")
  1. S ACDFOLL=$P(ACDN0,U,6) S:$G(ACDFOLL)="" ACDFOLL="UNKNOWN"
  1. S ACDTRIB=$P(ACDN0,U,10) S:ACDTRIB="" ACDTRIB="UNKNOWN"
  1. S ACDSTATE=$P(ACDN0,U,11) S:ACDSTATE="" ACDSTATE="UNKNOWN"
  1. ;Many records at HQ/AREA could have the same DFN but they came from
  1. ;different facilities. So, use ACDAUF_ACDDFNP so reports will sort
  1. ;properly and be accurate. Only use when visit has a patient pointer.
  1. I ACDDFNP'=0 S ACDDFNP=1_ACDAUF_ACDDFNP
  1. S ACDFOLMO=$P(ACDN0,U,6)
  1. S ACDP(3)=$P(ACDN0,U,13),ACDP1(1)=9002172.1,ACDP(2)=104 S ACDVET=$$SETS^ACDFUNC(.ACDP)
  1. S ACDAGE=$P(ACDN0,U,16)
  1. S ACDP(3)=$P(ACDN0,U,8),ACDP(2)=9,ACDP(1)=9002172.1 S ACDAGER=$$SETS^ACDFUNC(.ACDP)
  1. S ACDP(3)=$P(ACDN0,U,12),ACDP(1)=9002172.1,ACDP(2)=103,ACDSEX=$$SETS^ACDFUNC(.ACDP)
  1. S:'ACDDFNP ACDDFNP=.1 ;***********************
  1. ;
  1. ;If staff report, stop after getting locals from the visit file
  1. ;
  1. I $D(ACDWSTAF(1)) Q
  1. MATCH ;EP
  1. ;//^ACDWDRV3
  1. ;***************************************************************
  1. ;This is the key to building report data or not. We go to ^ACDWASF
  1. ;and check to see if the record ASUFAC matches one of the arrays
  1. ;defined by the user's request. If so, ACDONE,ACDTWO,ACDTHREE will
  1. ;come back defined.
  1. ;If a match is found, keep counters of how many visit records matched
  1. ;for the area, su,facility,state,tribe,community, or contact type
  1. ;***************************************************************
  1. S ACDOK=0 D ^ACDWASF I $D(ACDONE),$D(ACDTWO),$D(ACDTHREE) S ACDOK=1 D ACDTRB,ACDSTA,CNT
  1. ;
  1. I $D(ACDCRST($P(ACDN0,U,4))),ACDOK S ACDCRST($P(ACDN0,U,4))=ACDCRST($P(ACDN0,U,4))+1
  1. I $D(ACDTRB(ACDTRIB)),ACDOK S ACDTRB(ACDTRIB)=ACDTRB(ACDTRIB)+1
  1. I $D(ACDSTA(ACDSTATE)),ACDOK S ACDSTA(ACDSTATE)=ACDSTA(ACDSTATE)+1
  1. I $D(ACDFAC(ACDAUF)),ACDOK S ACDFAC(ACDAUF)=ACDFAC(ACDAUF)+1 Q
  1. I $D(ACDAREA($E(ACDAUF,1,2))),ACDOK S ACDAREA($E(ACDAUF,1,2))=ACDAREA($E(ACDAUF,1,2))+1 Q
  1. I $D(ACDSU($E(ACDAUF,1,4))),ACDOK S ACDSU($E(ACDAUF,1,4))=ACDSU($E(ACDAUF,1,4))+1 Q
  1. ;
  1. ;**************************************************************
  1. ;If the user has selected to run the area, su, or facility reports
  1. ;with a further restriction by tribe, state, or community, come here
  1. ;and further validate the record meets print criteria.
  1. ;*************************************************************
  1. ;
  1. ACDTRB ;
  1. ;See if user running by tribe
  1. I '$D(ACDTRB) Q ;User not running by tribe
  1. I $D(ACDTRB("*ALL*")) Q ;User wants all tribes
  1. I '$D(ACDTRB(ACDTRIB)) S ACDOK=0 Q ;Sel tribes or category
  1. ;
  1. ACDSTA ;
  1. ;See if user running by state
  1. I '$D(ACDSTA) Q ;User not running by state
  1. I $D(ACDSTA("*ALL*")) Q ;User wants all states
  1. I '$D(ACDSTA(ACDSTATE)) S ACDOK=0 Q ;Sel states or categories
  1. ;
  1. ;
  1. ;
  1. CNT ;Check to see if user is restricting output by contact type and
  1. ;if so, check the contact type of visit and see if it matches
  1. ;one that the user requested
  1. Q:'$D(ACDWDRV(1))
  1. I $D(ACDCRST),'$D(ACDCRST($P(ACDN0,U,4))) S ACDOK=0