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

ACHSMERG.m

Go to the documentation of this file.
  1. ACHSMERG ; IHS/ITSC/TPF/PMF - CHS PATIENT MERGE INTERFACE ;
  1. ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**20**;JUN 11, 2001
  1. ;
  1. ; This entire routine is in support
  1. ; of the patient merge development and testing.
  1. ;
  1. ; XDRMRG("FR") contains DFN of FROM pt (one being merged away)
  1. ; XDRMRG("TO") contains DFN of TO pt (the one being kept)
  1. ;
  1. ;ACHS*3.1*20 IHS.OIT.FCJ 7-28-11 ADDED NXT LINE FOR CALL FROM MERGE ROUTINES
  1. EN(XDRMRG) ;EP
  1. ;
  1. Q:'$D(XDRMRG("FR"))
  1. Q:'$D(XDRMRG("TO"))
  1. ;
  1. ; S XDRMRG("FR")=1062,XDRMRG("TO")=1064 ; *** FOR TESTING, ONLY
  1. ; S XDRMRG("FR")=1064,XDRMRG("TO")=1062 ; *** FOR TESTING, ONLY
  1. ;
  1. N L,D,T
  1. ;
  1. ; L = Location
  1. ; D = Document IEN
  1. ; T = Transaction IEN
  1. ;
  1. ; ^ACHSF(DA(1),"PB",+X,DA,1)
  1. ; ^ACHSF("AC",$E(X,1,30),DA(2),DA(1),DA)
  1. ; ^ACHSF(DA(2),"EOBP",+X,DA(1),DA,9999999-%)
  1. ; The "PB" x-ref is more reliable. The "AC" is only set at
  1. ; final pay.
  1. ; One entire document is merged, at once, rather than use the "PB"
  1. ; for the Document record, then the "AC" for the transaction
  1. ; records, to minimize the possibility of errors.
  1. ;
  1. S L=0
  1. ;
  1. F S L=$O(^ACHSF(L)) Q:'L S D=0 F S D=$O(^ACHSF(L,"PB",XDRMRG("FR"),D)) Q:'D D
  1. .K ^ACHSF(L,"PB",XDRMRG("FR"),D)
  1. .Q:'$D(^ACHSF(L,"D",D,0))
  1. .S $P(^ACHSF(L,"D",D,0),U,22)=XDRMRG("TO")
  1. .S ^ACHSF(L,"PB",XDRMRG("TO"),D,1)=""
  1. .S T=0
  1. .F S T=$O(^ACHSF(L,"D",D,"T",T)) Q:'T D
  1. ..K ^ACHSF("AC",XDRMRG("FR"),L,D,T)
  1. ..K ^ACHSF(L,"EOBP",XDRMRG("FR"),D,T)
  1. ..S $P(^ACHSF(L,"D",D,"T",T,0),U,3)=XDRMRG("TO")
  1. ..S ^ACHSF("AC",XDRMRG("TO"),L,D,T)=""
  1. ..S %=$P(^ACHSF(L,"D",D,"T",T,0),U,13)
  1. ..I % S ^ACHSF(L,"EOBP",XDRMRG("TO"),D,T,9999999-%)=""
  1. ..Q
  1. .Q
  1. ;
  1. ;
  1. ;
  1. ; L = Patient Name
  1. ; D = Denial IEN
  1. ;
  1. ; ^ACHSDEN("C",$P(^DPT(X,0),U,1),DA)
  1. ;
  1. S L=$P(^DPT(XDRMRG("FR"),0),U),D=0
  1. ;
  1. F S D=$O(^ACHSDEN("C",L,D)) Q:'D I $P(^ACHSDEN(D,0),U,4)="Y" D
  1. .K ^ACHSDEN("C",L,D)
  1. .S $P(^ACHSDEN(D,0),U,5)=XDRMRG("TO")
  1. .S ^ACHSDEN("C",$P(^DPT(XDRMRG("TO"),0),U),D)=""
  1. .Q
  1. ;
  1. Q
  1. ;
  1. ;
  1. FR ;EP - From PACKAGE file, to determine if FR pt has data for pt merge.
  1. Q:'$D(XDRMRG("FR"))
  1. N L
  1. ;
  1. ; L = Location or Pt Name
  1. ;
  1. S L=0
  1. ;
  1. F S L=$O(^ACHSF(L)) Q:'L I $O(^ACHSF(L,"PB",XDRMRG("FR"),0)) S XDRZ=1 Q
  1. ;
  1. S L=$P(^DPT(XDRMRG("FR"),0),U),D=0
  1. ;
  1. F S D=$O(^ACHSDEN("C",L,D)) Q:'D I $P(^ACHSDEN(D,0),U,4)="Y" S XDRZ=1 Q
  1. ;
  1. Q
  1. ;