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

BLRMERGT.m

Go to the documentation of this file.
  1. BLRMERGT ; IHS/ISD/EDE - MANUAL PROCESS MERGE BLRMERG ; [ 12/21/1998 3:56 PM ]
  1. ;;5.2;BLR;**1005,1030**;NOV 01, 1997
  1. ;
  1. ; NOTE: This routine was originally just for testing. It has been
  1. ; modified to work correctly for merging Lab Data since previous
  1. ; versions of the Lab Merge routines would sometimes fail during
  1. ; the merge.
  1. ;
  1. START ;
  1. S DIC=2,DIC(0)="AQEM",DIC("A")="Select Patient to be PURGED: " D ^DIC Q:+Y<1 S BLRP1=+Y
  1. I '$D(^DPT(+Y,"LR")) W !,"This patient has no lab data to purge. ",!! G START
  1. S DIC=2,DIC(0)="AQEM",DIC("A")="Select Patient to RECEIVE lab data: " D ^DIC Q:+Y<1 S BLRP2=+Y
  1. OK W !,"Is everything OK" S %=2 D YN^DICN Q:%<0 W:%=0 !,"Answer NO if you are unsure, or '^' to quit.",! G:%=0 OK
  1. I %=2 G START
  1. W !!,"This will take about one minute..."
  1. S XDRMRG("FR")=BLRP1,XDRMRG("TO")=BLRP2
  1. K ^TMP("XDRMRGFR",$J)
  1. K ^TMP("XDRMRGTO",$J)
  1. S ^TMP("XDRMRGFR",$J,XDRMRG("FR"),"LR")=^DPT(BLRP1,"LR")
  1. ; S:$D(^DPT(P2,"LR")) ^TMP("XDRMRGTO",$J,XDRMRG("TO"),"LR")=^DPT(BLRP2,"LR")
  1. ; ----- BEGIN IHS/OIT/MKK -- LR*5.2*1030 -- Fix ^DPT(P2 typo
  1. S:$D(^DPT(BLRP2,"LR")) ^TMP("XDRMRGTO",$J,XDRMRG("TO"),"LR")=^DPT(BLRP2,"LR")
  1. ; ----- END IHS/OIT/MKK -- LR*5.2*1030
  1. D ^BLRMERG
  1. W !!,"Done..." H 2
  1. Q
  1. ;
  1. TEST ; EP -- LR*5.2*1030 Note: OLD, DEAD CODE -- All lines commented out
  1. ; D SETDPT
  1. ; S XDRMRG("FR")=222
  1. ; S XDRMRG("TO")=333
  1. ; S ^TMP("XDRMRGFR",$J,XDRMRG("FR"),"LR")=^DPT(222,"LR")
  1. ; S ^TMP("XDRMRGTO",$J,XDRMRG("TO"),"LR")=^DPT(333,"LR")
  1. ; D ^BLRMERG
  1. Q
  1. ;
  1. SETDPT ; SET ^DPT "LR" NODES -- LR*5.2*1030 Note: OLD, DEAD CODE -- All lines commented out
  1. ; S ^DPT(222,"LR")=8
  1. ;;S ^DPT(222,"LR")=10
  1. ; S ^DPT(333,"LR")=9
  1. Q
  1. ;
  1. ; ======================================================================
  1. ; Two LRDFNs point to SAME Patient. Merge the Lab Data
  1. ;
  1. ; Note that this routine should only be run in programmer mode by
  1. ; a person extremely knowledgeable with the RPMS Lab Module.
  1. TWOLRDFN ; EP
  1. NEW LRDFN1,LRDFN2,DPTIEN,FIXLRDFN,QFLG
  1. W !!
  1. D ^XBFMK
  1. S DIR(0)="PO^63"
  1. S DIR("A")="FROM LRDFN"
  1. D ^DIR
  1. I +$G(Y)<1 D Q
  1. . W !,"No or invalid Entry. Routine Stops.",!!
  1. ;
  1. S LRDFN1=+$G(Y)
  1. ;
  1. W !!
  1. D ^XBFMK
  1. S DIR(0)="PO^63"
  1. S DIR("A")="TO LRDFN"
  1. D ^DIR
  1. I +$G(Y)<1 D Q
  1. . W !,"No or invalid Entry. Routine Stops.",!!
  1. ;
  1. S (FIXLRDFN,LRDFN2)=+$G(Y)
  1. ;
  1. W !!
  1. D ^XBFMK
  1. S DIR(0)="NO"
  1. S DIR("A")="DPT IEN"
  1. D ^DIR
  1. I +$G(Y)<1 D Q
  1. . W !,"No or invalid entry. Routine Stops.",!!
  1. ;
  1. S DPTIEN=+$G(Y)
  1. ;
  1. W !!,"Variables Setup:",!
  1. W ?5,"FROM LRDFN:",LRDFN1,!
  1. W ?5,"TO LRDFN:",LRDFN2,!
  1. W ?5,"DPT IEN:",DPTIEN,!
  1. D ^XBFMK
  1. S DIR(0)="Y"
  1. S DIR("A")="Continue"
  1. S DIR("B")="NO"
  1. D ^DIR
  1. I +$G(Y)<1 D Q
  1. . W !,"NO or invalid entry. Routine Stops.",!!
  1. ;
  1. S XDRMRG("FR")=DPTIEN
  1. S XDRMRG("TO")=DPTIEN
  1. K ^TMP("XDRMRGFR",$J)
  1. K ^TMP("XDRMRGTO",$J)
  1. S ^TMP("XDRMRGFR",$J,XDRMRG("FR"),"LR")=LRDFN1
  1. S ^TMP("XDRMRGTO",$J,XDRMRG("TO"),"LR")=LRDFN2
  1. ;
  1. D ^BLRMERG
  1. ;
  1. S:$G(^DPT(DPTIEN,"LR"))="" ^DPT(DPTIEN,"LR")=FIXLRDFN
  1. Q
  1. ; ----- END IHS/OIT/MKK -- LR*5.2*1030
  1. ;
  1. WALTCHEK ; EP
  1. ;This SubRtn checks for BAD Ptrs in ^LR subsequent to PtMerge processes
  1. ;This Rtn does not change anything currently... it just displays.
  1. NEW CNT,CNTIEN,IEN,TOIEN,LRIEN,LRREC,PTR,MREC
  1. S (CNT,CNTIEN,IEN)=0
  1. F S IEN=$O(^DPT(IEN)) Q:'IEN D
  1. . S CNTIEN=CNTIEN+1
  1. . W:CNT<1 $$LJ^XLFSTR(CNTIEN,20),$C(13)
  1. . ;
  1. . S TOIEN=$G(^DPT(IEN,-9)) ;-9 indicates this record has been merged.
  1. . I TOIEN D ;if it has a value it has the 'to' pointer
  1. .. S LRIEN=$G(^DPT(TOIEN,"LR")) ;get the Lab Ptr
  1. .. I LRIEN D ;If the Ptr exists
  1. ... S LRREC=$G(^LR(LRIEN,0)) ;attempt to get the record
  1. ... I LRREC D ;If the Lab record exists
  1. .... I $P(LRREC,U,3)'=TOIEN D
  1. ..... S PTR=$P(LRREC,U,3)_";DPT(" ;setup to get date merged
  1. ..... S MREC=$O(^XDRM("B",PTR,0)) ;ditto
  1. ..... W !!,"Merged On:",$P(^XDRM(MREC,0),U,3)," PatNam= ",$P(^DPT(IEN,0),"^",1)
  1. ..... W !," ^DPT(",IEN,",-9) PointsTo:",TOIEN," the DPT 'LR' Ptr=",LRIEN
  1. ..... W !," LR ptr Back To DPT=",$P(LRREC,U,3)," it should be->",TOIEN
  1. ..... S CNT=CNT+1
  1. ;
  1. W !!,"Total Number of ^DPT IENs = ",CNTIEN,!
  1. W !,?5,"# of BAD ^LR Ptrs = ",CNT,!!
  1. Q