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

APCDVMRG.m

Go to the documentation of this file.
APCDVMRG ; IHS/CMI/LAB - VISIT MERGE ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;merge 2 visits during data entry process.
 D GETPAT
 I 'APCDPAT D EOJ Q
 W !!,"Select 'From' visit.",!
 S APCDVV="APCDVMF" D GETVISIT
 I 'APCDVMF D EOJ Q
 S APCDVLDT=+^AUPNVSIT(APCDVMF,0)\1
 W !!,"Select 'To' visit.",!
 S APCDVV="APCDVMT" D GETVISIT
 I 'APCDVMT D EOJ Q
 I APCDVMF=APCDVMT W !!,"'From' and 'To' the same.  Bye!" D EOJ Q
 I $D(^ABSBITMS(9002302,"AD",APCDVMF)) W !!,"Cannot merge from a visit that has a Claim associate with it." D EOJ Q  ;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
EN1 ;EP
RDR ;EP
 I 'APCDVMT W !!,$C(7),$C(7),"'TO' VISIT NOT DEFINED" D EOJ Q
 I 'APCDVMF W !!,$C(7),$C(7),"'FROM' VISIT NOT DEFINED" D EOJ Q
 R !!,"Do you want to merge the two visits? (Y/N) Y//",APCDVMX:$S($D(DTIME):DTIME,1:300) S:'$T APCDVMX="N" S:APCDVMX="" APCDVMX="Y" S APCDVMX=$E(APCDVMX) I "YyNn"'[APCDVMX W $C(7) G RDR
 I "Nn"[APCDVMX D EOJ Q
 D ^APCDVM2
 I $D(APCDVMQF) W !!,"*** ERROR encountered.  QFLG=",APCDVMQF D EOJ Q
 S $P(^AUPNVSIT(APCDVMF,0),U,37)=APCDVMT ;direct set as visit is being deleted.  set for billing
 S $P(^AUPNVSIT(APCDVMF,22),U)="MERGED TO VISIT IEN "_APCDVMT  ;direct set as visit is being deleted
 D UPDLOG^APCDVDEL(APCDVMF,APCDVMT)
 S AUPNVSIT=APCDVMF D DEL^AUPNVSIT
 W !!,"*** MERGED VISIT ***"
 D ZTSK
 K DR S APCDVDSP=APCDVMT D ^APCDVDSP
 S APCDVSIT=APCDVMT D ^APCDVCHK K APCDVSIT
 D EOJ
 Q
 ;
GETPAT ; GET PATIENT
 W !
 S APCDPAT=""
 S DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
 Q:Y<0
 S APCDPAT=+Y
 Q
 ;
GETVISIT ;
 K APCDVLK
 S APCDLOOK=""
 D ^APCDVLK
 S @APCDVV=APCDLOOK
 K APCDLOOK
 Q
 ;
ZTSK ;
 S X="APCDVM3" X ^%ZOSF("TEST") Q:'$T
 K ZTSAVE F %="APCDVMF","APCDVMT" S ZTSAVE(%)=""
 S ZTRTN="^APCDVM3",ZTDESC="PACKAGE VISIT MERGE",ZTIO="",ZTDTH=DT D ^%ZTLOAD
 K ZTSK
 Q
 ;
 ;
EOJ ; EOJ CLEAN UP
 K APCDCAT,APCDCLN,APCDDATE,APCDDOB,APCDDOD,APCDLOC,APCDPAT,APCDSEX,APCDTYPE,APCDVSIT,APCDVMF,APCDVMT,APCDVMX,APCDVV
 K AUPNPAT,AUPNSEX,AUPNDAYS,AUPNDOB,AUPNVSIT,AUPNDOD
 Q