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

LRLNCDEL.m

Go to the documentation of this file.
  1. LRLNCDEL ; DALOI/CA/FHS - UNMAP LAB TESTS TO LOINC CODES OR DELETE LOINC MAPPINGS ;1-OCT-1998
  1. ;;5.2T9;LR;**1018**;Nov 17, 2004
  1. ;;5.2;LAB SERVICE;**232,278**;Sep 27,1994
  1. ;Reference to ^DD supported by IA 10154
  1. ;=================================================================
  1. ; Ask VistA test to unmap-Lookup in Lab Test file #60
  1. START ;entry point from option LR LOINC MAPPING
  1. S LREND=0 D TEST
  1. I $G(LREND) G EXIT
  1. W @IOF,!! D SPEC
  1. I $G(LREND) D EXIT G START
  1. D UNMAP
  1. D EXIT
  1. G START
  1. EXIT ;
  1. K DA,DIC,DIE,DINUM,DIR,DIRUT,DR,DTOUT,I,LRCODE,LRDATA,LREND,LRLNC,LRLNC0,LRLOINC,LRELEC,LRIEN,LRNLT,LRSPEC,LRSPECL,LRSPECN,LRTIME,LRTEST,LRUNITS,S,Y
  1. K LRNLTN,LRNLTNM,LRASPECT
  1. K D,D0,DD,DO,DLAYGO,LRLNCNAM,LRNO,LROUT,X
  1. QUIT
  1. TEST W !!
  1. N DIR,Y,X,LROUT,LRERR,DA,DIC,DIE,DR
  1. S DIR(0)="PO^60:QENMZ,",DIR("A")="VistA Lab Test to delete/unmap to LOINC "
  1. S DIR("?")="Select Lab test you wish to delete/unmap to a LOINC Code"
  1. D ^DIR K DIR
  1. I $D(DIRUT) K DIRUT S LREND=1 Q
  1. S LRIEN=+Y,LRTEST=$P(Y,U,2)
  1. ;Check for RESULT NLT CODE and if not one let enter
  1. L +^LAB(60,LRIEN):2 I '$T W !?4,"Locked by another user" H 5 G TEST
  1. I '$P($G(^LAB(60,LRIEN,64)),U,2) D I $D(DUOUT)!($D(DTOUT)) S LREND=1 Q
  1. . W !!,"There is not a RESULT NLT CODE for "_LRTEST,".",!
  1. . W !,"You must select one now to continue with the mapping of this test!",!
  1. . K DIE,DR,DA S DA=LRIEN,DIE="^LAB(60,",DR=64.1
  1. . D ^DIE
  1. . L -^LAB(60,LRIEN)
  1. . I $D(DUOUT)!($D(DTOUT)) Q
  1. . S DIC=DIE,DR=0 W !! W ?5,"IEN: [",DA,"] ",$P(^LAB(60,LRIEN,0),U) S S=$Y D EN^LRDIQ W !
  1. L -^LAB(60,LRIEN)
  1. S LRNLT=$P($G(^LAB(60,LRIEN,64)),U,2)
  1. I 'LRNLT G TEST
  1. D GETS^DIQ(64,LRNLT_",",".01;1","E","LROUT","LRERR")
  1. S LRNLTNM=$G(LROUT(64,LRNLT_",",.01,"E"))
  1. S LRNLTN=$G(LROUT(64,LRNLT_",",1,"E"))
  1. Q
  1. SPEC ; Ask Specimen- Lookup in Specimen multiple in Lab Test file #60
  1. N DIR,DIRUT
  1. S DIR(0)="PO^61:ENQNZ",LREND=0
  1. S DIR("S")="I $P(^(0),U,9),$P(^(0),U,10)"
  1. S DIR("?")="Enter a TOPOGRAPHY having a LEDI HL7 code defined."
  1. S DIR("A")="Specimen Source: "
  1. D ^DIR I $D(DIRUT) S LREND=1 Q
  1. S LRSPEC=+Y,LRSPECN=$P(Y,U,2)
  1. S LRELEC=$P(Y(0),U,9),LRASPECT=$P(Y(0),U,10)
  1. D GETS^DIQ(64.061,LRELEC_",",1,"E","LROUT","LRERR")
  1. S LRSPECL=$G(LROUT(64.061,LRELEC_",",1,"E"))
  1. I '$L(LRSPECL) W !?5,LRSPECN_" has a broken pointer" S LREND=1
  1. Q
  1. UNMAP ;Check to see if already mapped to a LOINC code
  1. N DA,DIC,DIK,DIR,DIRUT,DR
  1. S DIR(0)="PO^64:EQNZM",DIR("S")="I $P($P(^(0),U,2),""."")="_$P(LRNLTN,".")
  1. S DIR("B")=$P(LRNLTN,".")
  1. D ^DIR I $D(DIRUT) S LREND=1 Q
  1. S LRNLT=+Y
  1. L +^LAM(LRNLT,5):1 I '$T W !,"Another user is editing this record",! H 5 Q
  1. I '$D(^LAM(LRNLT,5,LRSPEC,1,LRASPECT)) D G INDEX60
  1. . N LROUT
  1. . D GETS^DIQ(64.061,LRASPECT_",",.01,"E","LROUT")
  1. . W $C(7)
  1. . W !!!?5,"Lab Test: "_LRTEST_" / "_LRSPECL_" is NOT mapped to "
  1. . W !,"WKLD CODE: "_$P(Y,U,2)_" Time Aspect of: "_$G(LROUT(64.061,LRASPECT_",",.01,"E"))
  1. DIS ;Show the data
  1. K DA,DIC,DIK,DIR,DR
  1. S DA(2)=LRNLT,DA(1)=LRSPEC,DA=LRASPECT,DIC="^LAM("_DA(2)_",5,"_DA(1)_",1,"
  1. S S=0,DR="0:99"
  1. W !!,LRSPECN,!
  1. D EN^DIQ
  1. S DIR(0)="Y",DIR("A")="Are You - SURE- you want to delete this mapping"
  1. D ^DIR I $G(Y)'=1 L -^LAM(LRNLT,5) Q
  1. S DIK=DIC D ^DIK
  1. INDEX60 ;Stores LOINC code in Laboratory Test file (#60) so know what tests are mapped.
  1. K DIE,DA,DR S DA=LRSPEC,DA(1)=LRIEN,DIE="^LAB(60,"_DA(1)_",1,",DR="95.3///@" D ^DIE
  1. ;S ^LAB(60,LRIEN,1,LRSPEC,95.3)=LRCODE
  1. L -^LAM(LRNLT,5)
  1. Q
  1. SHOWPRE ;DISPLAY LOINC CODE ALREADY MAPPED TO NLT
  1. S LRLNC=$P($G(^LAM(LRNLT,5,LRSPEC,1,LRTIME,1)),U)
  1. W !!,"This test and specimen is mapped to:"
  1. W !,"LOINC code: ",LRLNC," ",$G(^LAB(95.3,+LRLNC,80))
  1. W !!
  1. S DIR(0)="Y",DIR("A")="Are you sure you want to delete this mapping"
  1. S DIR("?")="If you enter yes, the current LOINC code mapping will be deleted."
  1. D ^DIR K DIR
  1. Q