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

BPXRMRAD.m

Go to the documentation of this file.
  1. BPXRMRAD ; IHS/MSC/MGH - Use V RAD in reminder resolution. ;25-Nov-2013 14:52;DU
  1. ;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
  1. ;===================================================================
  1. VRAD(DFN,TEST,DATE,VALUE,TEXT) ;EP
  1. N BPXTRM
  1. Q:TEST=""
  1. S BPXTRM="" S BPXTRM=$O(^PXRMD(811.5,"B",TEST,BPXTRM))
  1. I BPXTRM="" S TEST=0,DATE=DT,TEXT="Reminder term does not exist" Q
  1. D GETVAR(BPXTRM)
  1. Q
  1. GETVAR(BPXTRM) ;EP
  1. ;Get the needed data from the reminder term. This includes
  1. ;the test name(s) and the value to search for
  1. N X,Y,BPXFIND,BPXTYPE,BPXOFF,BPXFILE,BPXRESLT,BPXCNT,BPXTEST
  1. K ^TMP("PXRMRAD",$J)
  1. S BPXCNT=0,BPXRESLT=0
  1. S BPXFIND=0 F S BPXFIND=$O(^PXRMD(811.5,BPXTRM,20,BPXFIND)) Q:BPXFIND=""!(BPXFIND?1A.A)!(BPXRESLT=1) D
  1. .S BPXTYPE=$P($G(^PXRMD(811.5,BPXTRM,20,BPXFIND,0)),U,1)
  1. .S BPXTEST=$P(BPXTYPE,";",1),BPXFILE=$P(BPXTYPE,";",2)
  1. .;This needs to be a term of laboratory tests
  1. .Q:BPXFILE'="RAMIS(71,"
  1. .S BPXOFF=$P($G(^PXRMD(811.5,BPXTRM,20,BPXFIND,0)),U,8)
  1. .;Call next routine with patient,start and stop dates,test name
  1. .D RESULT(DFN,BPXTEST)
  1. ;Loop through results and return most recent
  1. S BPXRESLT="" S BPXRESLT=$O(^TMP("PXRMRAD",$J,BPXRESLT))
  1. I BPXRESLT="" S TEST=0,VALUE=TEST
  1. I +BPXRESLT D
  1. .S TEST=1,VALUE=$P($G(^TMP("PXRMRAD",$J,BPXRESLT)),U,2)
  1. .S DATE=$P($G(^TMP("PXRMRAD",$J,BPXRESLT)),U,1)
  1. .S TEXT=$P($G(^TMP("PXRMRAD",$J,BPXRESLT)),U,3)
  1. Q
  1. RESULT(DFN,RADIEN) ;EP
  1. ;EP Find a patients labs in the V LAB file
  1. ;Get up to ten results of the specified lab test
  1. ;If the result has an associated LR ACCESSION NUMBER quit
  1. ;If not, add it to the array to be used in the reminder
  1. ;===================================================================
  1. N VRIEN,INVDATE,TEMP,RADPROC,COUNT
  1. S VRIEN="",COUNT=0
  1. Q:'$D(^AUPNVRAD("AC",DFN))
  1. F S VRIEN=$O(^AUPNVRAD("AC",DFN,VRIEN)) Q:VRIEN=""!(COUNT>10) D
  1. .S RADPROC=$P($G(^AUPNVRAD(VRIEN,0)),U,1)
  1. .I RADPROC=RADIEN D STORE
  1. Q
  1. STORE ;Store the needed data into TMP for use in reminders
  1. N FLAG,UNITS,ORDER,TEMP,TEMP1,TEMP2,VIS,VDATE,Y,INVDATE,PROC,STATUS
  1. S COUNT=COUNT+1
  1. S TEMP=$G(^AUPNVRAD(VRIEN,0)),TEMP1=$G(^AUPNVRAD(VRIEN,11))
  1. S TEMP2=$G(^AUPNVRAD(VRIEN,12))
  1. I TEMP1'="" S ORDER="COMPLETE",STATUS="COMPLETE"
  1. I TEMP1="" S ORDER="IN PROGRESS",STATUS="IN PROGRESS"
  1. S PROC=$$GET1^DIQ(9000010.22,VRIEN,.01)
  1. I $P(TEMP2,U,1)="" D
  1. .S VIS=$P($G(^AUPNVRAD(VRIEN,0)),U,3)
  1. .Q:VIS=""
  1. .S VDATE=$P($G(^AUPNVSIT(VIS,0)),U,1)
  1. .S Y=VDATE
  1. E S Y=$P(TEMP2,U,1)
  1. S INVDATE=9999999-Y
  1. S ^TMP("PXRMRAD",$J,INVDATE)=Y_U_PROC_U_STATUS
  1. Q