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

TIUSRVLV.m

Go to the documentation of this file.
  1. TIUSRVLV ; SLC/JER - Server fns for lists by Visit ;Jan 26, 2024@07:19
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**7,47,100,362**;Jun 20, 1997;Build 3
  1. ;
  1. ; Reference to ^AUPNVSIT( in ICR #2028
  1. ; Reference to FINDVISIT^PXUTLVST in ICR #7435
  1. ;
  1. Q
  1. NOTES(TIUY,VISIT,STATUS) ; Gets list of Notes
  1. I $S(+$G(VISIT)'>0:1,'$D(^AUPNVSIT(+$G(VISIT),0)):1,1:0) Q
  1. D LIST(.TIUY,VISIT,3,$G(STATUS))
  1. Q
  1. SUMMARY(TIUY,VISIT,STATUS) ; Gets list of Summaries
  1. I $S(+$G(VISIT)'>0:1,'$D(^AUPNVSIT(+$G(VISIT),0)):1,1:0) Q
  1. D LIST(.TIUY,VISIT,244,$G(STATUS))
  1. Q
  1. LIST(TIUY,VISIT,CLASS,STATUS) ; Get documents for a visit
  1. N TIUDA,TIUTTL,TIUCCLS,TIUCCPN S TIUDA=0
  1. K ^TMP("TIULIST",$J) S TIUY=$NA(^TMP("TIULIST",$J))
  1. S TIUCCLS=+$$CLASS^TIUCNSLT,TIUCCPN=+$$ISA^TIULX(TIUCCLS,3)
  1. I $S(+$G(VISIT)'>0:1,'$D(^AUPNVSIT(+VISIT)):1,+$G(CLASS)'>0:1,1:0) Q
  1. F S TIUDA=$O(^TIU(8925,"V",VISIT,TIUDA)) Q:+TIUDA'>0 D
  1. . N TIUTTL,TIUI,TIUD0,TIUSTS S TIUI=0,TIUD0=$G(^TIU(8925,+TIUDA,0))
  1. . Q:+$P(TIUD0,U,6)
  1. . S TIUTTL=+TIUD0,TIUSTS=$P(TIUD0,U,5) Q:+TIUTTL'>0
  1. . I +$G(STATUS),(TIUSTS'=STATUS) Q
  1. . I +$$ISA^TIULX(TIUTTL,CLASS) D ADDELMNT(TIUDA,TIUI) I 1
  1. . E I CLASS=3,'TIUCCPN,+$$ISA^TIULX(TIUTTL,TIUCCLS) D ADDELMNT(TIUDA,TIUI)
  1. K ^TMP("TIULIST",$J,"INDX")
  1. Q
  1. ADDELMNT(DA,TIUCNT) ; Add each element to the list
  1. N DOC,LOC,PT,AUT,EDT,TIUPT,TIULST4,TIUREC,TIUR0,TIUR12,TIUR13
  1. N STATUS,EDTCNT,LOCTYP,TIUADT,TIUDDT
  1. S TIUR0=$G(^TIU(8925,+DA,0)),TIUR12=$G(^TIU(8925,+DA,12))
  1. S TIUR13=$G(^TIU(8925,+DA,13))
  1. ; If doc is an ID Child, return it's parent
  1. I +$G(^TIU(8925,DA,21)) S DA=+$G(^TIU(8925,DA,21))
  1. ; Don't return duplicates
  1. I +$O(^TMP("TIULIST",$J,"INDX",DA,0)) Q
  1. S TIUPT=$G(^DPT(+$P(TIUR0,U,2),0)),DOC=$$PNAME^TIULC1(+TIUR0)
  1. I DOC="Addendum" S DOC=DOC_" to "_$$PNAME^TIULC1(+$G(^TIU(8925,+$P(TIUR0,U,6),0)))
  1. S STATUS=$$LOWER^TIULS($P(^TIU(8925.6,+$P(TIUR0,U,5),0),U))
  1. S LOC=$G(^SC(+$P(TIUR12,U,5),0)),LOCTYP=$P(LOC,U,3),LOC=$P(LOC,U)
  1. S TIUADT=$S(LOCTYP="W":"Adm: ",1:"Visit: ")_$$DATE^TIULS($P(TIUR0,U,7),"MM/DD/YY")
  1. S TIUDDT=$S(+$P(TIUR0,U,8):"Dis: ",1:"")_$$DATE^TIULS($P(TIUR0,U,8),"MM/DD/YY")
  1. S PT=$$NAME^TIULS($P(TIUPT,U),"LAST, FIRST MI")
  1. S TIULST4=$E($P(TIUPT,U,9),6,9)
  1. S TIULST4="("_$E(PT)_TIULST4_")"
  1. S AUT=$$SIGNAME^TIULS(+$P(TIUR12,U,2))
  1. S EDT=+TIUR13,EDTCNT=+$G(EDTCNT)+1
  1. F Q:+$D(^TMP("TIULIST",$J,9999999-EDT,EDTCNT))'>0 S EDTCNT=EDTCNT+1
  1. S TIUCNT=+$G(TIUCNT)+1
  1. S TIUREC=DA_U_DOC_U_EDT_U_PT_" "_TIULST4_U_AUT_U_LOC_U_STATUS_U_TIUADT_U_TIUDDT
  1. S ^TMP("TIULIST",$J,9999999-EDT,EDTCNT)=TIUREC
  1. S ^TMP("TIULIST",$J,"INDX",DA,EDTCNT)=""
  1. Q
  1. DOCCNT(TIUY,DFN,VSTR,VSIT,CNTSCND) ; Get # of Documents for a given visit
  1. ;
  1. ; DFN = Patient IEN (#2)
  1. ; VSTR = Visit String
  1. ; VSIT = Visit IEN (#9000010)
  1. ; CNTSCND = Count also documents that reference the Visit via the SECONDARY VISIT field.
  1. ; (Possible values: 1/0; Optional; Defaults to 0)
  1. ;
  1. ; Must either pass in VSIT, or must pass in the DFN and VSTR.
  1. ; It is best to pass in VSIT. DFN and VSTR are only included for backward compatability.
  1. ;
  1. N VISITLIST,NOTEINDEX,TIUNOTE,TIUVST
  1. ;
  1. S TIUY=0
  1. I '$G(VSIT),('$G(DFN)!($G(VSTR)="")) Q
  1. ;
  1. I '$G(VSIT) D
  1. . D FINDVISIT^PXUTLVST(DFN,$P(VSTR,";",2),$P(VSTR,";"),"","","",$P(VSTR,";",3),"",1,.VISITLIST)
  1. . I $G(VISITLIST(0))=1 S VSIT=$G(VISITLIST(1))
  1. ;
  1. I +$G(VSIT) D
  1. . S TIUNOTE=0
  1. . F S TIUNOTE=$O(^TIU(8925,"V",+VSIT,TIUNOTE)) Q:TIUNOTE'>0 D
  1. . . S TIUY=TIUY+1
  1. . . S NOTEINDEX(TIUNOTE)=""
  1. ;
  1. I '$G(VSIT) D
  1. . S TIUVST=0
  1. . F S TIUVST=$O(^TIU(8925,"AVSTRV",DFN,VSTR,TIUVST)) Q:TIUVST'>0 D
  1. . . S TIUNOTE=0
  1. . . F S TIUNOTE=$O(^TIU(8925,"AVSTRV",DFN,VSTR,TIUVST,TIUNOTE)) Q:TIUNOTE'>0 D
  1. . . . S TIUY=TIUY+1
  1. . . . S NOTEINDEX(TIUNOTE)=""
  1. ;
  1. I $G(CNTSCND)'=1 Q
  1. I '$G(VSIT) Q
  1. ;
  1. S TIUNOTE=0
  1. F S TIUNOTE=$O(^TIU(8925,"VS",VSIT,TIUNOTE)) Q:TIUNOTE'>0 D
  1. . I $D(NOTEINDEX(TIUNOTE)) Q
  1. . S TIUY=TIUY+1
  1. ;
  1. Q