65 lines
3.2 KiB
Mathematica
65 lines
3.2 KiB
Mathematica
|
TIUVSIT1 ; SLC/JER - Visit look-up (cont'd) ;4/29/99@11:51:42 [1/18/05 9:22am]
|
||
|
;;1.0;TEXT INTEGRATION UTILITIES;**39,179,190,221**;Jun 20, 1997;Build 2
|
||
|
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
|
||
|
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
|