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

BPMXLR.m

Go to the documentation of this file.
BPMXLR ;IHS/PHXAO/AEF - REPOINT LAB DATA - 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 BZXM to BPM
 ;IHS/OIT/NKD  6/13/2012 Save and restore "AC" x-ref
 ;                       Moved processing check from BPMXDRV
 ;
DESC ;----- ROUTINE DESCRIPTION
 ;;
 ;;BPMXLR:
 ;;THIS ROUTINE RUNS THE ^BLRMERG ROUTINE TO MERGE LAB DATA.
 ;;
 ;;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 UP BY 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
 ;
 ;      BLRFM  =  PATIENT DFN BEING MERGED FROM
 ;      BLRTO  =  PATIENT DFN BEING MERGED INTO
 ;
 ;IHS/OIT/NKD BPM*1.0*2 QUIT IF BLRMERG NOT INSTALLED
 Q:'$L($T(EN^BLRMERG))
 ;
 N BLRFM,BLRNEW,BLROLD,BLRTO,XDRMRG,DA,DIE,DR,X,Y,I,J
 ;
 S BLRFM=$O(@BPMRY@(0))
 Q:'BLRFM
 S BLRTO=$O(@BPMRY@(BLRFM,0))
 Q:'BLRTO
 ;
 S XDRMRG("FR")=BLRFM
 S XDRMRG("TO")=BLRTO
 S BLROLD=+$G(^DPT(BLRFM,"LR"))
 S BLRNEW=+$G(^DPT(BLRTO,"LR"))
 Q:'BLROLD&'BLRNEW
 ;
 ;If 'from' patient in Lab system but 'to' patient is not, then
 ;repoint 'from' patient's LR entry to 'to' patient, then quit.
 I '+BLRNEW D  Q
 . S DIE="^LR("
 . S DA=BLROLD
 . S DR=".03////"_BLRTO
 . D ^DIE
 ;
 ;IHS/OIT/NKD BPM*1.0*2 STORE VALUES OF "AC" X-REF
 I $D(^LRO(68,"AC",BLROLD)) K ^TMP("BPMLR",$J) M ^TMP("BPMLR",$J,68,"AC",BLROLD)=^LRO(68,"AC",BLROLD)
 ;
 D MERGE^BLRMERG
 ;
 ;IHS/OIT/NKD BPM*1.0*2 RESTORE VALUES OF "AC" X-REF
 I $D(^TMP("BPMLR",$J))  D
 . S I=0
 . F  S I=$O(^LRO(68,"AC",BLRNEW,I)) Q:+I'=I  D
 . . S J=0
 . . F  S J=$O(^LRO(68,"AC",BLRNEW,I,J)) Q:+J'=J  D
 . . . ; QUIT IF X-REF HAS A VALUE
 . . . Q:$L(^LRO(68,"AC",BLRNEW,I,J))>0
 . . . ; QUIT IF X-REF DID NOT COME FROM BLROLD
 . . . Q:'$D(^TMP("BPMLR",$J,68,"AC",BLROLD,I,J))
 . . . S ^LRO(68,"AC",BLRNEW,I,J)=$G(^TMP("BPMLR",$J,68,"AC",BLROLD,I,J))
 ;
 ;Repoint ^LR("BLRA") ESIG xref in Lab Data file #63
 D EN^BPMXLR2(BLRFM,BLRTO)
 ;
 Q