blob: fca127048915e869873094ce6d9b590a49ec8bc1 [file] [log] [blame]
Rushabh Mehtaf0569742017-09-13 12:52:30 +05301from __future__ import unicode_literals
2import frappe
Rushabh Mehtaf0569742017-09-13 12:52:30 +05303
4from frappe import _
Manas Solanki966f1412017-11-23 15:22:10 +05305from erpnext.setup.utils import insert_record
Rushabh Mehtaf0569742017-09-13 12:52:30 +05306
7def setup_healthcare():
Rushabh Mehtabc4e2cd2017-10-17 12:30:34 +05308 if frappe.db.exists('Medical Department', 'Cardiology'):
9 # already setup
10 return
Rushabh Mehtaf0569742017-09-13 12:52:30 +053011 create_medical_departments()
12 create_antibiotics()
13 create_test_uom()
14 create_duration()
15 create_dosage()
16 create_healthcare_item_groups()
17 create_lab_test_items()
18 create_lab_test_template()
19 create_sensitivity()
Rushabh Mehtaf0569742017-09-13 12:52:30 +053020
21def create_medical_departments():
mbauskaree9da672017-10-10 12:15:48 +053022 departments = [
23 "Accident And Emergency Care" ,"Anaesthetics", "Biochemistry", "Cardiology", "Dermatology",
24 "Diagnostic Imaging", "ENT", "Gastroenterology", "General Surgery", "Gynaecology",
25 "Haematology", "Maternity", "Microbiology", "Nephrology", "Neurology", "Oncology",
26 "Orthopaedics", "Pathology", "Physiotherapy", "Rheumatology", "Serology", "Urology"
27 ]
28 for department in departments:
Rushabh Mehtaf0569742017-09-13 12:52:30 +053029 mediacal_department = frappe.new_doc("Medical Department")
mbauskaree9da672017-10-10 12:15:48 +053030 mediacal_department.department = _(department)
Rushabh Mehtaf0569742017-09-13 12:52:30 +053031 try:
32 mediacal_department.save()
33 except frappe.DuplicateEntryError:
34 pass
35
36def create_antibiotics():
mbauskaree9da672017-10-10 12:15:48 +053037 abt = [
38 "Amoxicillin", "Ampicillin", "Bacampicillin", "Carbenicillin", "Cloxacillin", "Dicloxacillin",
39 "Flucloxacillin", "Mezlocillin", "Nafcillin", "Oxacillin", "Penicillin G", "Penicillin V",
40 "Piperacillin", "Pivampicillin", "Pivmecillinam", "Ticarcillin", "Cefacetrile (cephacetrile)",
41 "Cefadroxil (cefadroxyl)", "Cefalexin (cephalexin)", "Cefaloglycin (cephaloglycin)",
42 "Cefalonium (cephalonium)", "Cefaloridine (cephaloradine)", "Cefalotin (cephalothin)",
43 "Cefapirin (cephapirin)", "Cefatrizine", "Cefazaflur", "Cefazedone", "Cefazolin (cephazolin)",
44 "Cefradine (cephradine)", "Cefroxadine", "Ceftezole", "Cefaclor", "Cefamandole", "Cefmetazole",
45 "Cefonicid", "Cefotetan", "Cefoxitin", "Cefprozil (cefproxil)", "Cefuroxime", "Cefuzonam",
46 "Cefcapene", "Cefdaloxime", "Cefdinir", "Cefditoren", "Cefetamet", "Cefixime", "Cefmenoxime",
47 "Cefodizime", "Cefotaxime", "Cefpimizole", "Cefpodoxime", "Cefteram", "Ceftibuten", "Ceftiofur",
48 "Ceftiolene", "Ceftizoxime", "Ceftriaxone", "Cefoperazone", "Ceftazidime", "Cefclidine", "Cefepime",
49 "Cefluprenam", "Cefoselis", "Cefozopran", "Cefpirome", "Cefquinome", "Ceftobiprole", "Ceftaroline",
50 "Cefaclomezine","Cefaloram", "Cefaparole", "Cefcanel", "Cefedrolor", "Cefempidone", "Cefetrizole",
51 "Cefivitril", "Cefmatilen", "Cefmepidium", "Cefovecin", "Cefoxazole", "Cefrotil", "Cefsumide",
52 "Cefuracetime", "Ceftioxide", "Ceftazidime/Avibactam", "Ceftolozane/Tazobactam", "Aztreonam",
53 "Imipenem", "Imipenem/cilastatin", "Doripenem", "Meropenem", "Ertapenem", "Azithromycin",
54 "Erythromycin", "Clarithromycin", "Dirithromycin", "Roxithromycin", "Telithromycin", "Clindamycin",
55 "Lincomycin", "Pristinamycin", "Quinupristin/dalfopristin", "Amikacin", "Gentamicin", "Kanamycin",
56 "Neomycin", "Netilmicin", "Paromomycin", "Streptomycin", "Tobramycin", "Flumequine", "Nalidixic acid",
57 "Oxolinic acid", "Piromidic acid", "Pipemidic acid", "Rosoxacin", "Ciprofloxacin", "Enoxacin",
58 "Lomefloxacin", "Nadifloxacin", "Norfloxacin", "Ofloxacin", "Pefloxacin", "Rufloxacin", "Balofloxacin",
59 "Gatifloxacin", "Grepafloxacin", "Levofloxacin", "Moxifloxacin", "Pazufloxacin", "Sparfloxacin",
60 "Temafloxacin", "Tosufloxacin", "Besifloxacin", "Clinafloxacin", "Gemifloxacin",
61 "Sitafloxacin", "Trovafloxacin", "Prulifloxacin", "Sulfamethizole", "Sulfamethoxazole",
62 "Sulfisoxazole", "Trimethoprim-Sulfamethoxazole", "Demeclocycline", "Doxycycline", "Minocycline",
63 "Oxytetracycline", "Tetracycline", "Tigecycline", "Chloramphenicol", "Metronidazole",
64 "Tinidazole", "Nitrofurantoin", "Vancomycin", "Teicoplanin", "Telavancin", "Linezolid",
65 "Cycloserine 2", "Rifampin", "Rifabutin", "Rifapentine", "Rifalazil", "Bacitracin", "Polymyxin B",
66 "Viomycin", "Capreomycin"
67 ]
68
Rushabh Mehtaf0569742017-09-13 12:52:30 +053069 for a in abt:
70 antibiotic = frappe.new_doc("Antibiotic")
71 antibiotic.antibiotic_name = a
72 try:
73 antibiotic.save()
74 except frappe.DuplicateEntryError:
75 pass
76
77def create_test_uom():
78 records = [
79 {"doctype": "Lab Test UOM", "name": "umol/L", "test_uom": "umol/L", "uom_description": None },
80 {"doctype": "Lab Test UOM", "name": "mg/L", "test_uom": "mg/L", "uom_description": None },
81 {"doctype": "Lab Test UOM", "name": "mg / dl", "test_uom": "mg / dl", "uom_description": None },
82 {"doctype": "Lab Test UOM", "name": "pg / ml", "test_uom": "pg / ml", "uom_description": None },
83 {"doctype": "Lab Test UOM", "name": "U/ml", "test_uom": "U/ml", "uom_description": None },
84 {"doctype": "Lab Test UOM", "name": "/HPF", "test_uom": "/HPF", "uom_description": None },
85 {"doctype": "Lab Test UOM", "name": "Million Cells / cumm", "test_uom": "Million Cells / cumm", "uom_description": None },
86 {"doctype": "Lab Test UOM", "name": "Lakhs Cells / cumm", "test_uom": "Lakhs Cells / cumm", "uom_description": None },
87 {"doctype": "Lab Test UOM", "name": "U / L", "test_uom": "U / L", "uom_description": None },
88 {"doctype": "Lab Test UOM", "name": "g / L", "test_uom": "g / L", "uom_description": None },
89 {"doctype": "Lab Test UOM", "name": "IU / ml", "test_uom": "IU / ml", "uom_description": None },
90 {"doctype": "Lab Test UOM", "name": "gm %", "test_uom": "gm %", "uom_description": None },
91 {"doctype": "Lab Test UOM", "name": "Microgram", "test_uom": "Microgram", "uom_description": None },
92 {"doctype": "Lab Test UOM", "name": "Micron", "test_uom": "Micron", "uom_description": None },
93 {"doctype": "Lab Test UOM", "name": "Cells / cumm", "test_uom": "Cells / cumm", "uom_description": None },
94 {"doctype": "Lab Test UOM", "name": "%", "test_uom": "%", "uom_description": None },
95 {"doctype": "Lab Test UOM", "name": "mm / dl", "test_uom": "mm / dl", "uom_description": None },
96 {"doctype": "Lab Test UOM", "name": "mm / hr", "test_uom": "mm / hr", "uom_description": None },
97 {"doctype": "Lab Test UOM", "name": "ulU / ml", "test_uom": "ulU / ml", "uom_description": None },
98 {"doctype": "Lab Test UOM", "name": "ng / ml", "test_uom": "ng / ml", "uom_description": None },
99 {"doctype": "Lab Test UOM", "name": "ng / dl", "test_uom": "ng / dl", "uom_description": None },
100 {"doctype": "Lab Test UOM", "name": "ug / dl", "test_uom": "ug / dl", "uom_description": None }
101 ]
102
103 insert_record(records)
104
105def create_duration():
106 records = [
107 {"doctype": "Prescription Duration", "name": "3 Month", "number": "3", "period": "Month" },
108 {"doctype": "Prescription Duration", "name": "2 Month", "number": "2", "period": "Month" },
109 {"doctype": "Prescription Duration", "name": "1 Month", "number": "1", "period": "Month" },
110 {"doctype": "Prescription Duration", "name": "12 Hour", "number": "12", "period": "Hour" },
111 {"doctype": "Prescription Duration", "name": "11 Hour", "number": "11", "period": "Hour" },
112 {"doctype": "Prescription Duration", "name": "10 Hour", "number": "10", "period": "Hour" },
113 {"doctype": "Prescription Duration", "name": "9 Hour", "number": "9", "period": "Hour" },
114 {"doctype": "Prescription Duration", "name": "8 Hour", "number": "8", "period": "Hour" },
115 {"doctype": "Prescription Duration", "name": "7 Hour", "number": "7", "period": "Hour" },
116 {"doctype": "Prescription Duration", "name": "6 Hour", "number": "6", "period": "Hour" },
117 {"doctype": "Prescription Duration", "name": "5 Hour", "number": "5", "period": "Hour" },
118 {"doctype": "Prescription Duration", "name": "4 Hour", "number": "4", "period": "Hour" },
119 {"doctype": "Prescription Duration", "name": "3 Hour", "number": "3", "period": "Hour" },
120 {"doctype": "Prescription Duration", "name": "2 Hour", "number": "2", "period": "Hour" },
121 {"doctype": "Prescription Duration", "name": "1 Hour", "number": "1", "period": "Hour" },
122 {"doctype": "Prescription Duration", "name": "5 Week", "number": "5", "period": "Week" },
123 {"doctype": "Prescription Duration", "name": "4 Week", "number": "4", "period": "Week" },
124 {"doctype": "Prescription Duration", "name": "3 Week", "number": "3", "period": "Week" },
125 {"doctype": "Prescription Duration", "name": "2 Week", "number": "2", "period": "Week" },
126 {"doctype": "Prescription Duration", "name": "1 Week", "number": "1", "period": "Week" },
127 {"doctype": "Prescription Duration", "name": "6 Day", "number": "6", "period": "Day" },
128 {"doctype": "Prescription Duration", "name": "5 Day", "number": "5", "period": "Day" },
129 {"doctype": "Prescription Duration", "name": "4 Day", "number": "4", "period": "Day" },
130 {"doctype": "Prescription Duration", "name": "3 Day", "number": "3", "period": "Day" },
131 {"doctype": "Prescription Duration", "name": "2 Day", "number": "2", "period": "Day" },
132 {"doctype": "Prescription Duration", "name": "1 Day", "number": "1", "period": "Day" }
133 ]
134 insert_record(records)
135
136def create_dosage():
137 records = [
138 {"doctype": "Prescription Dosage", "name": "1-1-1-1", "dosage": "1-1-1-1","dosage_strength":
139 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
140 },
141 {"doctype": "Prescription Dosage", "name": "0-0-1", "dosage": "0-0-1","dosage_strength":
142 [{"strength": "1.0","strength_time": "21:00:00"}]
143 },
144 {"doctype": "Prescription Dosage", "name": "1-0-0", "dosage": "1-0-0","dosage_strength":
145 [{"strength": "1.0","strength_time": "9:00:00"}]
146 },
147 {"doctype": "Prescription Dosage", "name": "0-1-0", "dosage": "0-1-0","dosage_strength":
148 [{"strength": "1.0","strength_time": "14:00:00"}]
149 },
150 {"doctype": "Prescription Dosage", "name": "1-1-1", "dosage": "1-1-1","dosage_strength":
151 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
152 },
153 {"doctype": "Prescription Dosage", "name": "1-0-1", "dosage": "1-0-1","dosage_strength":
154 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
155 },
156 {"doctype": "Prescription Dosage", "name": "Once Bedtime", "dosage": "Once Bedtime","dosage_strength":
157 [{"strength": "1.0","strength_time": "21:00:00"}]
158 },
159 {"doctype": "Prescription Dosage", "name": "5 times a day", "dosage": "5 times a day","dosage_strength":
160 [{"strength": "1.0","strength_time": "5:00:00"}, {"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
161 },
162 {"doctype": "Prescription Dosage", "name": "QID", "dosage": "QID","dosage_strength":
163 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
164 },
165 {"doctype": "Prescription Dosage", "name": "TID", "dosage": "TID","dosage_strength":
166 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
167 },
168 {"doctype": "Prescription Dosage", "name": "BID", "dosage": "BID","dosage_strength":
169 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
170 },
171 {"doctype": "Prescription Dosage", "name": "Once Daily", "dosage": "Once Daily","dosage_strength":
172 [{"strength": "1.0","strength_time": "9:00:00"}]
173 }
174 ]
175 insert_record(records)
176
177def create_healthcare_item_groups():
178 records = [
179 {'doctype': 'Item Group', 'item_group_name': _('Laboratory'),
180 'is_group': 0, 'parent_item_group': _('All Item Groups') },
181 {'doctype': 'Item Group', 'item_group_name': _('Drug'),
182 'is_group': 0, 'parent_item_group': _('All Item Groups') }
183 ]
184 insert_record(records)
185
186def create_lab_test_items():
187 records = [
mbauskaree9da672017-10-10 12:15:48 +0530188 {"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530189 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530190 {"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530191 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530192 {"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530193 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530194 {"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530195 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530196 {"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530197 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530198 {"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530199 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530200 {"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530201 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
mbauskaree9da672017-10-10 12:15:48 +0530202 {"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": _("Laboratory"),
Rushabh Mehtab9fe1462017-09-30 10:46:29 +0530203 "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530204 ]
205 insert_record(records)
206
207def create_lab_test_template():
208 records = [
209 {"doctype": "Lab Test Template", "name": "MCH","test_name": "MCH","test_code": "MCH",
mbauskaree9da672017-10-10 12:15:48 +0530210 "test_group": _("Laboratory"),"department": _("Haematology"),"item": "MCH",
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530211 "test_template_type": "Single","is_billable": 1,"test_rate": 0.0,"test_uom": "Microgram",
212 "test_normal_range": "27 - 32 Microgram",
213 "sensitivity": 0,"test_description": "Mean Corpuscular Hemoglobin"},
214 {"doctype": "Lab Test Template", "name": "LDL","test_name": "LDL (Serum)","test_code": "LDL",
mbauskaree9da672017-10-10 12:15:48 +0530215 "test_group": _("Laboratory"),"department": _("Biochemistry"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530216 "item": "LDL","test_template_type": "Single",
217 "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "70 - 160 mg/dlLow-density Lipoprotein (LDL)",
218 "sensitivity": 0,"test_description": "Low-density Lipoprotein (LDL)"},
219 {"doctype": "Lab Test Template", "name": "GTT","test_name": "GTT","test_code": "GTT",
mbauskaree9da672017-10-10 12:15:48 +0530220 "test_group": _("Laboratory"),"department": _("Haematology"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530221 "item": "GTT","test_template_type": "Single",
222 "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "Less than 85 mg/dl",
223 "sensitivity": 0,"test_description": "Glucose Tolerance Test"},
224 {"doctype": "Lab Test Template", "name": "HDL","test_name": "HDL (Serum)","test_code": "HDL",
mbauskaree9da672017-10-10 12:15:48 +0530225 "test_group": _("Laboratory"),"department": _("Biochemistry"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530226 "item": "HDL","test_template_type": "Single",
227 "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "35 - 65 mg/dl",
228 "sensitivity": 0,"test_description": "High-density Lipoprotein (HDL)"},
229 {"doctype": "Lab Test Template", "name": "BILT","test_name": "Bilirubin Total","test_code": "BILT",
mbauskaree9da672017-10-10 12:15:48 +0530230 "test_group": _("Laboratory"),"department": _("Biochemistry"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530231 "item": "BILT","test_template_type": "Single",
232 "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.2 - 1.2 mg / dl",
233 "sensitivity": 0,"test_description": "Bilirubin Total"},
234 {"doctype": "Lab Test Template", "name": "BILD","test_name": "Bilirubin Direct","test_code": "BILD",
mbauskaree9da672017-10-10 12:15:48 +0530235 "test_group": _("Laboratory"),"department": _("Biochemistry"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530236 "item": "BILD","test_template_type": "Single",
237 "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.4 mg / dl",
238 "sensitivity": 0,"test_description": "Bilirubin Direct"},
239
240 {"doctype": "Lab Test Template", "name": "BP","test_name": "Bile Pigment","test_code": "BP",
mbauskaree9da672017-10-10 12:15:48 +0530241 "test_group": _("Laboratory"),"department": _("Pathology"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530242 "item": "BP","test_template_type": "Single",
243 "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
244 "sensitivity": 0,"test_description": "Bile Pigment"},
245 {"doctype": "Lab Test Template", "name": "BS","test_name": "Bile Salt","test_code": "BS",
mbauskaree9da672017-10-10 12:15:48 +0530246 "test_group": _("Laboratory"),"department": _("Pathology"),
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530247 "item": "BS","test_template_type": "Single",
248 "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
249 "sensitivity": 0,"test_description": "Bile Salt"}
250 ]
251 insert_record(records)
252
253def create_sensitivity():
254 records = [
mbauskaree9da672017-10-10 12:15:48 +0530255 {"doctype": "Sensitivity", "sensitivity": _("Low Sensitivity")},
256 {"doctype": "Sensitivity", "sensitivity": _("High Sensitivity")},
257 {"doctype": "Sensitivity", "sensitivity": _("Moderate Sensitivity")},
258 {"doctype": "Sensitivity", "sensitivity": _("Susceptible")},
259 {"doctype": "Sensitivity", "sensitivity": _("Resistant")},
260 {"doctype": "Sensitivity", "sensitivity": _("Intermediate")}
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530261 ]
262 insert_record(records)