source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCCVCST2.m@ 1147

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

initial load of WorldVistAEHR

File size: 2.6 KB
Line 
1SCCVCST2 ; ALB/TMP - SCHED VSTS RE-CONVERSION - DELETE ENCOUNTER; 25-NOV-97
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4DELE(SDOE) ;Delete Encounter on re-convert
5 ; Input -- SDOE Outpatient Encounter file IEN
6 ;
7 N DA,DFN,DE,DIE,DR,SDCL,SDDA,SDOE0,SDOEP,SDORG,SDT,SDVSAV,SDCNV
8 ;
9 D SET(SDOE,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA,.SDCNV)
10 ;
11 ; Only delete encounter if created originally from conversion
12 G:'SDCNV DELEQ
13 ;
14 D DELPTR(DFN,SDT,SDDA,SDORG,SDOE)
15 ;
16 ; -- delete child data for appts and dispos
17 I "^1^3^"[("^"_SDORG_"^") D CHLD(SDOE)
18 ;
19 D OE(SDOE)
20 ;
21DELEQ Q
22 ;
23CHLD(SDOEP) ;Delete child encounters
24 ; SDOEP := Parent encounter ien
25 ;
26 N DFN,SDCL,SDDA,SDOE0,SDOEC,SDORG,SDT,SDCNV
27 S SDOEC=0
28 F S SDOEC=$O(^SCE("APAR",SDOEP,SDOEC)) Q:'SDOEC D
29 . D SET(SDOEC,.SDOE0,.SDT,.DFN,.SDCL,.SDORG,.SDDA,.SDCNV)
30 . Q:'SDCNV ;Only delete encounter if created by the conversion
31 . D DELPTR(DFN,SDT,SDDA,SDORG,SDOEC)
32 . D OE(SDOEC)
33 Q
34 ;
35SET(SDOE,SDOE0,SDT,DFN,SDCL,SDORG,SDDA,SDCNV) ;Set Variables
36 ;
37 S SDOE0=$G(^SCE(+SDOE,0)),SDT=+SDOE0,DFN=+$P(SDOE0,"^",2),SDCL=+$P(SDOE0,"^",4),SDORG=+$P(SDOE0,"^",8),SDDA=$P(SDOE0,"^",9)
38 S SDCNV=$G(^SCE(+SDOE,"CNV"))
39 Q
40 ;
41DELPTR(DFN,SDT,SDDA,SDORG,SDOE) ; -- delete pointers to encounters in scheduling files
42 ; DFN == patient ien
43 ; SDT == encounter date/time
44 ; SDDA == extended reference from encounter 9th piece
45 ; SDORG == flag for origin of encounter
46 ; SDOE == encounter ien
47 ;
48 N DA,DIE,DR,SDI,SDCS,SDVIEN
49 IF SDORG=1,$P($G(^DPT(DFN,"S",SDT,0)),U,20)=SDOE D Q
50 .S DA(1)=DFN,DA=SDT,DIE="^DPT("_DFN_",""S"",",DR="21///@" D ^DIE
51 ;
52 S SDVIEN=$$SDVIEN^SCCVU(DFN,SDT)
53 IF SDORG=2 F SDI=1:1:$L(SDDA,":") D Q
54 . S SDCS=+$P(SDDA,":",SDI)
55 . IF SDCS,$P($G(^SDV(SDVIEN,"CS",SDCS,0)),U,8)=SDOE D
56 . . S DA(1)=SDT,DA=SDCS,DIE="^SDV("_SDVIEN_",""CS"",",DR="8///@" D ^DIE
57 ;
58 IF SDORG=3,$P($G(^DPT(DFN,"DIS",+SDDA,0)),U,18)=SDOE D Q
59 .S DA(1)=DFN,DA=+SDDA,DIE="^DPT("_DFN_",""DIS"",",DR="18///@" D ^DIE
60 ;
61 Q
62 ;
63OE(SDOE) ;Delete Outpatient Encounter
64 ; SDOE := Encounter ien
65 ;
66 N DA,DIK
67 S DA=SDOE,DIK="^SCE(" D ^DIK
68 Q
69 ;
70DEL(SDOE,SDFL) ;Delete Classification - NOT NEEDED - no data existed for the
71 ; periods allowed to be converted
72 ; SDOE := Encounter ien
73 ; SDFL := Internal file # of entry to delete
74 ;
75 Q
76 N DA,DIK,SDI
77 S DIK="^SDD("_SDFL_",",SDI=0
78 F S SDI=$O(^SDD(SDFL,"AO",SDOE,SDI)) Q:'SDI S DA=+$O(^(SDI,0)) D ^DIK
79 Q
80 ;
81CO(SDOE) ;Delete Classification - NOT NEEDED - no data existed for the
82 ; periods allowed to be converted
83 ; SDOE := Encounter ien
84 ;
85 G COQ
86 N DA,DIK,SDFL,SDI
87 I $P($G(^SCE(SDOE,0)),"^",6) G COQ
88 I $O(^SDD(409.42,"AO",SDOE,0))>0 D DEL(SDOE,409.42)
89COQ Q
90 ;
Note: See TracBrowser for help on using the repository browser.