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

APCDDVD.m

Go to the documentation of this file.
  1. APCDDVD ; IHS/CMI/LAB - VISIT REVIEW DRIVER ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;;BJPC v1 patch 1
  1. ZERO ;EP; for zero dependent entry report
  1. S APCDT="ZERO" G RDPV
  1. PPPV ;EP; for no primary provider/pov report
  1. S APCDT="PPPV" G RDPV
  1. MRG ;EP; for Merge Report
  1. S APCDT="MRG" G RDPV
  1. TXER ;EP; for Transaction error Report
  1. S APCDT="TXER" G RDPV
  1. INPT ;EP; for Inpatient review
  1. S APCDT="INPT" G RDPV
  1. ALL ;EP;to run all Visit Error Reports
  1. S APCDT="ALL" G RDPV
  1. RDPV ; Determine to run by Posting date or Visit date
  1. S APCDBEEP=$C(7)_$C(7),APCDSITE="" S:$D(DUZ(2)) APCDSITE=DUZ(2)
  1. I '$D(DUZ(2)) S APCDSITE=+^AUTTSITE(1,0)
  1. S DIR(0)="S^1:Posting Date;2:Visit Date",DIR("A")="Run Report by",DIR("B")="P" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G XIT
  1. S Y=$E(Y),APCDPROC=$S(Y=1:"P",Y=2:"V",1:Y)
  1. GETDATES ;
  1. BD ;get beginning date
  1. W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning "_$S(APCDPROC="P":"Posting",APCDPROC="V":"Visit",1:"Posting")_" Date for Search" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G XIT
  1. S APCDBD=Y
  1. ED ;get ending date
  1. W ! S DIR(0)="D^"_APCDBD_":DT:EP",DIR("A")="Enter ending "_$S(APCDPROC="P":"Posting",APCDPROC="V":"Visit",1:"Posting")_" Date for Search" S Y=APCDBD D DD^%DT S DIR("B")=Y,Y="" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G BD
  1. S APCDED=Y
  1. S X1=APCDBD,X2=-1 D C^%DTC S APCDSD=X
  1. ;
  1. LOC ;
  1. S APCDLOCT=""
  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")="Enter a code indicating what LOCATIONS/FACILITIES are of interest",DIR("B")="O" K DA D ^DIR K DIR,DA
  1. G:$D(DIRUT) GETDATES
  1. S APCDLOCT=Y
  1. I APCDLOCT="A" G CHS
  1. D @APCDLOCT
  1. G:$D(APCDQUIT) LOC
  1. CHS ;exclude CHS or not?
  1. S APCDECHS=""
  1. W !! S DIR(0)="YO",DIR("A")="Do you want to Exclude CHS (Contract Health visits) from this report",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G LOC
  1. S APCDECHS=Y
  1. ;
  1. CLN ;
  1. S APCDCLNL=""
  1. S DIR(0)="S^A:ALL Clinics (including null/blank clinic);O:One Clinic",DIR("A")="List Visits to",DIR("B")="A" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G CHS
  1. I Y="A" G ALLV
  1. ;which clinic
  1. K DIC S DIC=40.7,DIC(0)="AEMQ" D ^DIC
  1. I Y=-1 G CLN
  1. S APCDCLNL=+Y
  1. ALLV ;
  1. S DIR(0)="S^1:ALL Visits in Date Range Specified;2:Only those Visits flagged to be Transmitted to DPSB",DIR("A")="Review which set of visits",DIR("B")="1" D ^DIR K DIR
  1. I $D(DIRUT) G BD
  1. S APCDVSET=+Y
  1. SORT ;
  1. S APCDSORT=""
  1. K DIR S DIR(0)="S^H:Health Record Number;C:Clinic",DIR("A")="Sort the report by",DIR("B")="H" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G ALLV
  1. S APCDSORT=Y
  1. I APCDSORT="C" S APCDCSRT="T" G PPT
  1. W !!,"This report will be sorted by Patient Health Record Number."
  1. S APCDCSRT=""
  1. S DIR(0)="S^T:Terminal Digit Order;H:Health Record Number Order",DIR("A")="Sort the report by",DIR("B")="T" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G SORT
  1. S APCDCSRT=Y
  1. PPT ;
  1. I APCDT'="PPPV" S APCDRTYP="" G DEMO
  1. W !!,"You have chosen to run the report of visits with No Primary Provider or Purpose",!,"of visit. You can list only those visits with certain ancillary visits",!,"attached to them.",!
  1. S APCDRTYP=""
  1. S DIR(0)="S^R:Radiology (visits with V Radiology and no PP/PV);L:Lab (visits w/V LAB and no PP/PV);P:Pharmacy (visits w/V Medication and no PP/PV)"
  1. S DIR(0)=DIR(0)_";I:Immunization (visits w/V Immunization and no PP/PV);A:ALL visits with no PP/PV",DIR("A")="Which Incomplete Visits do you wish to list",DIR("B")="A" KILL DA D ^DIR KILL DIR
  1. G:$D(DIRUT) SORT
  1. S APCDRTYP=Y
  1. DOPRV ;
  1. S APCDDOPP=""
  1. W !!,"Do you wish to display the different ordering providers from the",!,"ancillary items (labs, meds, immunizations) with the visit.",!,"Displaying these will make the report longer in length but"
  1. W !,"may assist you in visit merging or completion.",!
  1. S DIR(0)="Y",DIR("A")="Do you want to display the ORDERING PROVIDERS from the data items",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G PPT
  1. S APCDDOPP=Y
  1. DLPOV ;
  1. S APCDDLPV=""
  1. I APCDRTYP'="L",APCDRTYP'="A" G DEMO
  1. W !!,"Your lab personnel may be entering a diagnosis with the lab tests.",!,"You can display these diagnoses on this report. Displaying"
  1. W !,"these may make the report a little longer but could assist you",!,"with billing and/or visit clean up.",!
  1. S DIR(0)="Y",DIR("A")="Do you want to display the LAB diagnoses",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G DOPRV
  1. S APCDDLPV=Y
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCDDEMO)
  1. I APCDDEMO=-1 G SORT
  1. ZIS ;call xbdbque
  1. S XBRC="DRIVER^APCDDVD",XBRP="PRINT^APCDDVD",XBRX="XIT^APCDDVD",XBNS="APCD"
  1. D ^XBDBQUE
  1. D XIT
  1. Q
  1. DRIVER ;EP entry point for taskman
  1. S APCDBT=$H,APCDJOB=$J
  1. K ^XTMP("APCDDV",APCDJOB,APCDBT)
  1. D ^APCDDVD1
  1. S APCDET=$H
  1. Q
  1. PRINT ;EP
  1. D ^APCDDVW
  1. K ^XTMP("APCDDV",APCDJOB,APCDBT)
  1. Q
  1. XIT ;EP
  1. K APCDBEEP,APCDX,APCDBD,APCDT,APCDED,APCDSD,APCDODAT,APCDVSIT,%,APCDL,X,X1,X2,IO("Q"),APCDDT,APCDSITE,APCDLC,APCDPAGE,APCDCAT,APCDTYPE,APCPTX,APCDADM,APCDPS,APCDPVP,APCDFILE,APCDEC,APCDBT,APCDET,APCDQIO,APCDJOB,APCDPROC,APCD
  1. K APCDDV("VREC"),APCDVSET,APCDBDFN,APCDDEMM,APCDDEM,APCDCLN,APCDCL,APCDH,APCDCLOC,APCDCSRT,APCDDCHS,APCDHRN,APCDLOC,APCDLOCT,APCDQUIT
  1. D EN2^APCDEKL
  1. K X,X1,X2,IO("Q"),%DT,%ZIS,%,DUOUT,DLOUT,Y
  1. Q
  1. ERR W APCDBEEP,!,"Must be a valid date and be Today or earlier. Time not allowed!" Q
  1. O ;one community
  1. S DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("A")="Which LOCATION: " D ^DIC K DIC
  1. I Y=-1 S APCDQUIT="" Q
  1. S APCDLOCT("ONE")=+Y
  1. Q
  1. S ;all communities within APCDSU su
  1. S DIC="^AUTTSU(",DIC("B")=$$VAL^XBDIQ1(9999999.06,DUZ(2),.05),DIC(0)="AEMQ",DIC("A")="Which SERVICE UNIT: " D ^DIC K DIC
  1. I Y=-1 S APCDQUIT="" Q
  1. S APCDLOCT("SU")=+Y
  1. Q
  1. ;