source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDCOM.m@ 1005

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1SDCOM ;ALB/RMO - Process Completion - Check Out ;12 MAR 1993 11:10 am ; 1/19/07 1:37pm
2 ;;5.3;Scheduling;**15,60,105,132,466,495**;Aug 13, 1993;Build 50
3 ;
4EN(SDOE,SDMOD,SDCPHDL,SDCOMF) ;Complete Check Out Process
5 ; Input -- SDOE Outpatient Encounter file IEN
6 ; SDMOD 1=Interactive and 0=Non-interactive
7 ; SDCPHDL Check Out Completion Handle [Optional]
8 ; Output -- SDCOMF 0=Incomplete, 1=Complete, 2=Already Complete
9 N SDEVTF
10 I $P($G(^SCE(+SDOE,0)),"^",7) S SDCOMF=2 G Q
11 I '$$CHK(SDOE) S SDCOMF=0 W:$G(SDMOD) !!,*7,">>> ",$$ORG^SDCOU($P($G(^SCE(+SDOE,0)),"^",8))," not checked out. Required information missing." G Q
12 I '$G(SDCPHDL) N SDATA,SDCPHDL S SDEVTF=1 D EVT^SDCOU1(SDOE,"BEFORE",.SDCPHDL,.SDATA)
13 D UPD(SDOE) S SDCOMF=1 I $G(SDMOD) D MSG
14 I $G(SDEVTF),$G(SDCPHDL) D EVT^SDCOU1(SDOE,"AFTER",SDCPHDL,.SDATA)
15Q Q
16 ;
17CHK(SDOE) ;Check if Process is Complete for Check Out
18 ; Input -- SDOE Outpatient Encounter file IEN
19 ; Output -- Process is Complete for Check Out
20 ; 1=Yes and 0=No
21 N DFN,SDCHK,SDCL,SDCLOEY,SDCOQUIT,SDCTI,SDDA,SDOE0,SDOEP,SDORG,SDSCDI,SDT,SCPROCA
22 S SDOE0=$G(^SCE(+SDOE,0)),SDT=+SDOE0,DFN=+$P(SDOE0,"^",2),SDSCDI=$P(SDOE0,"^",3),SDCL=+$P(SDOE0,"^",4),SDOEP=+$P(SDOE0,"^",6),SDORG=+$P(SDOE0,"^",8),SDDA=+$P(SDOE0,"^",9)
23 S SDCHK=1
24 I SDOEP S SDCHK=0 G CHKQ
25 I SDORG=1,'$$CODT^SDCOU(DFN,SDT,SDCL) D G CHKQ:'SDCHK
26 .I $$REQ^SDM1A(SDT)="CO" S SDCHK=0 Q
27 .D DT^SDCO1(DFN,SDT,SDCL,SDDA,0,"",.SDCOQUIT)
28 I $$REQ^SDM1A(SDT)'="CO" G CHKQ
29 I SDORG=1,'$$CLINIC^SDAMU(SDCL) G CHKQ
30 ;I "^1^2^"[("^"_SDORG_"^"),$$INP^SDAM2(DFN,SDT)="I" G CHKQ ;SD*5.3*466 allow checks for inpatients as outpatients
31 D CLASK^SDCO2(SDOE,.SDCLOEY)
32 I $D(SDCLOEY) D G CHKQ:'SDCHK
33 .S SDCTI=0 F S SDCTI=$O(SDCLOEY(SDCTI)) Q:'SDCTI I $G(SDCLOEY(SDCTI))="" S SDCHK=0
34 ;sent encounter to ASCD for review
35 I $D(SDCLOEY(3)) D
36 .N SCDXS,SCAMDX,DXS D GETDX^SDOE(SDOE,"SCDXS")
37 .S DXS=0 F S DXS=$O(SCDXS(DXS)) Q:'DXS S SCAMDX(+SCDXS(DXS))=""
38 .I $O(SCAMDX(0)) D ST^SDSCAPI(SDOE,.SCAMDX)
39 I $$PRASK^SDCO3(SDOE),'$$PRV^SDOE(SDOE) S SDCHK=0 G CHKQ
40 I $$DXASK^SDCO4(SDOE),'$$GETPDX^SDOE(SDOE) S SDCHK=0 G CHKQ
41 I '$$CPT^SDOE(SDOE) S SDCHK=0 G CHKQ
42CHKQ Q +$G(SDCHK)
43 ;
44UPD(SDOE) ;Update Check Out Process Completion Date
45 ; Input -- SDOE Outpatient Encounter file IEN
46 ; Output -- Update Check Out Process Completion Date
47 N DA,DE,DIE,DQ,DR
48 G UPDQ:'$D(^SCE(+SDOE,0))
49 S DA=+SDOE,DIE="^SCE(",DR=".07///NOW"
50 D ^DIE
51UPDQ Q
52 ;
53MSG ;Check Out Message
54 W !!?8,"...checked out ",$$FTIME^VALM1($P($G(^SCE(+SDOE,0)),"^",7))
55 Q
Note: See TracBrowser for help on using the repository browser.