source: WorldVistAEHR/trunk/r/HOSPITAL_BASED_HOME_CARE-HBH/HBHCCAN.m@ 1211

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

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1HBHCCAN ; LR VAMC(IRMS)/MJT-HBHC batch job to flag deleted outpatient encounters as cancelled appointments in ^HBHC(632) (visit) Form 4 Transmit Status, field 7, & Cancelled Appointment, field 6, called from ^HBHCAPPT ;9803
2 ;;1.0;HOSPITAL BASED HOME CARE;**6,10**;NOV 01, 1993
3 ; Also deletes record from ^HBHC(634 (transmit) file IF Form 4 Transmit Status, field 7, = "F" (filed)
4START ; Initialization
5 S $P(HBHCSP1," ",2)="",$P(HBHCZRO4,"0",5)=""
6 ; HBHCBGDT set in ^HBHCAPPT
7 S HBHCAPDT=HBHCBGDT
8LOOP ; Loop thru ^HBHC(632) to flag visit nodes with cancelled appointments
9 F S HBHCAPDT=$O(^HBHC(632,"C",HBHCAPDT)) Q:(HBHCAPDT'>0)!(HBHCAPDT>HBHCLSDT) S HBHCDFN=0 F S HBHCDFN=$O(^HBHC(632,"C",HBHCAPDT,HBHCDFN)) Q:HBHCDFN'>0 D PROCESS
10EXIT ; Exit module
11 K DA,DIE,DIK,DR,HBHCAPDT,HBHCDATE,HBHCDFN,HBHCIEN,HBHCINFO,HBHCNOD0,HBHCPRV,HBHCREC,HBHCSP1,HBHCTIME,HBHCZRO4,X,Y,%DT
12 Q
13PROCESS ; Process outpatient encounters in SCE(409.68
14 S HBHCNOD0=^HBHC(632,HBHCDFN,0)
15 ; Cancelled appointment
16 Q:($P(HBHCNOD0,U,7)]"")!($P(HBHCNOD0,U,8)="C")
17 ; Set Cancelled Appointment (fld 6) & Form 4 Transmit Status (fld 7) to C (cancelled appointment) if outpatient encounter (OE) no longer exists, retaining obsolete data elements (e.g. OE, Dx, provider, CPT) for trouble-shooting purposes
18 I $G(^SCE($P(HBHCNOD0,U,22),0))="" D:$P(HBHCNOD0,U,8)="F" DELETE S DIE="^HBHC(632,",DA=HBHCDFN,DR="6///C;7///C" D ^DIE
19 Q
20DELETE ; Delete ^HBHC(634 file record
21 S HBHCTIME=$P(HBHCAPDT,".",2) S:$L(HBHCTIME)'=4 HBHCTIME=HBHCTIME_$E(HBHCZRO4,1,(4-($L(HBHCTIME))))
22 S HBHCDATE=$E(HBHCAPDT,4,5)_$E(HBHCAPDT,6,7)_(1700+$E(HBHCAPDT,1,3))_HBHCTIME
23 S HBHCPRV=+^HBHC(631.4,$P(HBHCNOD0,U,4),0) S:$L(HBHCPRV)'=4 HBHCPRV=HBHCPRV_HBHCSP1
24 S HBHCINFO=$P(^DPT($P(HBHCNOD0,U),0),U,9)_HBHCDATE_HBHCPRV
25 S HBHCIEN=0 F S HBHCIEN=$O(^HBHC(634,HBHCIEN)) Q:HBHCIEN'>0 S HBHCREC=$E(^HBHC(634,HBHCIEN,0),9,33) I HBHCINFO=HBHCREC K DIK S DIK="^HBHC(634,",DA=HBHCIEN D ^DIK
26 Q
Note: See TracBrowser for help on using the repository browser.