source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURPN.m@ 1259

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1TIURPN ; SLC/JER - QUICK Review BY PATIENT ;2/28/01
2 ;;1.0;TEXT INTEGRATION UTILITIES;**100**;Jun 20, 1997
3EN(TIUCLASS,DFN) ; Entry point for build code
4 N DIRUT,DTOUT,DUOUT,TIUI,SCREEN,STATUS,TIUTYP,TIUSTAT,TIUEDFLT,TIUDCL
5 N TIUDPRMT,TIUPICT,TIUOUT
6 K DIROUT
7 S TIUEDT=$$FMADD^XLFDT(DT,$S($D(^DPT(DFN,.1))'>0:-180,1:-30))
8 S TIULDT=+$$NOW^XLFDT
9 W !,"Searching for the documents."
10 D BUILD(TIUCLASS,DFN,TIUEDT,TIULDT)
11 Q
12BUILD(CLASS,DFN,EARLY,LATE) ; Build List
13 N TIUCNT,TIUDT,TIUI,TIUJ,TIUK,TIUP,TIUQ,TIUDA,TIUREC
14 N TIUT,TIUTP,XREF,TIUS,TIUPREF,TIUPICK
15 S (TIUK,VALMCNT)=0
16 K ^TMP("TIUR",$J),^TMP("TIURIDX",$J)
17 S EARLY=9999999-+$G(EARLY),LATE=9999999-+$G(LATE)
18 S TIUJ=LATE
19 S TIUPICK=+$O(^ORD(101,"B","TIU ACTION SELECT LIST ELEMENT",0))
20 F S TIUJ=$O(^TIU(8925,"APTCL",DFN,CLASS,TIUJ)) Q:+TIUJ'>0!(+TIUJ>EARLY) D
21 . S TIUDA=0
22 . F S TIUDA=$O(^TIU(8925,"APTCL",DFN,CLASS,TIUJ,TIUDA)) Q:+TIUDA'>0 D
23 . . D ADDELMNT(TIUDA,.TIUCNT)
24 S ^TMP("TIUR",$J,0)=+$G(TIUCNT)_U_"ALL^APT^"_DFN
25 S ^TMP("TIUR",$J,0)=^TMP("TIUR",$J,0)_U_$P(^DPT(DFN,0),U)
26 S ^TMP("TIUR",$J,"CLASS")=TIUCLASS
27 S ^TMP("TIUR",$J,"#")=TIUPICK_"^1:"_+$G(TIUCNT)
28 I $D(VALMHDR)>9 D HDR^TIURH
29 S VALMCNT=+$G(TIUCNT)
30 I +$G(TIUCNT)'>0 D
31 . S ^TMP("TIUR",$J,1,0)="",VALMCNT=2
32 . S ^TMP("TIUR",$J,2,0)=" No records found to satisfy search criteria."
33 Q
34ADDELMNT(DA,TIUCNT) ; Add each element to the list
35 N DIC,DIQ,DR,TIUR,PT,MOM,ADT,DDT,LCT,AUT,AMD,EDT,SDT,XDT,RMD,TIULST4
36 N TIUP,TIUREC,TIUD0,TIUD12,TIUD13,TIUD15,TIULI,STATX,DOC,IDKIDFLG
37 I '$D(^TIU(8925,DA,0)) Q
38 I $G(^TMP("TIUR",$J,2,0))=" No records found to satisfy search criteria." D
39 . K ^TMP("TIUR",$J,2),^TMP("TIUR",$J,"IDX",2),^TMP("TIUR",$J,"IDX",1) S TIUCNT=0
40 S TIUD0=$G(^TIU(8925,+DA,0)),TIUD12=$G(^TIU(8925,+DA,12))
41 S TIUD13=$G(^TIU(8925,+DA,13)),TIUD15=$G(^TIU(8925,+DA,15))
42 I +TIUD0=81,(+$P(TIUD0,U,5)>5) Q
43 S DOC=$$PNAME^TIULC1(+TIUD0)
44 I DOC="Addendum" S DOC=DOC_" to "_$$PNAME^TIULC1(+$G(^TIU(8925,+$P(TIUD0,U,6),0)))
45 S PT=$$NAME^TIULS($$PTNAME^TIULC1($P(TIUD0,U,2)),"LAST,FI MI")
46 S TIULI=$E(PT),IDKIDFLG=1
47 I +$O(^TIU(8925,"DAD",+DA,0)),$$HASADDEN^TIULC1(DA,IDKIDFLG) S PT="+ "_PT ;**100**
48 S TIUP=$$URGENCY(+DA)
49 S:TIUP=1 PT=$S(PT["+":"*",1:"* ")_PT
50 S TIULST4=$E($P($G(^DPT(+$P(TIUD0,U,2),0)),U,9),6,9)
51 S TIULST4="("_TIULI_TIULST4_")"
52 S ADT=$$DATE^TIULS($P(TIUD0,U,7),"MM/DD/YY")
53 S DDT=$$DATE^TIULS($P(TIUD0,U,8),"MM/DD/YY")
54 S AMD=$$PERSNAME^TIULC1($P(TIUD12,U,8)) S:AMD="UNKNOWN" AMD=""
55 S AUT=$$PERSNAME^TIULC1($P(TIUD12,U,2)) S:AUT="UNKNOWN" AUT=""
56 S AMD=$$NAME^TIULS(AMD,"LAST,FI MI")
57 S AUT=$$NAME^TIULS(AUT,"LAST,FI MI")
58 S EDT=$$DATE^TIULS($P(TIUD13,U),"MM/DD/YY")
59 S SDT=$S(+$P(TIUD15,U,7):+$P(TIUD15,U,7),+$P(TIUD0,U,5)'<7:+$P(TIUD15,U),1:"")
60 S SDT=$$DATE^TIULS(SDT,"MM/DD/YY")
61 S STATX=$P($G(^TIU(8925.6,+$P(TIUD0,U,5),0)),U)
62 S TIUCNT=+$G(TIUCNT)+1
63 S TIUREC=$$SETFLD^VALM1(TIUCNT,"","NUMBER")
64 S TIUREC=$$SETFLD^VALM1(PT,TIUREC,"PATIENT NAME")
65 S TIUREC=$$SETFLD^VALM1(TIULST4,TIUREC,"LAST I/LAST 4")
66 S TIUREC=$$SETFLD^VALM1(DOC,TIUREC,"DOCUMENT TYPE")
67 S TIUREC=$$SETFLD^VALM1(EDT,TIUREC,"REF DATE")
68 S TIUREC=$$SETFLD^VALM1(SDT,TIUREC,"SIG DATE")
69 S TIUREC=$$SETFLD^VALM1($$LOWER^TIULS(STATX),TIUREC,"STATUS")
70 S TIUREC=$$SETFLD^VALM1(AUT,TIUREC,"AUTHOR")
71 S TIUREC=$$SETFLD^VALM1(AMD,TIUREC,"COSIGNER")
72 S ^TMP("TIUR",$J,TIUCNT,0)=TIUREC
73 S ^TMP("TIUR",$J,"IDX",TIUCNT,TIUCNT)="" W:TIUCNT#10'>0 "."
74 S ^TMP("TIURIDX",$J,TIUCNT)=TIUCNT_U_DA
75 S VALMCNT=TIUCNT
76 Q
77CLEAN ; Clean up your mess!
78 K ^TMP("TIUR",$J),^TMP("TIURIDX",$J) D CLEAN^VALM10
79 K VALMY
80 Q
81URGENCY(TIUDA) ; What is the urgency of the current document
82 N TIUY,TIUD0,TIUDSTAT,TIUDURG
83 S TIUD0=$G(^TIU(8925,+TIUDA,0)),TIUDSTAT=$P(TIUD0,U,5)
84 S TIUDURG=$P(TIUD0,U,9)
85 S TIUY=$S(TIUDSTAT<7:$S(TIUDURG="P":1,1:2),1:3)
86 Q TIUY
Note: See TracBrowser for help on using the repository browser.