forked from lewisschmidt/CCL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
OrcTool_Product_linking
68 lines (53 loc) · 1.71 KB
/
OrcTool_Product_linking
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* show all orders, product linked and who linked it */
select
primary_mnemonic=oc.primary_mnemonic
,OCS_descr = substring(1,80,ocs.mnemonic)
,mnemonic_type = uar_get_code_display (ocs.mnemonic_type_cd)
,label_desc = substring (1,80, mi.value)
, sir_last_update_dt_tm = sir.updt_dt_tm "@SHORTDATETIME"
, last_update_name_last = p.name_last
, last_update_name_first = p.name_first
, last_update_user_position = uar_get_code_display(p.position_cd)
from
order_catalog_synonym ocs
,order_catalog oc
,synonym_item_r sir
,prsnl p
,med_identifier mi
plan ocs
where ocs.mnemonic_type_cd in (
;CODE_VALUE DISPLAY
2580.00 ;Brand Name
,2581.00 ;Direct Care Provider
,614542.00 ;C - Dispensable Drug Names
,2582.00 ;Generic Name
,614548.00 ;Y - Generic Products
,614544.00 ;M - Generic Miscellaneous
,614543.00 ;E - IV Fluids and Nicknames
,2583.00 ;Primary
,2584.00 ;Rx Mnemonic
,614549.00 ;Z - Trade Products
,614545.00 ;N - Trade Miscellaneous Products
)
and ocs.active_ind = 1
and not ocs.mnemonic_key_cap = "ZZ*"
and ocs.catalog_cd = 2749283.00 ; ampicillin
join oc
where ocs.catalog_cd=oc.catalog_cd
;and oc.updt_id = ocs.updt_id
join sir
where ocs.synonym_id=sir.synonym_id
join p
;where ocs.updt_id = p.person_id
where p.person_id = sir.updt_id
join mi
where sir.item_id=mi.item_id
;and mi.flex_type_cd = 665856.00 ; Pharmacy
and mi.med_identifier_type_cd = value(uar_get_code_by("MEANING",11000,"DESC")); label description
and mi.med_product_id =0
;and mi.active_ind=1
;and mi.med_type_flag = 0 ; product, not ivset, compound, etc..
;and mi.pharmacy_type_cd = 0; inpatient medication
order by ocs.mnemonic, mi.value
with maxrec = 1000, time = 60
go