source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCOFDP.m@ 1578

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1ONCOFDP ;Hines OIFO/GWB - FOLLOW DEAD PATIENTS ;07/12/00
2 ;;2.11;ONCOLOGY;**1,5,16,22,25,26,47**;Mar 07, 1995;Build 19
3DEAD ;Death information
4 K DXS,DIOT S D0=ONCOD0,DIR("A")=" Edit Data",DIR("B")="Y",DIR(0)="Y"
5 D ^ONCOXDI,^DIR G ED:Y,RC:'Y,EX
6 ;
7ED W !! S DA=ONCOD0,DR="[ONCO DEATH]",DIE="^ONCO(160," D ^DIE
8 W !! K DXS,DIOT D ^ONCOXDI
9 S DIR("A")=" Data OK",DIR("B")="Yes",DIR(0)="Y" D ^DIR G ED:'Y,RC:Y,EX
10 ;
11RC W !!,"First Recurrence Information..."
12 S XD1=0,UPOUT=""
13 F S XD1=$O(^ONCO(165.5,"C",ONCOD0,XD1)) Q:XD1'>0 D Q:UPOUT="Y"
14 .S ONCOX2=$G(^ONCO(165.5,XD1,2)),ONCOTOP=$P(ONCOX2,U,1)
15 .S TOP=$P($G(^ONCO(164,+ONCOTOP,0)),U,1)
16 .S SITEGP=$P(^ONCO(165.5,XD1,0),U,1)
17 .S ACCNO=$P(^ONCO(165.5,XD1,0),U,5),SEQNO=$P(^ONCO(165.5,XD1,0),U,6)
18 .W !!,"Primary: ",$E(ACCNO,1,4),"-",$E(ACCNO,5,9),"/",SEQNO," ",TOP,!
19 .S DIE="^ONCO(165.5,",DA=XD1,DR="71;D CHECK^ONCOFDP;70;@1" D ^DIE I $D(Y) S UPOUT="Y"
20 D CHKCHG^ONCOAIF
21 ;
22DC ;Delete Contacts
23 Q:'$D(^ONCO(160,"APC",ONCOD0))
24H W @IOF,!!!?15,"--------------DELETE PATIENT'S CONTACTS---------------"
25 S D0=ONCOD0 K DXS,DIOT D ^ONCOXCL
26 W !!?5,"Patient is dead - please delete contacts as soon as possible."
27 W !?5,"Deletion will affect this patient's contacts only.",!
28 S DIR("A")=" Delete Contacts",DIR(0)="Y",DIR("B")="Yes" D ^DIR,KC:Y
29 Q
30 ;
31KC ;Delete FOLLOW-UP CONTACT (160.03) sub-file and CONTACT (165) file
32 ;entries
33 D WAIT^DICD W !?5,"Deleting contacts..." D EN1 G EX
34EN1 S XDC=0 F S XDC=$O(^ONCO(160,"APC",ONCOD0,XDC)) Q:XDC'>0 S ONCOC0=XDC D I C=0 S DIK="^ONCO(165,",DA=ONCOC0 D ^DIK W "*"
35 .S C=0
36 .S XDP=0 F S XDP=$O(^ONCO(160,"ACP",ONCOC0,XDP)) Q:XDP'>0 I XDP'=ONCOD0 S C=1 Q
37 .I C=1 Q
38 .S XDP=0 F S XDP=$O(^ONCO(160,"AC",ONCOC0,XDP)) Q:XDP'>0 I XDP'=ONCOD0 S C=1 Q
39 .I C=1 Q
40 .S XDP=0 F S XDP=$O(^ONCO(160,"AE",ONCOC0,XDP)) Q:XDP'>0 I XDP'=ONCOD0 S C=1 Q
41 .I C=1 Q
42 .I $D(^ONCO(165.5,"APS",ONCOC0)) S C=1 Q
43 .I $D(^ONCO(165.5,"AFP",ONCOC0)) S C=1 Q
44 .I $D(^ONCO(165.5,"AMP",ONCOC0)) S C=1 Q
45 .I $D(^ONCO(165.5,"AOP3",ONCOC0)) S C=1 Q
46 .I $D(^ONCO(165.5,"AOP4",ONCOC0)) S C=1 Q
47 .I $D(^ONCO(165.5,"APST",ONCOC0)) S C=1 Q
48 ;Delete FOLLOW-UP CONTACT (160,420) sub-file (160.03)
49 S DA=0,DA(1)=ONCOD0 F S DA=$O(^ONCO(160,DA(1),"C",DA)) Q:DA'?1.N S DIK="^ONCO(160,"_DA(1)_",""C""," D ^DIK
50 I '$D(ONCODAC) S D0=ONCOD0 D ^ONCOXCL W ?35,"(None - Patient is Deceased)"
51 N ONCOC0 S ONCOC0=$P(^ONCO(160,ONCOD0,1),U,6) G KA:ONCOC0="",KA:$D(^ONCO(165,ONCOC0,0))
52CD S X="<CONTACT DELETED>",Y=$O(^ONCO(165,"B",X,0))
53 I Y="" S (DIC,DLAYGO)="^ONCO(165,",DIC(0)="ZL" D FILE^DICN
54 S OLDLFC=$P($G(^ONCO(160,ONCOD0,1)),U,6)
55 K:OLDLFC'="" ^ONCO(160,"AC",OLDLFC,ONCOD0)
56 S $P(^ONCO(160,ONCOD0,1),U,6)=+Y
57 S ^ONCO(160,"AC",+Y,ONCOD0)=""
58 K OLDLFC
59KA ;Delete FOLLOW-UP ATTEMPTS (160,410) sub-file (160.06)
60 W:'$D(ONCODAC) !!?5,"Deleting Follow-up Attempts..."
61 S XX=$P($G(^ONCO(160,ONCOD0,"A",0)),U,3) I XX'="" S DIK="^ONCO(160,"_DA(1)_",""A""," F DA=1:1:XX I $D(^(DA)) D ^DIK
62 F I="A","C" K ^ONCO(160,DA(1),I)
63 Q
64 ;
65DAC ;Delete dead patients's Contacts
66 W @IOF,"ARCHIVING of Contact File, Attempts and Contacts"
67 W !!?5,"For dead patients - clean out unnecessary data.",!!!
68 W ?5,"Working..."
69 S XD0=0 F S XD0=$O(^ONCO(160,"AS",0,XD0)) Q:XD0'>0 S ONCOD0=XD0,ONCODAC=1 D EN1 W:'(XD0#100) "."
70EX ;RETURN from calling program, ONCOAIF/ONCOFUL
71 K RC,RT,XD0,XX,XD1,XDC,I,DIK,DIC,XDP,ONCOD1
72 Q
73CHECK ;Check TYPE of FIRST RECURRENCE
74 ;If 99, stuff 99/99/9999 into DATE of FIRST RECURRENCE
75 ;If 00 or 70, stuff 00/00/0000 into DATE of FIRST RECURRENCE
76 S TOFR=$P($G(^ONCO(165.5,XD1,5)),U,2)
77 Q:TOFR=""
78 I $P($G(^ONCO(160.12,TOFR,0)),U,1)=99 D
79 .S $P(^ONCO(165.5,XD1,5),U,1)=9999999
80 .W !,"DATE of FIRST RECURRENCE: 99/99/9999//"
81 .S Y="@1"
82 I ($P($G(^ONCO(160.12,TOFR,0)),U,1)="00")!($P($G(^ONCO(160.12,TOFR,0)),U,1)=70) D
83 .S $P(^ONCO(165.5,XD1,5),U,1)="0000000"
84 .W !,"DATE of FIRST RECURRENCE: 00/00/0000//"
85 .S Y="@1"
Note: See TracBrowser for help on using the repository browser.