| 1 | SDVSIT2 ;ALB/RMO/MJK - Encounter Utilities;28 DEC 1992 10:00 am
|
|---|
| 2 | ;;5.3;Scheduling;**27,44,132**;08/13/93
|
|---|
| 3 | ;; ;
|
|---|
| 4 | ;
|
|---|
| 5 | GETAPT(DFN,SDT,SDCL,SDVIEN) ;Look-up Outpatient Encounter IEN for Appt
|
|---|
| 6 | ; Input -- DFN Patient file IEN
|
|---|
| 7 | ; SDT Appointment Date/Time
|
|---|
| 8 | ; SDCL Hospital Location file IEN for Appt
|
|---|
| 9 | ; SDVIEN Visit file pointer [optional]
|
|---|
| 10 | ; Output -- Outpatient Encounter file IEN
|
|---|
| 11 | N Y
|
|---|
| 12 | S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
|
|---|
| 13 | I 'Y D APPT^SDVSIT(DFN,SDT,SDCL,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
|
|---|
| 14 | IF Y D VIEN(Y,$G(SDVIEN))
|
|---|
| 15 | Q +$G(Y)
|
|---|
| 16 | ;
|
|---|
| 17 | GETAE(SDVIEN,SDATYPE,SDOPE) ;Look-up Outpatient Encounter IEN for add/edit
|
|---|
| 18 | ; Input -- SDVIEN Visit file pointer
|
|---|
| 19 | ; SDATYPE Appointment Type [optional]
|
|---|
| 20 | ; SDOEP Parent encounter ien [optional]
|
|---|
| 21 | ;
|
|---|
| 22 | ; Output -- Outpatient Encounter file IEN
|
|---|
| 23 | N Y
|
|---|
| 24 | S Y=+$O(^SCE("AVSIT",SDVIEN,0))
|
|---|
| 25 | I 'Y D AEUPD^SDVSIT(SDVIEN,$G(SDATYPE),$G(SDOPE)) S Y=+$O(^SCE("AVSIT",SDVIEN,0))
|
|---|
| 26 | IF Y D VIEN(Y,SDVIEN)
|
|---|
| 27 | Q +$G(Y)
|
|---|
| 28 | ;
|
|---|
| 29 | GETDISP(DFN,SDT,SDVIEN) ;Look-up Outpatient Encounter IEN for disposition
|
|---|
| 30 | ; Input -- DFN Patient file IEN
|
|---|
| 31 | ; SDT Disposition Date/Time
|
|---|
| 32 | ; SDVIEN Visit file pointer [optional]
|
|---|
| 33 | ; Output -- Outpatient Encounter file IEN
|
|---|
| 34 | N Y
|
|---|
| 35 | S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
|
|---|
| 36 | I 'Y D DISP^SDVSIT(DFN,SDT,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
|
|---|
| 37 | IF Y D VIEN(Y,$G(SDVIEN))
|
|---|
| 38 | Q +$G(Y)
|
|---|
| 39 | ;
|
|---|
| 40 | OKAE(SDOE) ; -- is add/edit ok for credit
|
|---|
| 41 | N Y,X S Y=1
|
|---|
| 42 | S X=$G(^SCE(SDOE,0))
|
|---|
| 43 | I $$REQ^SDM1A(+X)="CO",'$P(X,U,7) S Y=0
|
|---|
| 44 | Q Y
|
|---|
| 45 | ;
|
|---|
| 46 | VIEN(SDOE,SDVIEN) ; -- stuff in Visit IEN if not already set
|
|---|
| 47 | ; -- needed for those sites that don't have
|
|---|
| 48 | ; scheduling turned on in Visit Tracking
|
|---|
| 49 | ; Required input SDOE = Outpatient Encounter pointer
|
|---|
| 50 | ; SDVIEN = Visit file pointer or null or zero
|
|---|
| 51 | ;
|
|---|
| 52 | ; -- quit if no vien passed
|
|---|
| 53 | G VIENQ:'SDVIEN
|
|---|
| 54 | N Y,SDOE0
|
|---|
| 55 | S SDOE0=$G(^SCE(+SDOE,0))
|
|---|
| 56 | ; -- quit is no encounter
|
|---|
| 57 | G VIENQ:SDOE0=""
|
|---|
| 58 | ; -- set visit ien if vien not already set
|
|---|
| 59 | IF '$P(SDOE0,U,5) D
|
|---|
| 60 | . N DIE,DA,DR
|
|---|
| 61 | . S DIE="^SCE(",DA=SDOE,DR=".05////"_SDVIEN D ^DIE
|
|---|
| 62 | IF '$P(SDOE0,U,4) D
|
|---|
| 63 | . N DIE,DA,DR,SDLOC
|
|---|
| 64 | . S SDLOC=$P($G(^AUPNVSIT(SDVIEN,0)),U,22)
|
|---|
| 65 | . IF SDLOC S DIE="^SCE(",DA=SDOE,DR=".04////"_SDLOC D ^DIE
|
|---|
| 66 | VIENQ Q
|
|---|
| 67 | ;
|
|---|