[613] | 1 | TIUSRVLR ; SLC/JER - TIU RPCs ; 02/25/04
|
---|
| 2 | ;;1.0;TEXT INTEGRATION UTILITIES;**112**;Jun 20, 1997
|
---|
| 3 | GETDOCS(TIUY,OVP,SEQUENCE) ; Get TIU Documents for a given Consult or
|
---|
| 4 | ; Surgical Case
|
---|
| 5 | N TIUDA,TIUI
|
---|
| 6 | ;Initialize vars
|
---|
| 7 | S (TIUDA,TIUI)=0,TIUY=$NA(^TMP("TIULIST",$J)) K @TIUY
|
---|
| 8 | S SEQUENCE=$S($G(SEQUENCE)]"":$G(SEQUENCE),1:"D")
|
---|
| 9 | ;Loop through "G" X-ref in 8925 to find associated documents
|
---|
| 10 | F S TIUDA=$O(^TIU(8925,"G",OVP,TIUDA)) Q:+TIUDA'>0 D
|
---|
| 11 | . S TIUI=TIUI+1
|
---|
| 12 | . ; Cross-check value of field 1405 with x-ref value
|
---|
| 13 | . I OVP'=$P($G(^TIU(8925,TIUDA,14)),U,5) Q
|
---|
| 14 | . ; If a document is an ID Entry, get its parent
|
---|
| 15 | . ; I +$G(^TIU(8925,TIUDA,21)) S TIUDA=+$G(^TIU(8925,TIUDA,21))
|
---|
| 16 | . ; Don't include entry in list more than once
|
---|
| 17 | . I +$O(@TIUY@("INDX",TIUDA,0)) Q
|
---|
| 18 | . ; Don't include entry in list if RETRACTED
|
---|
| 19 | . I $P($G(^TIU(8925,TIUDA,0)),U,5)=15 Q
|
---|
| 20 | . S @TIUY@(TIUI)=TIUDA_U_$$RESOLVE^TIUSRVLO(TIUDA)
|
---|
| 21 | . S @TIUY@("INDX",TIUDA,TIUI)=""
|
---|
| 22 | . I +$$HASDAD^TIUSRVLI(TIUDA) D SETDAD^TIUSRVLI(.TIUY,TIUDA,.TIUI)
|
---|
| 23 | . I +$$HASKIDS^TIUSRVLI(TIUDA) D SETKIDS^TIUSRVLI(.TIUY,TIUDA,.TIUI)
|
---|
| 24 | Q
|
---|