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

BDWAID.m

Go to the documentation of this file.
  1. BDWAID ; IHS/CMI/LAB - UNIQUE REGISTRATION RECORD ID ;
  1. ;;1.0;IHS DATA WAREHOUSE;**3**;JAN 23, 2006
  1. ;
  1. UID(BDWA) ;PEP-Given DFN return unique patient record id.
  1. ; BDWA can be DFN, but is not required if DFN or DA exists.
  1. ;
  1. ; pt record id = 6DIGIT_PADDFN
  1. ; where 6DIGIT is the ASUFAC at the time of implementation of
  1. ; this functionality. I.e., the existing ASUFAC was frozen and
  1. ; stuffed into the .25 field of the RPMS SITE file.
  1. ; PADDFN = DFN right justified in a field of 10.
  1. ;
  1. ; If not there, stuff the ASUFAC into RPMS SITE for durability.
  1. ;I '$P($G(^AUTTSITE(1,1)),U,3) S $P(^AUTTSITE(1,1),U,3)=$P(^AUTTLOC($P(^AUTTSITE(1,0),U,1),0),U,10)
  1. ;
  1. ; If BDWA is not specified, try DFN, then DA if DIC=AUPNPAT.
  1. I '$G(BDWA),$G(DFN) S BDWA=DFN
  1. I '$G(BDWA),$G(DA),$G(DIC)="^AUPNPAT(" S BDWA=DA
  1. ;
  1. I '$G(BDWA) Q "DFN undefined."
  1. I '$D(^AUPNPAT(BDWA)) Q "No entry in AUPNPAT(."
  1. ;
  1. Q $$GET1^DIQ(9999999.06,$P(^AUTTSITE(1,0),U),.32)_$E("0000000000",1,10-$L(BDWA))_BDWA
  1. ;
  1. UIDV(VISIT) ;EP - generate unique ID for visit
  1. I '$G(VISIT) Q VISIT
  1. NEW X
  1. ;I '$P($G(^AUTTSITE(1,1)),"^",3) S $P(^AUTTSITE(1,1),"^",3)=$P(^AUTTLOC($P(^AUTTSITE(1,0),"^",1),0),"^",10)
  1. S X=$$GET1^DIQ(9999999.06,$P(^AUTTSITE(1,0),U),.32)
  1. Q X_$$LZERO(VISIT,10)
  1. ;
  1. ICN(BDWA) ;-- return the ICN number and concat in PID-3
  1. I '$G(BDWA),$G(DFN) S BDWA=DFN
  1. Q $$GET1^DIQ(2,BDWA,991.01)
  1. ;
  1. LZERO(V,L) ;EP - left zero fill
  1. NEW %,I
  1. S %=$L(V),Z=L-% F I=1:1:Z S V="0"_V
  1. Q V