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

PXRMTIU.m

Go to the documentation of this file.
  1. PXRMTIU ;SLC/RMS,PKR - Clinical Reminder TIU routines. ; 06/03/2013
  1. ;;2.0;CLINICAL REMINDERS;**4,12,26**;Feb 04, 2005;Build 404
  1. ;==========================================================
  1. NOTE(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;Computed finding
  1. ;for note title.
  1. S NFOUND=0
  1. Q:(TEST="")!(NGET=0)
  1. N ADDDATA,AUTH,DONE,EDTT,ECOSIGN,ESIGN,INVDATE,NGETABS,PIEN
  1. N SDIR,STATUS,TEMP,TIEN,TITLE,TYPE
  1. S TITLE=$P(TEST,U),STATUS=$P(TEST,U,2),ADDDATA=+$P(TEST,U,3)
  1. I STATUS="" S STATUS=7 ;COMPLETED IS THE DEFAULT
  1. S EDTT=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
  1. ;Invert and switch beginning and ending dates because the TIU index
  1. ;uses inverse dates.
  1. S INVDATE=BDT,BDT=9999999-EDTT,EDTT=9999999-INVDATE
  1. S SDIR=$S(NGET>0:1,1:-1)
  1. S INVDATE=$S(SDIR=+1:BDT-.000001,1:EDTT)
  1. S NGETABS=$S(NGET<0:-NGET,1:NGET)
  1. ;See if the note is passed as a title or an IEN.
  1. S (DONE,TIEN)=0
  1. I $E(TITLE,1)="`" D
  1. . S TIEN=$P(TITLE,"`",2)
  1. .;DBIA #2321
  1. . S TYPE=$P(^TIU(8925.1,TIEN,0),U,4)
  1. . I TYPE="DOC" S DONE=1,TITLE=$P(^TIU(8925.1,TIEN,0),U,1)
  1. E D
  1. .;Find the ien for the title.
  1. .;DBIA #2321
  1. . F Q:DONE S TIEN=$O(^TIU(8925.1,"B",TITLE,TIEN)) Q:TIEN="" D
  1. .. S TYPE=$P(^TIU(8925.1,TIEN,0),U,4)
  1. .. I TYPE="DOC" S DONE=1
  1. I 'DONE Q
  1. ;DBIA #2937
  1. F S INVDATE=$O(^TIU(8925,"APT",DFN,TIEN,STATUS,INVDATE),SDIR) Q:$S(INVDATE=0:1,NFOUND=NGETABS:1,INVDATE<BDT:1,INVDATE>EDTT:1,1:0) D
  1. . S PIEN=$O(^TIU(8925,"APT",DFN,TIEN,STATUS,INVDATE,0)) Q:'+PIEN
  1. . S NFOUND=NFOUND+1
  1. . S TEST(NFOUND)=1
  1. . S DATE(NFOUND)=$P(^TIU(8925,PIEN,13),U)
  1. . S DATA(NFOUND,"VALUE")=TITLE
  1. . S DATA(NFOUND,"TITLE")=TITLE
  1. . S TEMP=$G(^TIU(8925,PIEN,12))
  1. . S AUTH=+$P(TEMP,U,2)
  1. . S AUTH=$S(AUTH>0:$$GET1^DIQ(200,AUTH,.01),1:"MISSING")
  1. . S DATA(NFOUND,"AUTH")=AUTH
  1. . S TEXT(NFOUND)="Author: "_AUTH
  1. . S ESIGN=$P(TEMP,U,4)
  1. . S ESIGN=$S(ESIGN>0:$$GET1^DIQ(200,ESIGN,.01),1:"")
  1. . S DATA(NFOUND,"EXPECTED SIGNER")=ESIGN
  1. . S ECOSIGN=$P(TEMP,U,8)
  1. . S ECOSIGN=$S(ECOSIGN>0:$$GET1^DIQ(200,ECOSIGN,.01),1:"")
  1. . S DATA(NFOUND,"EXPECTED COSIGNER")=ECOSIGN
  1. . I ADDDATA D
  1. ..;DBIA #2834
  1. .. S TEMP=$$RESOLVE^TIUSRVLO(PIEN)
  1. .. S DATA(NFOUND,"DISPLAY NAME")=$P(TEMP,U,1)
  1. .. S DATA(NFOUND,"HOSPITAL LOCATION")=$P(TEMP,U,5)
  1. .. S DATA(NFOUND,"EPISODE BEGIN DATE/TIME")=$P(TEMP,U,7)
  1. .. S DATA(NFOUND,"EPISODE END DATE/TIME")=$P(TEMP,U,8)
  1. .. S DATA(NFOUND,"REQUESTING PACKAGE")=$P(TEMP,U,9)
  1. .. S DATA(NFOUND,"NUMBER OF IMAGES")=$P(TEMP,U,10)
  1. .. S DATA(NFOUND,"SUBJECT")=$P(TEMP,U,11)
  1. Q
  1. ;