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

APCDKDE1.m

Go to the documentation of this file.
APCDKDE1 ; IHS/CMI/LAB - cont. of APCDKDE data entry visit re-linker ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
NONXCHK ;EP - called from APCDKDE to review A visits
 ;go through all V file entries on other visit
 S APCDKV=APCDKXVS D PROCVF
 S APCDKV=APCDVSIT D PROCVF
 K APCDKV,APCDKOSP,APCDKOPP,APCDK12N,APCDK("C"),APCDKVFL,APCDKIGR,APCDKVDG,APCDVDFN,APCDK("SCORE")
 Q
PROCVF ;process v files
 I APCDVSIT'=APCDKV NEW X,P,S S (S,X)=0,APCDKOSP="" F  S X=$O(^AUPNVPRV("AD",APCDKV,X)) Q:X'=+X  S:$P(^AUPNVPRV(X,0),U,4)="P" APCDKOPP=+^(0) I $P(^(0),U,4)="S"!($P(^(0),U,4)="") S S=S+1,$P(APCDKOSP,U,S)=+^(0)
 S APCDKVFL=9000010 F  S APCDKVFL=$O(^DIC(APCDKVFL)) Q:APCDKVFL>9000010.99!(APCDKVFL'=+APCDKVFL)  D VENTRIES
 Q
 ;
VENTRIES ;
 S APCDKVDG=^DIC(APCDKVFL,0,"GL"),APCDKIGR=APCDKVDG_"""AD"",APCDKV,APCDVDFN)"
 S APCDVDFN="" F APCDVI=1:1 S APCDVDFN=$O(@APCDKIGR) Q:APCDVDFN=""  D SCORE
 Q
 ;
SCORE ;
 Q:$D(APCDK("C",APCDKVFL,APCDVDFN))  ;quit if already reviewe
 S APCDK("C",APCDKVFL,APCDVDFN)=""
 S APCDK12N=APCDKVDG_APCDVDFN_",12)"
 Q:'$D(@(APCDK12N))
 S APCDK12N=@(APCDK12N)
 Q:APCDK12N=""
 S APCDK("SCORE CLIN")=$P(^AUPNVSIT(APCDKXVS,0),U,8),APCDK("SCORE")="APCDKOVS",@APCDK("SCORE")=0,APCDK("SCORE PP")=APCDKOPP,APCDK("SCORE SP")=APCDKOSP D SCORE1
 S APCDK("SCORE CLIN")=$P(APCDKDVR,U,8),APCDK("SCORE")="APCDKDVS",@APCDK("SCORE")=0,APCDK("SCORE PP")=APCDKDPP,APCDK("SCORE SP")=APCDKDSP D SCORE1
 I APCDKV=APCDVSIT,APCDKOVS>APCDKDVS S APCDK("REPOINT V")=APCDKXVS D RELINK Q
 I APCDKV=APCDKXVS,APCDKDVS>APCDKOVS S APCDK("REPOINT V")=APCDVSIT D RELINK Q
 Q
SCORE1 ;
CLINIC ;check clinic
 ;if both v record clinic and visit record clinic are not null, and they match, re-link v record and quit
 I $P(APCDK12N,U,3)]"",APCDK("SCORE CLIN")]"",$P(APCDK12N,U,3)=APCDK("SCORE CLIN") S @APCDK("SCORE")=@APCDK("SCORE")+1
ENCPROV ;
 ;if both v record encounter provider and any provider in V Provider for this visit match, re-link and quit (both must have a value)
 G:$P(APCDK12N,U,4)="" ORDPROV
 I $G(APCDK("SCORE PP"))=$P(APCDK12N,U,4) S @APCDK("SCORE")=@APCDK("SCORE")+1
 S X=0 F I=1:1 S X=$P(APCDK("SCORE SP"),U,I) Q:X=""  I $P(APCDK12N,U,4)=X S @APCDK("SCORE")=@APCDK("SCORE")+1
ORDPROV ;
 G:$P(APCDK12N,U,2)="" SCOREXIT
 I $G(APCDK("SCORE PP"))=$P(APCDK12N,U,2) S @APCDK("SCORE")=@APCDK("SCORE")+1
 S X=0 F I=1:1 S X=$P(APCDK("SCORE SP"),U,I) Q:X=""  I $P(APCDK12N,U,2)=X S @APCDK("SCORE")=@APCDK("SCORE")+1
SCOREXIT ;
 Q
 K DIE,DR,DA,DIU,DIV S DITC="",DA=APCDVDFN,DIE=APCDKVDG,DR=".03////"_APCDVSIT D ^DIE K DIE,DA,DR,DIU,DIV,DITC
 Q
SCOREV ;check visit to see if should be deleted
 Q