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

TIUVSIT1.m

Go to the documentation of this file.
TIUVSIT1 ; SLC/JER - Visit look-up (cont'd) ;31-Dec-2012 15:46;DU
 ;;1.0;TEXT INTEGRATION UTILITIES;**39,179,1007,190,221,1011**;Jun 20, 1997;Build 13
 ;IHS/MSC/MGH IHS appointment lookup added for mod after patch 179
NOTFOUND() ; Ask <U>NSCHEDULED or <F>UTURE
 N TIUY
 W !,"CHOOSE <U>NSCHEDULED VISITS, <F>UTURE VISITS, or <N>EW VISIT"
 W !,"<RETURN> TO CONTINUE"
 S TIUY=$$READ^TIUU("FOA","OR '^' TO QUIT: ","","^D HELP^TIUVSITH(""?"")")
 Q TIUY
GETAPPT(DFN,CLINIC,OCCLIM,INDEX,COUNT,LAST,EARLY,FUTURE) ; Get list
 ; of appointments
 D GETAPPT^BTIUVSIT(DFN,$G(CLINIC),$G(OCCLIM),$G(INDEX),$G(COUNT),$G(LAST),$G(EARLY)) Q  ;IHS/ITSC/LJF 02/27/2003
 N TIUCNT,TIUI,TIUSREC,TIUJ,TIUFLIM,TIUARRAY,LATE,TIUK,TIUNUM
 I '$D(TIUPRM0) D SETPARM^TIULE
 S TIUFLIM=$S(+$P(TIUPRM0,U,14)>0&+$G(FUTURE):$P(TIUPRM0,U,14),1:1)
 S OCCLIM=$S(+$G(OCCLIM):+$G(OCCLIM),1:20)
 S:'+$G(DT) DT=$$DT^XLFDT
 S EARLY=+$G(EARLY)
 S LATE=$S(+$G(INDEX):+$G(INDEX),1:$$FMADD^XLFDT(DT,TIUFLIM)_"."_235959)
 S (LAST,TIUCNT,TIUK)=0,TIUJ=$S(+$G(COUNT):+$G(COUNT),1:0)
 S TIUARRAY(1)=EARLY_";"_LATE
 I $G(EARLY)=0 S TIUARRAY(1)=";"_LATE
 S TIUARRAY(4)=DFN
 S TIUARRAY("SORT")="P"
 S TIUARRAY("FLDS")="1;2;3;10;12;22"
 S TIUNUM=$$SDAPI^SDAMA301(.TIUARRAY) Q:'TIUNUM
 S TIUI=LATE+.000001
 I TIUNUM=-1 D  Q
 . S ^TMP("TIUVERR",$J)="Could not retrieve patient information due to a problem with the database."
 . I $D(^TMP($J,"SDAMA301",115)) S ^TMP("TIUVERR",$J,115)="This patient may not have an assigned ICN."
 ;VMP/ELR ADDED NEXT LINE PATCH TIU 1 221   DBIA 3356 FOR XQY0
 I $G(TIUNUM)>1,$G(XQY0)["TIU UPLOAD DOCUMENTS" N TIUONEC S TIUONEC=$$CLCNT()
 F  S TIUI=$O(^TMP($J,"SDAMA301",DFN,TIUI),-1) S:+TIUI'>0 LAST=1 Q:+TIUI'>0!(+TIUCNT'<OCCLIM)!(+TIUI<EARLY)  D
 . N APPTDT,APPTCL,APPTST,APPTTY,OPENC,STATUS
 . ;VMP/ELR ADDED NEXT LINE PATCH TIU 1 221
 . I $G(XQY0)["TIU UPLOAD DOCUMENTS",$G(TIUNUM)>1,$G(TIUONEC)>1,$L(TIUVDT),TIUVDT'=TIUI Q
 . S TIUCNT=+$G(TIUCNT)+1,TIUJ=+$G(TIUJ)+1
 . S APPTCL=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,2)
 . S APPTST=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,3)
 . S APPTTY=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,10)
 . S OPENC=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,12)
 . S STATUS=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,22)
 . I +$G(CLINIC),(+APPTCL'=+CLINIC) Q
 . ;Set up internal value array
 . S ^TMP("TIUVNI",$J,TIUJ)=TIUI_U_+APPTCL
 . I $P(APPTST,";")="R" S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U
 . I $P(APPTST,";")'="R" S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_$P(APPTST,";")
 . S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_+APPTTY
 . S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_$G(OPENC)
 . ;Set up external value array
 . S ^TMP("TIUVN",$J,TIUJ)=$$DATE^TIULS(TIUI,"AMTH DD, CCYY@HR:MIN")
 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(APPTCL,";",2)
 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(STATUS,";",3)
 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(APPTTY,";",2)
 . ;Set up index by date
 . S ^TMP("TIUVDT",$J,TIUI)=TIUJ
 . ;Set up array of appts to exclude dup visit creation if appt is for today
 . I $P(APPTST,";")="R" S ^TMP("TIUNOT",$J,+$P($G(^TMP($J,"SDAMA301",DFN,TIUI)),U,2),+TIUI)=TIUJ
 K ^TMP($J,"SDAMA301")
 Q
 ;VMP/ELR ADDED NEXT TAG PATCH TIU 1 221
CLCNT() ;
 N TIUICL,TIUCNT S TIUICL=TIUI,TIUCNT=0
 F  S TIUICL=$O(^TMP($J,"SDAMA301",DFN,TIUICL),-1)  Q:+TIUICL'>0!(+TIUICL<EARLY)  D
 . I +$P(^TMP($J,"SDAMA301",DFN,TIUICL),U,2)=$G(CLINIC) S TIUCNT=TIUCNT+1
 Q TIUCNT