source: FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMTIU.m@ 1540

Last change on this file since 1540 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1PXRMTIU ;SLC/RMS,PKR - Clinical Reminder TIU routines. ; 05/16/2006
2 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
3 ;==========================================================
4NOTE(DFN,NGET,BDT,EDT,NFOUND,TEST,DATE,DATA,TEXT) ;Computed finding
5 ;for note title.
6 S NFOUND=0
7 Q:(TEST="")!(NGET=0)
8 N ADDDATA,AUTH,DONE,EDTT,INVDATE,NGETABS,PIEN
9 N SDIR,STATUS,TEMP,TIEN,TITLE,TYPE
10 S TITLE=$P(TEST,U),STATUS=$P(TEST,U,2),ADDDATA=+$P(TEST,U,3)
11 I STATUS="" S STATUS=7 ;COMPLETED IS THE DEFAULT
12 S EDTT=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
13 ;Invert and switch beginning and ending dates because the TIU index
14 ;uses inverse dates.
15 S INVDATE=BDT,BDT=9999999-EDTT,EDTT=9999999-INVDATE
16 S SDIR=$S(NGET>0:1,1:-1)
17 S INVDATE=$S(SDIR=+1:BDT-.000001,1:EDTT)
18 S NGETABS=$S(NGET<0:-NGET,1:NGET)
19 ;Find the ien for the title.
20 S (DONE,TIEN)=0
21 ;DBIA #2321
22 F Q:DONE S TIEN=$O(^TIU(8925.1,"B",TITLE,TIEN)) Q:TIEN="" D
23 . S TYPE=$P(^TIU(8925.1,TIEN,0),U,4)
24 . I TYPE="DOC" S DONE=1
25 I 'DONE Q
26 ;DBIA #2937
27 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
28 . S PIEN=$O(^TIU(8925,"APT",DFN,TIEN,STATUS,INVDATE,0)) Q:'+PIEN
29 . S NFOUND=NFOUND+1
30 . S TEST(NFOUND)=1
31 . S DATE(NFOUND)=$P(^TIU(8925,PIEN,13),U)
32 . S DATA(NFOUND,"VALUE")=TITLE
33 . S DATA(NFOUND,"TITLE")=TITLE
34 . S AUTH=+$P($G(^TIU(8925,PIEN,12)),U,2)
35 . S AUTH=$S(AUTH>0:$$GET1^DIQ(200,AUTH,.01),1:"MISSING")
36 . S DATA(NFOUND,"AUTH")=AUTH
37 . S TEXT(NFOUND)="Author: "_AUTH
38 . I ADDDATA D
39 ..;DBIA #2834
40 .. S TEMP=$$RESOLVE^TIUSRVLO(PIEN)
41 .. S DATA(NFOUND,"DISPLAY NAME")=$P(TEMP,U,1)
42 .. S DATA(NFOUND,"HOSPITAL LOCATION")=$P(TEMP,U,5)
43 .. S DATA(NFOUND,"EPISODE BEGIN DATE/TIME")=$P(TEMP,U,7)
44 .. S DATA(NFOUND,"EPISODE END DATE/TIME")=$P(TEMP,U,8)
45 .. S DATA(NFOUND,"REQUESTING PACKAGE")=$P(TEMP,U,9)
46 .. S DATA(NFOUND,"NUMBER OF IMAGES")=$P(TEMP,U,10)
47 .. S DATA(NFOUND,"SUBJECT")=$P(TEMP,U,11)
48 Q
49 ;
Note: See TracBrowser for help on using the repository browser.