source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XDRRMRG1.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: 8.3 KB
Line 
1XDRRMRG1 ;SF-IRMFO.SEA/JLI - DUP VERIFICATION FOR ANCILLARY SERVICES ;08/09/2000 11:12
2 ;;7.3;TOOLKIT;**23,29,46,47,49**;Apr 25, 1995
3 ;
4EN ;
5 I '$D(XQADATA) Q
6 N OVERWRIT,XDRDA,DFNFR,DFNTO,DFNFRX,DFNTOX,REVIEW,XDRGL,PRIFILE ; MODIFIED 03/28/00
7 S REVIEW=0
8 S XDRGL=$P($P($G(^VA(15,+XQADATA,0)),U),";",2) Q:XDRGL="" S XDRGL=U_XDRGL S PRIFILE=+$P(@(XDRGL_"0)"),U,2) ; MODIFIED 03/28/00
9 S XDRDA=$P(XQADATA,U)
10 S DFNFR=$P(XQADATA,U,2)
11 S (DFNTOX,DFNTO)=$P(DFNFR,";",2)
12 S (DFNFRX,DFNFR)=$P(DFNFR,";")
13 S PACKAGE=$P(XQADATA,U,3)
14 S SUBFILES=$P(XQADATA,U,5)
15 S SUBNAMES=$P(XQADATA,U,6)
16 S XDRFILE=$P(XQADATA,U,4)
17 S FILEDIC=^DIC(XDRFILE,0,"GL")_"DFN)"
18 I XDRGL="^DPT(" D
19 . S DFN=DFNFR D ^VADPT M DFNFR=VADM K VA,VADM
20 . S DFN=DFNTO D ^VADPT M DFNTO=VADM K VA,VADM
21 I XDRFILE=63 D
22 . S DFNFR=$G(^DPT(DFNFR,"LR"))
23 . S DFNTO=$G(^DPT(DFNTO,"LR"))
24 I DFNFR'>0!(DFNTO'>0) W !,$C(7),"NO DATA TO REVIEW....",!! Q
25LDATE F XDRI=1,2 S DFN=$S(XDRI=1:DFNFR,1:DFNTO) S DFNNAM=$S(XDRI=1:"DFNFR",1:"DFNTO") D
26 . S I=5 F S I=$O(@DFNNAM@(I)) Q:I="" K @DFNNAM@(I)
27 . F ISUBS=1:1 S SUBSCR=$P(SUBFILES,";",ISUBS) Q:SUBSCR="" D
28 . . S XX=$G(^DD(XDRFILE,SUBSCR,0))
29 . . I $P(XX,U,2)'["D" Q
30 . . I $P($P(XX,U,4),";",2)'=0 Q
31 . . S SUBSCR=$P($P(XX,U,4),";")
32 . . N XDAT1 S XDAT1=0
33 . . I DFN>0 F I=0:0 S I=$O(@FILEDIC@(SUBSCR,I)) Q:I'>0 D
34 . . . S X=$P($G(@FILEDIC@(SUBSCR,I,0)),U)
35 . . . I X<DT,X>XDAT1 S XDAT1=X
36 . . S LASTNAM="LAST "_$P(SUBNAMES,";",ISUBS)
37 . . S @DFNNAM@(LASTNAM)=""
38 . . I XDAT1>0 S @DFNNAM@(LASTNAM)=$$FMTE^XLFDT(XDAT1\1)
39 . I @DFNNAM'="",'$D(@FILEDIC) S @DFNNAM=""
40 D SHOW
41 S:XDRFILE'=63 DFNFR=DFNFRX,DFNTO=DFNTOX ;REM - LAB is handled differently
42 I IOST'["C-" Q
43 D CHK
44 Q
45 ;
46SHOW ;
47 N NAMIEN1,NAMIEN2
48 S N1=$$COUNT^XDRRMRG2(XDRFILE,DFNFRX,DFNTOX)
49 W @IOF I N1>0,PACKAGE="PRIMARY" W !," RECORD"_N1_" contains fewer data elements, usually this would indicate",!," that this record would be merged INTO the other."
50 ;S LABEL(1)="NAME",LABEL(2)="SSN",LABEL(3)="BIRTH DATE"
51 ;S LABEL(4)="AGE",LABEL(5)="SEX",LABEL("LASTDAT")="LAST DATE"
52 W !!,"Determine if these entries ARE or ARE NOT duplicates."
53 W !
54 ;REM - Modified next three lines to include IENs by patient name.
55 I XDRFILE=63 S NAMIEN1=$$LABIEN^XDRRMRG2(XDRFILE,DFNFR),NAMIEN2=$$LABIEN^XDRRMRG2(XDRFILE,DFNTO)
56 ;W !,?20,$S(PACKAGE="PRIMARY":"RECORD1 [#"_DFNFR_"]",PACKAGE="LABORATORY":"MERGE FROM [#"_NAMIEN1_"]",1:"MERGE FROM [#"_DFNFR_"]")
57 ;W ?45,$S(PACKAGE="PRIMARY":"RECORD2 [#"_DFNTO_"]",PACKAGE="LABORATORY":"MERGE TO [#"_NAMIEN2_"]",1:"MERGE TO [#"_DFNTO_"]")
58 ;S I="" F S I=$O(DFNFR(I)) Q:I="" D
59 ;. I DFNFR(I)=""&(DFNTO(I)="") Q
60 ;. S DFNFR(I)=$S($P(DFNFR(I),U,2)'="":$P(DFNFR(I),U,2),1:$P(DFNFR(I),U))
61 ;. S DFNTO(I)=$S($P(DFNTO(I),U,2)'="":$P(DFNTO(I),U,2),1:$P(DFNTO(I),U))
62 ;. W !,$S($D(LABEL(I)):LABEL(I),1:I),?20,$E(DFNFR(I),1,20),?45,$E(DFNTO(I),1,20)
63 ;. I I=1!(I=5) W !
64 ;I DFNFR=""!(DFNTO="") D
65 ;. I DFNFR=""&(DFNTO="") W !!,"There is NO DATA in the "_PACKAGE_" file for either entry." Q
66 ;. I DFNFR="" W !!,"There is NO DATA in the "_PACKAGE_" file for (",DFNFRX,") ",DFNFR(1)," ",DFNFR(2)
67 ;. I DFNTO="" W !!,"There is NO DATA in the "_PACKAGE_" file for (",DFNTOX,") ",DFNTO(1)," ",DFNTO(2)
68 ;S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT)
69 ;I DFNFR=""!(DFNTO="") Q
70 ;S DIT(1)=DFNFR,DIT(2)=DFNTO,IOP=IO(0),DFF=XDRFILE,DIC=XDRFILE
71 D SHOW^XDRDSHOW(XDRFILE,DFNFR,DFNTO,.OVERWRIT,REVIEW) ;D EN^DITC K IOP
72 Q
73 ;
74CHK ;
75 N DIR
76CHK1 K DIR
77 S DIR(0)="S^V:VERIFIED DUPLICATE;N:VERIFIED, NOT A DUPLICATE;U:UNABLE TO DETERMINE;H:HEALTH SUMMARY;R:REVIEW DATA AGAIN;S:SELECT/REVIEW OVERWRITES",DIR("A")="Select Action",DIR("B")="HEALTH SUMMARY"
78 D ^DIR K DIR S XDRY=Y I $D(DIRUT) K XQAKILL Q
79 I XDRY="R" S REVIEW=0 D SHOW G CHK1
80 I XDRY="S" S REVIEW=1 D SHOW G CHK1
81 I XDRY'="H" D Q
82 . K XQAKILL
83 . I XDRY'="^" D
84 . . S XQAKILL=$S(XDRY'="U":0,1:1)
85 . . S XDRDIR=""
86 . . I XDRY="V",PACKAGE="PRIMARY" D
87 . . . S DIR=0 F DFN=DFNFRX,DFNTOX I $D(@FILEDIC) S DIR=DIR+1
88 . . . I DIR'>1 K DIR Q ; DON'T NEED TO SELECT DIRECTION UNLESS DATA IN BOTH ENTRIES
89 . . . S DIR("B")=$$COUNT^XDRRMRG2(XDRFILE,DFNFRX,DFNTOX)
90 . . . S DIR("B")=$S(DIR("B")'>1:"RECORD1 INTO RECORD2",1:"RECORD2 INTO RECORD1")
91 . . . I DIR("B")=0 K DIR("B")
92 . . . S DIR(0)="S^1:RECORD1 INTO RECORD2;2:RECORD2 INTO RECORD1"
93 . . . W !!!,?20,"RECORD1 [#"_DFNFR_"]",?45,"RECORD2 [#"_DFNTO_"]"
94 . . . W !,?20,DFNFR(1),?45,DFNTO(1)
95 . . . S DIR("A")="Which record (1 or 2) should be MERGED INTO the other record"
96 . . . D ^DIR K DIR I Y>0 S XDRDIR=+Y
97 . . . I $D(DIRUT) S XDRY="^" W !!!,$C(7),"VERIFICATION ABORTED!",! Q
98 . . . I DFNFRX'=+^VA(15,XDRDA,0) S XDRDIR=$S(XDRDIR'>0:2,XDRDIR=1:2,1:1)
99 . . N XDRFDA,XDRDA1
100 . . S XDRDA1=$$FIND1^DIC(15.02,","_XDRDA_",","X",PACKAGE)
101 . . S XDRDA1=$S(XDRDA1>0:XDRDA1_",",1:"+1,")_XDRDA_","
102 . . S XDRFDA(15.02,XDRDA1,.01)=PACKAGE
103 . . S XDRFDA(15.02,XDRDA1,.02)=XDRY
104 . . S XDRFDA(15.02,XDRDA1,.03)=DUZ
105 . . S XDRFDA(15.02,XDRDA1,.04)=$$NOW^XLFDT()
106 . . I XDRDIR'="" S XDRFDA(15.02,XDRDA1,.05)=XDRDIR
107 . . D UPDATE^DIE("S","XDRFDA")
108 . . ;
109 . . I $D(OVERWRIT)!(XDRDIR=2&(PACKAGE'="PRIMARY")) D
110 . . . N I
111 . . . S XDRDA1=$$FIND1^DIC(15.03,","_XDRDA_",","X",XDRFILE)
112 . . . I XDRDA1'>0 D
113 . . . . S XDRDA1="+1,"_XDRDA_","
114 . . . . K XDRFDA,XDRDAX
115 . . . . S XDRDAX(1)=XDRFILE
116 . . . . S XDRFDA(15.03,XDRDA1,.01)=XDRFILE
117 . . . . I XDRDIR=2,PACKAGE'="PRIMARY" D
118 . . . . . S XDRFDA(15.03,XDRDA1,.02)=2
119 . . . . D UPDATE^DIE("S","XDRFDA","XDRDAX")
120 . . . . S XDRDA1=XDRDAX(1)
121 . . . S XDRDA1="+1,"_XDRDA1_","_XDRDA_","
122 . . . F I=0:0 S I=$O(OVERWRIT(I)) Q:I'>0 D
123 . . . . K XDRFDA,XDRDAX
124 . . . . S XDRDAX(1)=I
125 . . . . S XDRFDA(15.031,XDRDA1,.01)=I
126 . . . . D UPDATE^DIE("S","XDRFDA","XDRDAX")
127 . I XDRY="V" D
128 . . D CHEKVER
129 . I XDRY="N" D
130 . . S XDRAID=$G(XQAID) N XQAID,I
131 . . F I=0:0 S I=$O(^VA(15.1,PRIFILE,2,I)) Q:I'>0 D ; MODIFIED 03/28/00
132 . . . S XQAID=$P(XDRAID,",",1,2)_","_I
133 . . . S XQAKILL=0
134 . . . D DELETEA^XQALERT
135 . . N XDRFDA
136 . . S XDRFDA(15,XDRDA_",",.03)="N"
137 . . S XDRFDA(15,XDRDA_",",.07)=$$NOW^XLFDT()
138 . . S XDRFDA(15,XDRDA_",",.11)=DUZ
139 . . D UPDATE^DIE("S","XDRFDA")
140 S ABORT=0 D ASK^XDRRMRG2(.QLIST,.ABORT) ;REM -Reset ABORT to 0
141 ;
142 ;For health summary, user has the option of using the Browser to view
143 ;both records or use may select any other device for each record.
144 ;
145 I '$G(ABORT) D PRINT2^XDRRMRG2
146 D HOME^%ZIS
147 G CHK1
148 Q
149 ;
150CHEKVER ;
151 N R
152 S XVER=1
153 F I=0:0 S I=$O(^VA(15.1,PRIFILE,2,I)) Q:I'>0 D Q:'XVER ; MODIFIED 03/28/00
154 . S X1=+$P(^VA(15.1,PRIFILE,2,I,0),U,2) ; MODIFIED 03/28/00
155 . S XN=$P(^VA(15.1,PRIFILE,2,I,0),U) ; MODIFIED 03/28/00
156 . I X1>0 D
157 . . F R=1,5,6,7,0 I $O(^XMB(3.8,X1,R,0))>0 Q ;REM -changed I to R in FOR loop
158 . . I R'>0 S X1=0
159 . I X1'>0,$O(^VA(15.1,PRIFILE,2,I,1,0))'>0 Q ; MODIFIED 03/28/00
160 . S X1=$$FIND1^DIC(15.02,","_XDRDA_",","X",XN)
161 . S XVER=$S(X1'>0:0,$P(^VA(15,XDRDA,2,X1,0),U,2)="V":1,$P(^(0),U,2)="D":1,1:0)
162 I XVER D FINALVER^XDRVCHEK(XDRDA)
163 Q
164 ;
165SETUP(XDRDA) ;
166 N XDRGRPN,XDRSSN,XDRFILE
167 S X=^VA(15,XDRDA,0)
168 I $P($G(^VA(15,XDRDA,2,1,0)),U,5)=2 S DFNTO=+X,DFNFR=+$P(X,U,2)
169 E S DFNFR=+X,DFNTO=+$P(X,U,2)
170 S XDRFILE=$P($P(X,U),";",2),XDRFILE=+$P(@(U_XDRFILE_"0)"),U,2)
171 F XDRAID=0:0 S XDRAID=$O(^VA(15.1,PRIFILE,2,XDRAID)) Q:XDRAID'>0 D ; MODIFIED 03/28/00
172 . S XDRNODE=^VA(15.1,PRIFILE,2,XDRAID,0) ; MODIFIED 03/28/00
173 . S XDRNOD2=$G(^VA(15.1,PRIFILE,2,XDRAID,2)) ; MODIFIED 03/28/00
174 . S XDRNAME=$P(XDRNODE,U)
175 . S XDRGRP=$P(XDRNODE,U,2)
176 . S:XDRGRP>0 XDRGRPN=$$GET1^DIQ(3.8,XDRGRP,.01) ;REM -8/2/96 Get the name of mail group
177 . S XDRGRP=$S(XDRGRP>0:"G."_XDRGRPN,1:"")
178 . S XDRFILE=$P(XDRNODE,U,3) D Q:'$D(XDRNODE)
179 . . N XDRDIC,XDRFR,XDRTO
180 . . S XDRDIC=^DIC(XDRFILE,0,"GL")
181 . . S XDRFR=$S(XDRFILE'=63:DFNFR,1:$G(^DPT(DFNFR,"LR")))
182 . . S XDRTO=$S(XDRFILE'=63:DFNTO,1:$G(^DPT(DFNTO,"LR")))
183 . . I XDRFR'>0!(XDRTO'>0) K XDRNODE
184 . . I $D(XDRNODE),'$D(@(XDRDIC_XDRFR_",0)"))!'$D(@(XDRDIC_XDRTO_",0)")) K XDRNODE
185 . . I '$D(XDRNODE) D
186 . . . N XDRARR I $$FIND1^DIC(15.02,","_XDRDA_",","X",XDRNAME)>0 Q
187 . . . S XDRARR(15.02,"+1,"_XDRDA_",",.01)=XDRNAME
188 . . . S XDRARR(15.02,"+1,"_XDRDA_",",.02)="D"
189 . . . D UPDATE^DIE("","XDRARR")
190 . S XQADATA=XDRDA_U_DFNFR_";"_DFNTO_U_XDRNAME_U_XDRFILE_U_$P(XDRNOD2,U)_U_$P(XDRNOD2,U,2)
191 . ;S R(1)=XDRDA_U_DFNFR_";"_DFNTO_U_XDRNAME_U_XDRFILE_U_$P(XDRNOD2,U)_U_$P(XDRNOD2,U,2)
192 . D SETARY^XDRRMRG0 S XMTEXT="R("
193 . S:XDRGRP'="" XMY(XDRGRP)=""
194 . F I=0:0 S I=$O(^VA(15.1,PRIFILE,2,XDRAID,1,I)) Q:I'>0 S X=^(I,0) D
195 . . S XQA(X)=""
196 . D SEND^XDRRMRG0 K R
197 Q
Note: See TracBrowser for help on using the repository browser.