| 1 | SCUTIE1 ;ALB/SCK - INCOMPLETE ENCOUNTER MGMT API CALLS ; 6/17/97
|
|---|
| 2 | ;;5.3;Scheduling;**66**;AUG 13, 1993
|
|---|
| 3 | ;
|
|---|
| 4 | Q
|
|---|
| 5 | ;
|
|---|
| 6 | OPENC(SDXMT,SDARRAY) ; API to return whether Transmitted Outpatient Encounter File entry
|
|---|
| 7 | ; points to a deleted encounter.
|
|---|
| 8 | ;
|
|---|
| 9 | ; Input:
|
|---|
| 10 | ; SDXMT - IEN of the Transmitted Outpatient Encounter file entry
|
|---|
| 11 | ; SDARRAY - [optional] - if passed in (as "xxxx"), will return encounter information
|
|---|
| 12 | ; DFN, Clinic IEN, and Encounter date
|
|---|
| 13 | ;
|
|---|
| 14 | ; Return:
|
|---|
| 15 | ; 1 - if encounter is deleted
|
|---|
| 16 | ; 0 - if encounter is not deleted.
|
|---|
| 17 | ; -1 - if error condition
|
|---|
| 18 | ;
|
|---|
| 19 | ; If SDARRAY is passed in, returns:
|
|---|
| 20 | ; SDARRAY["DFN"] = DFN
|
|---|
| 21 | ; SDARRAY["CLINIC"] = Clinic IEN
|
|---|
| 22 | ; SDARRAY["ENCOUNTER"] = Encounter date
|
|---|
| 23 | ; SDARRAY["ERROR"] = Error Condition
|
|---|
| 24 | ; SDARRAY["DELIEN"] = Ien of Deleted Encounter
|
|---|
| 25 | ; SDARRAY["SDOIEN"] = Ien of OP Encounter
|
|---|
| 26 | ; SDARRAY["AE"] = 0 if Originating process is an appointment,
|
|---|
| 27 | ; 1 if not.
|
|---|
| 28 | ;
|
|---|
| 29 | N SDOK,NODE0,NODE1
|
|---|
| 30 | ;
|
|---|
| 31 | K @SDARRAY
|
|---|
| 32 | I +$G(SDXMT)=0 D G DELQ
|
|---|
| 33 | . S SDOK=-1
|
|---|
| 34 | . I $G(SDARRAY)]"" S @SDARRAY@("ERROR")="NULL XMT POINTER"
|
|---|
| 35 | ;
|
|---|
| 36 | I +$P($G(^SD(409.73,SDXMT,0)),U,2)>0,$D(^SCE(+$P(^SD(409.73,SDXMT,0),U,2))) D G DELQ
|
|---|
| 37 | . S SDOK=0
|
|---|
| 38 | . I $G(SDARRAY)]"" D
|
|---|
| 39 | .. K @SDARRAY
|
|---|
| 40 | .. S NODE0=$G(^SCE($P(^SD(409.73,SDXMT,0),U,2),0))
|
|---|
| 41 | .. S @SDARRAY@("DFN")=$P(NODE0,U,2)
|
|---|
| 42 | .. S @SDARRAY@("CLINIC")=$P(NODE0,U,4)
|
|---|
| 43 | .. S @SDARRAY@("ENCOUNTER")=$P(NODE0,U)
|
|---|
| 44 | .. S @SDARRAY@("SDOIEN")=$P(^SD(409.73,SDXMT,0),U,2)
|
|---|
| 45 | .. S @SDARRAY@("AE")=$S($P(NODE0,U,8)=1:0,1:1)
|
|---|
| 46 | ;
|
|---|
| 47 | I +$P($G(^SD(409.73,SDXMT,0)),U,3)>0,$D(^SD(409.74,+$P(^SD(409.73,SDXMT,0),U,3))) D G DELQ
|
|---|
| 48 | . S SDOK=1
|
|---|
| 49 | . I $G(SDARRAY)]"" D
|
|---|
| 50 | .. K @SDARRAY
|
|---|
| 51 | .. S NODE0=$G(^SD(409.74,$P(^SD(409.73,SDXMT,0),U,3),0))
|
|---|
| 52 | .. S NODE1=$G(^SD(409.74,$P(^SD(409.73,SDXMT,0),U,3),1))
|
|---|
| 53 | .. S @SDARRAY@("DFN")=$P(NODE0,U,2)
|
|---|
| 54 | .. S @SDARRAY@("CLINIC")=$P(NODE1,U,4)
|
|---|
| 55 | .. S @SDARRAY@("ENCOUNTER")=$P(NODE1,U)
|
|---|
| 56 | .. S @SDARRAY@("DELIEN")=$P(^SD(409.73,SDXMT,0),U,3)
|
|---|
| 57 | .. S @SDARRAY@("AE")=$S($P(NODE1,U,8)=1:0,1:1)
|
|---|
| 58 | ;
|
|---|
| 59 | S SDOK=-1
|
|---|
| 60 | I $G(SDARRAY)]"" S @SDARRAY@("ERROR")="No (Deleted) Outpatient Encounter entry found."
|
|---|
| 61 | DELQ Q SDOK
|
|---|