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

BPMXTAX.m

Go to the documentation of this file.
BPMXTAX ;IHS/PHXAO/AEF - REPOINT PT TAXONOMY FILE POINTERS - 6/26/12 ;
 ;;1.0;IHS PATIENT MERGE;**2**;MAR 01, 2010;Build 1
 ;IHS/OIT/LJF 10/26/2006 routine originated from Phoenix Area Office
 ;                       changed namespace from BZXM to BPM
 ;
DESC ;----- ROUTINE DESCRIPTION
 ;;
 ;;BPMXTAX:
 ;;THIS ROUTINE LOOPS THROUGH EACH ENTRY IN THE PATIENT SUBFILE
 ;;OF THE PT TAXONOMY FILE AND REPOINTS THE NAME FIELD TO THE
 ;;SPECIFIED VA PATIENT FILE ENTRY.
 ;;
 ;;THIS ROUTINE IS CALLED BY THE SPECIAL MERGE ROUTINE DRIVER - ^BPMXDRV
 ;;
 ;;THE IHS PATIENT MERGE SOFTWARE ENTERS AT EN LINE LABEL. IT IS EXPECTED
 ;;THAT THE FOLLOWING GLOBAL WOULD HAVE BEEN SET U PBY THE PATIENT MERGE
 ;;SOFTWARE:
 ;;  ^TMP("XDRFROM",$J,FROMIEN,TOIEN,FROMIEN_GLOBROOT,TOIEN_GLOBROOT)=FILE
 ;;EXAMPLE:
 ;;  ^TMP("XDRFROM",2804,6364,1991,"6364;DPT(","1991;DPT(")=2
 ;;
 ;;$$END
 ;
 N I,X F I=1:1 S X=$P($T(DESC+I),";;",2) Q:X["$$END"  W !,X
 Q
EN(BPMRY) ;EP
 ;----- MAIN ENTRY POINT FROM DUPLICATE PATIENT MERGE SOFTWARE
 ;
 ;      BPMRY = TEMP GLOBAL SET UP BY THE PATIENT MERGE SOFTWARE,
 ;               I.E., "^TMP(""XDFROM"",$J)"
 ;
 N BPMFR,BPMTO
 ;
 S BPMFR=$O(@BPMRY@(0))
 Q:'BPMFR
 S BPMTO=$O(@BPMRY@(BPMFR,0))
 Q:'BPMTO
 ;
 D REPOINT(BPMFR,BPMTO)
 Q
REPOINT(BPMFR,BPMTO) ;EP
 ;----- FIND AND REPOINT POINTERS
 ;
 N BPMD0,BPMD1
 ;
 S BPMD0=0
 F  S BPMD0=$O(^ATXPAT(BPMD0)) Q:'BPMD0  D
 . S BPMD1=0
 . F  S BPMD1=$O(^ATXPAT(BPMD0,11,BPMD1)) Q:'BPMD1  D
 . . Q:$P($G(^ATXPAT(BPMD0,11,BPMD1,0)),U)'=BPMFR
 . . D ONE(BPMD0,BPMD1,BPMFR,BPMTO)
 ;
 Q
ONE(BPMD0,BPMD1,BPMFR,BPMTO) ;
 ;----- PROCESS ONE ENTRY
 ;
 N BPMCNT,DA,DD,DIC,DIE,DIK,DINUM,DO,DR,X,Y,BPM02P2
 ;
 S BPMCNT=$P($G(^ATXPAT(BPMD0,11,BPMFR,0)),U,2)+$P($G(^ATXPAT(BPMD0,11,BPMTO,0)),U,2)
 ;
 S DA(1)=BPMD0
 S DA=BPMD1
 S DIK="^ATXPAT("_DA(1)_",11,"
 D ^DIK
 ;
 I '$D(^ATXPAT(BPMD0,11,BPMTO)) D
 . S DIC="^ATXPAT("_DA(1)_",11,"
 . S DIC(0)=""
 . S X=BPMTO
 . S DINUM=X
 . K DD,DO
 . D FILE^DICN
 ;
 Q:'$D(^ATXPAT(BPMD0,11,BPMTO))
 ;
 S BPM02P2=$P($G(^DD(9002227.01101,.02,0)),U,2)
 S $P(^DD(9002227.01101,.02,0),U,2)=$TR(BPM02P2,"I","")
 ;
 S DA=BPMTO
 S DIE="^ATXPAT("_DA(1)_",11,"
 S DR=".02///"_BPMCNT
 D ^DIE
 ;
 S $P(^DD(9002227.01101,.02,0),U,2)=BPM02P2
 ;
 Q