source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUVSIT1.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1TIUVSIT1 ; SLC/JER - Visit look-up (cont'd) ;4/29/99@11:51:42 [1/18/05 9:22am]
2 ;;1.0;TEXT INTEGRATION UTILITIES;**39,179,190,221**;Jun 20, 1997;Build 2
3NOTFOUND() ; Ask <U>NSCHEDULED or <F>UTURE
4 N TIUY
5 W !,"CHOOSE <U>NSCHEDULED VISITS, <F>UTURE VISITS, or <N>EW VISIT"
6 W !,"<RETURN> TO CONTINUE"
7 S TIUY=$$READ^TIUU("FOA","OR '^' TO QUIT: ","","^D HELP^TIUVSITH(""?"")")
8 Q TIUY
9GETAPPT(DFN,CLINIC,OCCLIM,INDEX,COUNT,LAST,EARLY,FUTURE) ; Get list
10 ; of appointments
11 N TIUCNT,TIUI,TIUSREC,TIUJ,TIUFLIM,TIUARRAY,LATE,TIUK,TIUNUM
12 I '$D(TIUPRM0) D SETPARM^TIULE
13 S TIUFLIM=$S(+$P(TIUPRM0,U,14)>0&+$G(FUTURE):$P(TIUPRM0,U,14),1:1)
14 S OCCLIM=$S(+$G(OCCLIM):+$G(OCCLIM),1:20)
15 S:'+$G(DT) DT=$$DT^XLFDT
16 S EARLY=+$G(EARLY)
17 S LATE=$S(+$G(INDEX):+$G(INDEX),1:$$FMADD^XLFDT(DT,TIUFLIM)_"."_235959)
18 S (LAST,TIUCNT,TIUK)=0,TIUJ=$S(+$G(COUNT):+$G(COUNT),1:0)
19 S TIUARRAY(1)=EARLY_";"_LATE
20 I $G(EARLY)=0 S TIUARRAY(1)=";"_LATE
21 S TIUARRAY(4)=DFN
22 S TIUARRAY("SORT")="P"
23 S TIUARRAY("FLDS")="1;2;3;10;12;22"
24 S TIUNUM=$$SDAPI^SDAMA301(.TIUARRAY) Q:'TIUNUM
25 S TIUI=LATE+.000001
26 I TIUNUM=-1 D Q
27 . S ^TMP("TIUVERR",$J)="Could not retrieve patient information due to a problem with the database."
28 . I $D(^TMP($J,"SDAMA301",115)) S ^TMP("TIUVERR",$J,115)="This patient may not have an assigned ICN."
29 ;VMP/ELR ADDED NEXT LINE PATCH TIU 1 221 DBIA 3356 FOR XQY0
30 I $G(TIUNUM)>1,$G(XQY0)["TIU UPLOAD DOCUMENTS" N TIUONEC S TIUONEC=$$CLCNT()
31 F S TIUI=$O(^TMP($J,"SDAMA301",DFN,TIUI),-1) S:+TIUI'>0 LAST=1 Q:+TIUI'>0!(+TIUCNT'<OCCLIM)!(+TIUI<EARLY) D
32 . N APPTDT,APPTCL,APPTST,APPTTY,OPENC,STATUS
33 . ;VMP/ELR ADDED NEXT LINE PATCH TIU 1 221
34 . I $G(XQY0)["TIU UPLOAD DOCUMENTS",$G(TIUNUM)>1,$G(TIUONEC)>1,$L(TIUVDT),TIUVDT'=TIUI Q
35 . S TIUCNT=+$G(TIUCNT)+1,TIUJ=+$G(TIUJ)+1
36 . S APPTCL=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,2)
37 . S APPTST=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,3)
38 . S APPTTY=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,10)
39 . S OPENC=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,12)
40 . S STATUS=$P(^TMP($J,"SDAMA301",DFN,TIUI),U,22)
41 . I +$G(CLINIC),(+APPTCL'=+CLINIC) Q
42 . ;Set up internal value array
43 . S ^TMP("TIUVNI",$J,TIUJ)=TIUI_U_+APPTCL
44 . I $P(APPTST,";")="R" S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U
45 . I $P(APPTST,";")'="R" S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_$P(APPTST,";")
46 . S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_+APPTTY
47 . S ^TMP("TIUVNI",$J,TIUJ)=^TMP("TIUVNI",$J,TIUJ)_U_$G(OPENC)
48 . ;Set up external value array
49 . S ^TMP("TIUVN",$J,TIUJ)=$$DATE^TIULS(TIUI,"AMTH DD, CCYY@HR:MIN")
50 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(APPTCL,";",2)
51 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(STATUS,";",3)
52 . S ^TMP("TIUVN",$J,TIUJ)=^TMP("TIUVN",$J,TIUJ)_U_$P(APPTTY,";",2)
53 . ;Set up index by date
54 . S ^TMP("TIUVDT",$J,TIUI)=TIUJ
55 . ;Set up array of appts to exclude dup visit creation if appt is for today
56 . I $P(APPTST,";")="R" S ^TMP("TIUNOT",$J,+$P($G(^TMP($J,"SDAMA301",DFN,TIUI)),U,2),+TIUI)=TIUJ
57 K ^TMP($J,"SDAMA301")
58 Q
59 ;VMP/ELR ADDED NEXT TAG PATCH TIU 1 221
60CLCNT() ;
61 N TIUICL,TIUCNT S TIUICL=TIUI,TIUCNT=0
62 F S TIUICL=$O(^TMP($J,"SDAMA301",DFN,TIUICL),-1) Q:+TIUICL'>0!(+TIUICL<EARLY) D
63 . I +$P(^TMP($J,"SDAMA301",DFN,TIUICL),U,2)=$G(CLINIC) S TIUCNT=TIUCNT+1
64 Q TIUCNT
Note: See TracBrowser for help on using the repository browser.