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

APCDCAF3.m

Go to the documentation of this file.
APCDCAF3 ; IHS/CMI/LAB - MENTAL HLTH ROUTINE 16-AUG-1994 ;
 ;;2.0;IHS PCC SUITE;**2,5,7,8,11,20**;MAY 14, 2009;Build 25
 ;; ;
 ;
DISP ;
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G DISPX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G DISPX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 ;RELINKER?
 D ^XBFMK
 S APCDCAFV=APCDVSIT,APCDCAF="IN CAF" D EP^APCDKDE D ^APCDVD S APCDVSIT=APCDCAFV
 ;K DIR S DIR(0)="Y",DIR("A")="Do you want to update the Chart Audit Status for this visit",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 ;I $D(DIRUT) G DISPX
 ;I 'Y G DISPX
 ;D UPD0
 ;
DISPX ;
 K DIR,DIRUT,DUOUT,Y,APCDVSIT,APCDCAF,APCDCAFV
 D KILL^AUPNPAT
 D BACK
 Q
 ;
BACK ;go back to listman
 D BACK^APCDCAF2
 Q
 ;
MODIFY ;
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Modify which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G MODIFYX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G MODIFYX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 S (Y,APCDPAT)=$P(^AUPNVSIT(APCDVSIT,0),U,5)
 D ^AUPNPAT
 S APCDVLK=APCDVSIT
 S APCDDATE=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 S APCDCAT=$P(^AUPNVSIT(APCDVSIT,0),U,7)
 S APCDTYPE=$P(^AUPNVSIT(APCDVSIT,0),U,3)
 S APCDLOC=$P(^AUPNVSIT(APCDVSIT,0),U,6)
 S APCDCLN=$P(^AUPNVSIT(APCDVSIT,0),U,8)
 I AUPNDOB]"",$D(APCDDATE) S X2=AUPNDOB,X1=APCDDATE D ^%DTC S AUPNDAYS=X ; re-set days of age to visit date-dob
 S APCDFLG=0 D ^APCDEIN I APCDFLG W !!,"error in data entry modify mode" D EOP G MODIFYX
 D START^APCDEWHO(APCDVSIT)
 S APCDMODE="M"
 S AUPNVSIT=APCDVSIT D MOD^AUPNVSIT
 D ^XBFMK
 S APCDCAFV=APCDVSIT,APCDCAF="IN CAF" D EP^APCDKDE D PROCESS^APCDEM S APCDVSIT=APCDCAFV
 K DIR S DIR(0)="Y",DIR("A")="Do you want to update the Chart Audit Status for this visit",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G MODIFYX
 I 'Y G MODIFYX
 D UPD0
 ;
MODIFYX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF,APCDCAFV
 D EN^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q
 ;
APPEND ;
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="APPEND to which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G APPENDX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G APPENDX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 S (Y,APCDPAT)=$P(^AUPNVSIT(APCDVSIT,0),U,5)
 D ^AUPNPAT
 S APCDVLK=APCDVSIT
 S APCDDATE=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 S APCDCAT=$P(^AUPNVSIT(APCDVSIT,0),U,7)
 S APCDTYPE=$P(^AUPNVSIT(APCDVSIT,0),U,3)
 S APCDLOC=$P(^AUPNVSIT(APCDVSIT,0),U,6)
 S APCDCLN=$P(^AUPNVSIT(APCDVSIT,0),U,8)
 I AUPNDOB]"",$D(APCDDATE) S X2=AUPNDOB,X1=APCDDATE D ^%DTC S AUPNDAYS=X ; re-set days of age to visit date-dob
 S APCDFLG=0 D ^APCDEIN I APCDFLG W !!,"error in data entry APPEND mode" D EOP G APPENDX
 D START^APCDEWHO(APCDVSIT)
 S APCDMODE="A",APCDNOXV=""
 S AUPNVSIT=APCDVSIT D MOD^AUPNVSIT
 D ^XBFMK
 S APCDCAFV=APCDVSIT,APCDCAF="IN CAF" D EP^APCDKDE D MNEPROC^APCDEAP S APCDVSIT=APCDCAFV
 K DIR S DIR(0)="Y",DIR("A")="Do you want to update the Chart Audit Status for this visit",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G APPENDX
 I 'Y G APPENDX
 D UPD0
 ;
APPENDX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF
 D EN^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q
 ;
UPDATE ;EP
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Update Chart Audit Status for which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G UPDATEX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G UPDATEX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 D MOD^AUPNVSIT
UPD0 ;EP
 K DIC,DD,D0,DO
 S X=$$NOW^XLFDT,DIC="^AUPNVCA(",DIC(0)="L",DIADD=1,DLAYGO=9000010.45
 S DIC("DR")=".02////"_$P(^AUPNVSIT(APCDVSIT,0),U,5)_";.03////"_APCDVSIT_";.05////"_DUZ_";1216////"_$$NOW^XLFDT D FILE^DICN
 I Y=-1 W !!,"updating status failed" D EOP G UPDATEX
 K DIC,DD,D0,DIADD,DLAYGO
 S (APCDVCA,DA)=+Y
UPD1 ;
 D ^XBFMK
 S DA=APCDVCA,DIE="^AUPNVCA(",DR=".04" D ^DIE K DA,DIE,DR
 D ^XBFMK
 S APCDCAR=$P(^AUPNVCA(APCDVCA,0),U,4)
 I APCDCAR="" W !!,"You must enter a status" G UPD1
 S APCDERR=$$ERRORCHK^APCDCAF(APCDVSIT)
 I APCDERR]"",APCDCAR="R" W !!,"This visit has the following error: ",APCDERR,!,"You cannot mark a visit as Reviewed/Completed if there is an error." S DA=APCDVCA,DIE="^AUPNVCA(",DR=".04///I" D ^DIE G UPD1
 S DIE="^AUPNVSIT(",DA=APCDVSIT,DR=".13////"_DT_";1111////"_APCDCAR D ^DIE K DIE,DA,DR
 I APCDCAR="R" D RNU^APCDCAF4 G UPDATEX
R ;
 D EN^APCDCAF6(APCDVSIT)
 I '$$FINDPEND^APCDCAF6(APCDVSIT),$$VALI^XBDIQ1(9000010,APCDVSIT,1111)'="R",$P(^APCDSITE(DUZ(2),0),U,32) W !!,"A chart Deficiency reason is required." H 3 G R
 ;PUT CHART AUDIT NOTE HERE
 ;K DIR S DIR(0)="Y",DIR("A")="Do you want to update the Chart Audit Notes for this visit",DIR("B")="N" KILL DA D ^DIR KILL DIR
 ;I $D(DIRUT) G UPDATEX
 ;I 'Y G UPDATEX
 ;I '$D(^AUPNCANT(APCDVSIT)) D ADDCANT
 ;I '$D(^AUPNCANT(APCDVSIT)) W !!,"adding entry to chart audit notes failed." H 3 G UPDATEX
 ;S DA=APCDVSIT,DIE="^AUPNCANT(",DR=1100 D ^DIE K DIE,DA,DR
 ;
 ;
UPDATEX ;
 K DIADD,DLAYGO
 D ^XBFMK
 K APCDCAR,APCDCVA,APCDVSIT
 D BACK
 Q
 ;
ADDCANT ;
 S ^AUPNCANT(APCDVSIT,0)=APCDVSIT_U_$P(^AUPNVSIT(APCDVSIT,0),U,5)
 S DA=APCDVSIT,DIK="^AUPNCANT(" D IX1^DIK
 Q
EOP ;EP - End of page.
 Q:$E(IOST)'="C"
 ;Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
 NEW DIR
 K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
 S DIR("A")="Press Enter to Continue",DIR(0)="E" D ^DIR
 Q
 ;----------
MERGE ;EP
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G MERGEX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G MERGEX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 S APCDVLDT=$P($P(^AUPNVSIT(APCDVSIT,0),U),"."),APCDPAT=$P(^AUPNVSIT(APCDVSIT,0),U,5)
 S (X,APCDIDT)=(9999999-APCDVLDT),C=0 F  S X=$O(^AUPNVSIT("AA",APCDPAT,X)) Q:X=""!($P(X,".")>APCDIDT)  D
 .S V=0 F  S V=$O(^AUPNVSIT("AA",APCDPAT,X,V)) Q:V'=+V  S C=C+1
 I C<2 W !!,"Patient only has 1 visit on that day, cannot do a merge." D EOP G MERGEX
 S Y=APCDPAT D ^AUPNPAT
 W !!,"Select 'From' visit.",!
 S APCDVV="APCDVMF" D GETVISIT
 I 'APCDVMF G MERGEX
 S APCDVLDT=+^AUPNVSIT(APCDVMF,0)\1
 W !!,"Select 'To' visit.",!
 S APCDVV="APCDVMT" D GETVISIT
 I 'APCDVMT G MERGEX
 I APCDVMF=APCDVMT W !!,"'From' and 'To' the same.  Bye!" D EOP G MERGEX Q
 I $D(^ABSBITMS(9002302,"AD",APCDVMF)) W !!,"Cannot merge from a visit that has a Claim associate with it." G MERGEX  ;IHS/CMI/LAB - patch 3 per FSI
 W !!,"*** FROM VISIT ***"
 K DR S APCDVDSP=APCDVMF D ^APCDVDSP
 W !!,"*** TO VISIT ***"
 K DR S APCDVDSP=APCDVMT D ^APCDVDSP
 S APCDCAF="IN CAF" D EN1^APCDVMRG
 ;
MERGEX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF,APCDPAT,APCDVMT,APCDVMF
 D EN1^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q
 ;
GETVISIT ;
 K APCDVLK
 S APCDLOOK=""
 D ^APCDVLK
 S @APCDVV=APCDLOOK
 K APCDLOOK
 Q
 ;
DEL ;EP
 I '$D(^XUSEC("APCDZDELETEVISIT",DUZ)) W !!,"You do not have the security key to delete a Visit.",!,"Please see your supervisor or program manager.",! G DELX
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G DELX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G DELX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 D ^XBFMK
 ;DSPLY ;
 S APCDVDSP=APCDVSIT D ^APCDVDSP
 I '$$ALLRET^APCDCAF1(APCDVSIT) W !!,"All Notes must be retracted before you can delete this visit." D EOP G DELX
 W !!,"THE ABOVE VISIT AND RELATED V FILE ENTRIES WILL BE REMOVED FOREVER !!!"
DELETE ; DELETE VISIT AND RELATED V FILES
 W !,"Sure you want to delete" S %=2 D YN^DICN S %Y=$E(%Y)
 Q:%Y="^"
 I "Nn"[%Y G DELX
 S DIE="^AUPNVSIT(",DA=APCDVSIT,DR=2201 D ^DIE K DA,DIE,DR
 I $P($G(^AUPNVSIT(APCDVSIT,22)),U)="" S DA=APCDVSIT,DIE="^AUPNVSIT(",DR="2201///NO RESPONSE FROM OPERATOR" D ^DIE K DA,DIE,DR
 ;UPDATE DELETE LOG
 D UPDLOG^APCDVDEL(APCDVSIT)
 S APCDVDLT=APCDVSIT D ^APCDVDLT
DELX ;
 K DIR,DIRUT,DUOUT,Y,APCDVSIT,APCDCAF,APCDCAFV,APCDVDLT
 D KILL^AUPNPAT
 D BACK
 Q
 ;
MERGEDD ;EP
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G MERGEDDX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G MERGEDDX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 ;S APCDVLDT=$P($P(^AUPNVSIT(APCDVSIT,0),U),".")
 S APCDPAT=$P(^AUPNVSIT(APCDVSIT,0),U,5)
 S Y=APCDPAT D ^AUPNPAT
 W !!,"Select 'From' visit.",!
 S APCDVV="APCDVMF" D GETVISIT
 I 'APCDVMF G MERGEDDX
 ;S APCDVLDT=+^AUPNVSIT(APCDVMF,0)\1
 W !!,"Select 'To' visit.",!
 S APCDVV="APCDVMT" D GETVISIT
 I 'APCDVMT G MERGEDDX
 I APCDVMF=APCDVMT W !!,"'From' and 'To' the same.  Bye!" D EOP G MERGEDDX Q
 I $D(^ABSBITMS(9002302,"AD",APCDVMF)) W !!,"Cannot merge from a visit that has a Claim associate with it." G MERGEX  ;IHS/CMI/LAB - patch 3 per FSI
 W !!,"*** FROM VISIT ***"
 K DR S APCDVDSP=APCDVMF D ^APCDVDSP
 W !!,"*** TO VISIT ***"
 K DR S APCDVDSP=APCDVMT D ^APCDVDSP
 S APCDCAF="IN CAF" D EN1^APCDVMRG
 ;
MERGEDDX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF,APCDPAT,APCDVMT,APCDVMF
 D EN1^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q
 ;
MOVEVD ;EP
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Which Visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G MOVEVDX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G MOVEVDX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 S APCDVLDT=$P($P(^AUPNVSIT(APCDVSIT,0),U),"."),APCDPAT=$P(^AUPNVSIT(APCDVSIT,0),U,5)
 S (X,APCDIDT)=(9999999-APCDVLDT),C=0 F  S X=$O(^AUPNVSIT("AA",APCDPAT,X)) Q:X=""!($P(X,".")>APCDIDT)  D
 .S V=0 F  S V=$O(^AUPNVSIT("AA",APCDPAT,X,V)) Q:V'=+V  S C=C+1
 I C<2 W !!,"Patient only has 1 visit on that day, cannot move data." D EOP G MOVEVDX
 S Y=APCDPAT D ^AUPNPAT
 W !!,"Select 'From' visit.",!
 S APCDVV="APCDVMF" D GETVISIT
 I 'APCDVMF G MOVEVDX
 S APCDVLDT=+^AUPNVSIT(APCDVMF,0)\1
 W !!,"Select 'To' visit.",!
 S APCDVV="APCDVMT" D GETVISIT
 I 'APCDVMT G MOVEVDX
 I APCDVMF=APCDVMT W !!,"'From' and 'To' the same.  Bye!" D EOP G MOVEVDX Q
 D EP1^APCDKUL
MOVEVDX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF,APCDPAT,APCDVMT,APCDVMF
 D EN1^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q
RESEQ ;EP
 D FULL^VALM1
 K DIR
 S DIR(0)="NO^1:"_APCDRCNT,DIR("A")="Resequence POVs for which visit"
 D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I Y="" W !,"No VISIT selected." D EOP G RESEQX
 I $D(DIRUT) W !,"No VISIT selected." D EOP G RESEQX
 S APCDVSIT=^TMP("APCDCAF OP",$J,"IDX",Y,Y)
 D EN^APCDRPOV(APCDVSIT)
 D ^XBFMK
 K DIR S DIR(0)="Y",DIR("A")="Do you want to update the Chart Audit Status for this visit",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G RESEQX
 I 'Y G RESEQX
 D UPD0
 ;
RESEQX ;
 K APCDVSIT,APCDPAT,X,Y,AUPNVSIT,AUPNDAYS,APCDCAF
 D EN^APCDEKL
 D EN2^APCDEKL
 D KILL^AUPNPAT
 D BACK
 Q