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