source: FOIAVistA/trunk/r/WOMENS_HEALTH-WV/WVLABADD.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1WVLABADD ;HCIOFO/FT-SAVE A LAB TEST AS A WH PROCEDURE ;5/10/99 12:10
2 ;;1.0;WOMEN'S HEALTH;**6**;Sep 30, 1998
3 ;
4EN ; Entry point from [WV SAVE LAB TEST] option.
5 ; Converts a lab test stored in the WV LAB TESTS file (#790.08)
6 ; into an entry in the WV PROCEDURES file (#790.1)
7 N WVDICB
8 S (WVDICB,WVPOP)=0
9 F D Q:WVPOP
10 .D SELECT Q:WVPOP
11 .D DISPLAY
12 .Q
13 D KILL
14 Q
15SELECT ; Select a lab test entry from File 790.08
16 N DIC,DTOUT,DUOUT,WVDFN
17 S DIC="^WV(790.08,",DIC(0)="AEMQZ"
18 S DIC("A")="Select Lab Test Accession#: "
19 D DEFAULT
20 D ^DIC
21 I Y<0!($D(DTOUT))!($D(DUOUT)) S WVPOP=1 Q
22 S WVIEN=+Y
23 S WVDFN=+$P(^WV(790.08,+Y,0),U,2)
24 S:WVDFN ^DISV(DUZ,"^DPT(")=WVDFN ;space bar/return save for File 790
25 Q
26DISPLAY ; Display lab test data
27 Q:'$G(WVIEN)
28 N LRDFN,LRSS,WVDATE,WVLABACC,WVNAME,WVNODE,WVVALUE
29 S WVNODE=$G(^WV(790.08,+WVIEN,0))
30 Q:WVNODE=""
31 S WVLABACC=$P(WVNODE,U,1) ;lab accession#
32 S LRDFN=$P(WVNODE,U,36) ;File 63 ien (+^DPT(DFN,"LR"))
33 S WVDATE=$P(WVNODE,U,37) ;File 63 inverse date/time
34 S LRSS=$P(WVNODE,U,38) ;File 63 subscript (CY or SP)
35 I WVLABACC=""!(LRDFN="")!(WVDATE="")!(LRSS="") D Q
36 .W !,"Sorry, lab test "_WVLABACC_" is not available after all."
37 .W !,"Will delete this lab test from the list of choices.",!
38 .D DELETE(WVIEN)
39 .Q
40 I $D(^WV(790.1,"F",WVLABACC)) D Q
41 .S WVVALUE=$O(^WV(790.1,"F",WVLABACC,0))
42 .S WVVALUE=$P($G(^WV(790.1,WVVALUE,0)),U,1)
43 .W !,"Sorry, lab test "_WVLABACC_" is already saved as a procedure."
44 .W !,"It is logged as WH accession# "_WVVALUE_"."
45 .W !,"Will delete this lab test from the list of choices.",!
46 .D DELETE(WVIEN)
47 .Q
48 K ^TMP("WVLAB",$J)
49 D HS^WVLABWP ;call Health Summary, returns lab data in ^TMP("WVLAB",$J)
50 I '$D(^TMP("WVLAB",$J)) D Q
51 .W !,"Sorry, lab test data is not available for this choice."
52 .W !,"Will delete this lab test from the list of choices.",!
53 .D DELETE(WVIEN)
54 .Q
55 S WVNAME=$P(WVNODE,U,2) ;dfn
56 S WVNAME=$$GET1^DIQ(2,WVNAME,.01,"E") ;get patient name for Browser call
57 D BROWSE^DDBR("^TMP(""WVLAB"",$J)","N",WVNAME)
58KEEP ; Save lab test as procedure OR delete lab test from File 790.08 OR
59 ; ignore it for now.
60 N DIR
61 S DIR(0)="S^A:add to the WH package;D:delete from the list of choices;I:ignore for now"
62 S DIR("A")="What action should be taken with this lab test"
63 S DIR("?",1)="Please determine what to do with this lab test."
64 S DIR("?",2)=" Ignore this lab test for now."
65 S DIR("?",3)=" Delete from the list. It shouldn't be a Women's Health procedure."
66 S DIR("?")=" Add this lab test as a Women's Health procedure entry."
67 D ^DIR
68 I $D(DIRUT) S WVPOP=1 Q
69 I Y="I" Q
70 I Y="D" D DELETE(WVIEN) Q
71 I Y="A" D CONVERT
72 Q
73CONVERT ; Add the lab test data to the WV PROCEDURE file (#790.1)
74 Q:'$G(WVIEN)
75 N DFN,DIC,DTOUT,DUOUT
76 N WVDATE,WVDR,WVERR,WVNODE,WVPROC
77 S WVNODE=$G(^WV(790.08,+WVIEN,0))
78 S DIC="^WV(790.2,",DIC(0)="AEMQZ"
79 S DIC("A")="Select the procedure type for this lab test: "
80 D ^DIC
81 W !
82 I Y<0!($D(DTOUT))!($D(DUOUT)) S WVPOP=1 Q
83 S WVPROC=+Y
84 S WVERR=1,DFN=$P(WVNODE,U,2),WVDATE=$P(WVNODE,U,12)
85 I '$D(^WV(790,DFN,0)) D ;add patient to File 790, if not there
86 .D AUTOADD^WVPATE(DFN,DUZ(2),.WVERR)
87 .Q
88 Q:WVERR<0 ;quit if new patient could not be added to File 790
89 D FIND^WVLABAD1 ;check for 'unlinked' entry in File 790.1
90 I $D(^WV(790.1,"F",WVLABACC)) D Q ;link was made to existing entry
91 .D DELETE(WVIEN) ;delete lab test from list of choices
92 .S Y=+$O(^WV(790.1,"F",WVLABACC,0)) ;ien of procedure entry
93 .D EDIT ;edit procedure entry
94 .Q
95 S WVDR=".02////"_DFN
96 S WVDR=WVDR_";.04////"_WVPROC ;File 790.2 pointer
97 S:$P(WVNODE,U,7)]"" WVDR=WVDR_";.07////"_$P(WVNODE,U,7) ;provider
98 S WVDR=WVDR_";.1////"_$G(DUZ(2)) ;health care facility
99 S:$P(WVNODE,U,11)]"" WVDR=WVDR_";.11////"_$P(WVNODE,U,11) ;patient location
100 S WVDR=WVDR_";.12////"_$P(WVNODE,U,12) ;procedure date/time
101 S WVDR=WVDR_";.14////"_"o" ;status
102 S WVDR=WVDR_";.18////.5;.19////"_DT ;entering user and date
103 S WVDR=WVDR_";.34////"_$G(DUZ(2)) ;accessioning facility
104 S WVDR=WVDR_";2.17////"_$P(WVNODE,U,1) ;lab accession#
105 S WVDR=WVDR_";2.18////"_$P(WVNODE,U,36) ;Lab Data file (#63) pointer
106 S WVDR=WVDR_";2.19////"_$P(WVNODE,U,37) ;Lab Data file inverse d/t
107 S WVDR=WVDR_";2.2////"_$P(WVNODE,U,38) ;Lab Data file subscript (CY/SP)
108 ; add procedure to File 790.1
109 D NEW2^WVPROC(DFN,WVPROC,WVDATE,WVDR,"","",.WVERR)
110 I Y D DELETE(WVIEN)
111 I Y D EDIT
112 Q
113KILL ; Kill variables
114 K WVIEN,WVPOP,X,Y
115 K ^TMP("WVLAB",$J)
116 Q
117DELETE(WVIEN) ; Delete an entry from File 790.08
118 Q:'$G(WVIEN)
119 N DA,DIK,Y
120 S DA=WVIEN,DIK="^WV(790.08,"
121 D ^DIK
122 Q
123EDIT ; Edit WV PROCEDURE (#790.1) file entry
124 Q:'$G(Y)
125 D LT^WVPROC ;edit the new entry
126 S WVPOP=0 ;reset WVPOP which is killed by ^WVPROC call
127 Q
128DEFAULT ; Find next default look-up value.
129 ; WVQUIT - ien of File 790.08 entry
130 ; WVDICB - last entry checked (don't show an entry they bypassed)
131 N WVLOOP,WVNODE,WVQUIT
132 Q:$G(WVDICB)=""
133 S WVQUIT=0,WVLOOP=+WVDICB
134 F S WVLOOP=$O(^WV(790.08,WVLOOP)) Q:'WVLOOP D Q:WVQUIT
135 .S WVNODE=$G(^WV(790.08,WVLOOP,0)) Q:WVNODE=""
136 .I $P(WVNODE,U,7)=DUZ D Q ;duz is requesting provider
137 ..S (WVDICB,WVQUIT)=WVLOOP
138 ..Q
139 .I $P($G(^WV(790,+$P(WVNODE,U,2),0)),U,10)=DUZ D ;case mgr
140 ..S (WVDICB,WVQUIT)=WVLOOP
141 ..Q
142 .Q
143 S DIC("B")=$S(WVQUIT:$P(^WV(790.08,+WVQUIT,0),U,1),1:"")
144 K:DIC("B")="" DIC("B")
145 Q
Note: See TracBrowser for help on using the repository browser.