blob: c00b637162550a16ac6748fae0e9199e7af82c14 [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()
Rushabh Mehtaf0569742017-09-13 12:52:30 +053017 create_sensitivity()
Jamsheer0cde6ae2018-05-16 10:54:00 +053018 add_healthcare_service_unit_tree_root()
Rushabh Mehtaf0569742017-09-13 12:52:30 +053019
20def create_medical_departments():
mbauskaree9da672017-10-10 12:15:48 +053021 departments = [
22 "Accident And Emergency Care" ,"Anaesthetics", "Biochemistry", "Cardiology", "Dermatology",
23 "Diagnostic Imaging", "ENT", "Gastroenterology", "General Surgery", "Gynaecology",
24 "Haematology", "Maternity", "Microbiology", "Nephrology", "Neurology", "Oncology",
25 "Orthopaedics", "Pathology", "Physiotherapy", "Rheumatology", "Serology", "Urology"
26 ]
27 for department in departments:
Rushabh Mehtaf0569742017-09-13 12:52:30 +053028 mediacal_department = frappe.new_doc("Medical Department")
mbauskaree9da672017-10-10 12:15:48 +053029 mediacal_department.department = _(department)
Rushabh Mehtaf0569742017-09-13 12:52:30 +053030 try:
31 mediacal_department.save()
32 except frappe.DuplicateEntryError:
33 pass
34
35def create_antibiotics():
mbauskaree9da672017-10-10 12:15:48 +053036 abt = [
37 "Amoxicillin", "Ampicillin", "Bacampicillin", "Carbenicillin", "Cloxacillin", "Dicloxacillin",
38 "Flucloxacillin", "Mezlocillin", "Nafcillin", "Oxacillin", "Penicillin G", "Penicillin V",
39 "Piperacillin", "Pivampicillin", "Pivmecillinam", "Ticarcillin", "Cefacetrile (cephacetrile)",
40 "Cefadroxil (cefadroxyl)", "Cefalexin (cephalexin)", "Cefaloglycin (cephaloglycin)",
41 "Cefalonium (cephalonium)", "Cefaloridine (cephaloradine)", "Cefalotin (cephalothin)",
42 "Cefapirin (cephapirin)", "Cefatrizine", "Cefazaflur", "Cefazedone", "Cefazolin (cephazolin)",
43 "Cefradine (cephradine)", "Cefroxadine", "Ceftezole", "Cefaclor", "Cefamandole", "Cefmetazole",
44 "Cefonicid", "Cefotetan", "Cefoxitin", "Cefprozil (cefproxil)", "Cefuroxime", "Cefuzonam",
45 "Cefcapene", "Cefdaloxime", "Cefdinir", "Cefditoren", "Cefetamet", "Cefixime", "Cefmenoxime",
46 "Cefodizime", "Cefotaxime", "Cefpimizole", "Cefpodoxime", "Cefteram", "Ceftibuten", "Ceftiofur",
47 "Ceftiolene", "Ceftizoxime", "Ceftriaxone", "Cefoperazone", "Ceftazidime", "Cefclidine", "Cefepime",
48 "Cefluprenam", "Cefoselis", "Cefozopran", "Cefpirome", "Cefquinome", "Ceftobiprole", "Ceftaroline",
49 "Cefaclomezine","Cefaloram", "Cefaparole", "Cefcanel", "Cefedrolor", "Cefempidone", "Cefetrizole",
50 "Cefivitril", "Cefmatilen", "Cefmepidium", "Cefovecin", "Cefoxazole", "Cefrotil", "Cefsumide",
51 "Cefuracetime", "Ceftioxide", "Ceftazidime/Avibactam", "Ceftolozane/Tazobactam", "Aztreonam",
52 "Imipenem", "Imipenem/cilastatin", "Doripenem", "Meropenem", "Ertapenem", "Azithromycin",
53 "Erythromycin", "Clarithromycin", "Dirithromycin", "Roxithromycin", "Telithromycin", "Clindamycin",
54 "Lincomycin", "Pristinamycin", "Quinupristin/dalfopristin", "Amikacin", "Gentamicin", "Kanamycin",
55 "Neomycin", "Netilmicin", "Paromomycin", "Streptomycin", "Tobramycin", "Flumequine", "Nalidixic acid",
56 "Oxolinic acid", "Piromidic acid", "Pipemidic acid", "Rosoxacin", "Ciprofloxacin", "Enoxacin",
57 "Lomefloxacin", "Nadifloxacin", "Norfloxacin", "Ofloxacin", "Pefloxacin", "Rufloxacin", "Balofloxacin",
58 "Gatifloxacin", "Grepafloxacin", "Levofloxacin", "Moxifloxacin", "Pazufloxacin", "Sparfloxacin",
59 "Temafloxacin", "Tosufloxacin", "Besifloxacin", "Clinafloxacin", "Gemifloxacin",
60 "Sitafloxacin", "Trovafloxacin", "Prulifloxacin", "Sulfamethizole", "Sulfamethoxazole",
61 "Sulfisoxazole", "Trimethoprim-Sulfamethoxazole", "Demeclocycline", "Doxycycline", "Minocycline",
62 "Oxytetracycline", "Tetracycline", "Tigecycline", "Chloramphenicol", "Metronidazole",
63 "Tinidazole", "Nitrofurantoin", "Vancomycin", "Teicoplanin", "Telavancin", "Linezolid",
64 "Cycloserine 2", "Rifampin", "Rifabutin", "Rifapentine", "Rifalazil", "Bacitracin", "Polymyxin B",
65 "Viomycin", "Capreomycin"
66 ]
67
Rushabh Mehtaf0569742017-09-13 12:52:30 +053068 for a in abt:
69 antibiotic = frappe.new_doc("Antibiotic")
70 antibiotic.antibiotic_name = a
71 try:
72 antibiotic.save()
73 except frappe.DuplicateEntryError:
74 pass
75
76def create_test_uom():
77 records = [
78 {"doctype": "Lab Test UOM", "name": "umol/L", "test_uom": "umol/L", "uom_description": None },
79 {"doctype": "Lab Test UOM", "name": "mg/L", "test_uom": "mg/L", "uom_description": None },
80 {"doctype": "Lab Test UOM", "name": "mg / dl", "test_uom": "mg / dl", "uom_description": None },
81 {"doctype": "Lab Test UOM", "name": "pg / ml", "test_uom": "pg / ml", "uom_description": None },
82 {"doctype": "Lab Test UOM", "name": "U/ml", "test_uom": "U/ml", "uom_description": None },
83 {"doctype": "Lab Test UOM", "name": "/HPF", "test_uom": "/HPF", "uom_description": None },
84 {"doctype": "Lab Test UOM", "name": "Million Cells / cumm", "test_uom": "Million Cells / cumm", "uom_description": None },
85 {"doctype": "Lab Test UOM", "name": "Lakhs Cells / cumm", "test_uom": "Lakhs Cells / cumm", "uom_description": None },
86 {"doctype": "Lab Test UOM", "name": "U / L", "test_uom": "U / L", "uom_description": None },
87 {"doctype": "Lab Test UOM", "name": "g / L", "test_uom": "g / L", "uom_description": None },
88 {"doctype": "Lab Test UOM", "name": "IU / ml", "test_uom": "IU / ml", "uom_description": None },
89 {"doctype": "Lab Test UOM", "name": "gm %", "test_uom": "gm %", "uom_description": None },
90 {"doctype": "Lab Test UOM", "name": "Microgram", "test_uom": "Microgram", "uom_description": None },
91 {"doctype": "Lab Test UOM", "name": "Micron", "test_uom": "Micron", "uom_description": None },
92 {"doctype": "Lab Test UOM", "name": "Cells / cumm", "test_uom": "Cells / cumm", "uom_description": None },
93 {"doctype": "Lab Test UOM", "name": "%", "test_uom": "%", "uom_description": None },
94 {"doctype": "Lab Test UOM", "name": "mm / dl", "test_uom": "mm / dl", "uom_description": None },
95 {"doctype": "Lab Test UOM", "name": "mm / hr", "test_uom": "mm / hr", "uom_description": None },
96 {"doctype": "Lab Test UOM", "name": "ulU / ml", "test_uom": "ulU / ml", "uom_description": None },
97 {"doctype": "Lab Test UOM", "name": "ng / ml", "test_uom": "ng / ml", "uom_description": None },
98 {"doctype": "Lab Test UOM", "name": "ng / dl", "test_uom": "ng / dl", "uom_description": None },
99 {"doctype": "Lab Test UOM", "name": "ug / dl", "test_uom": "ug / dl", "uom_description": None }
100 ]
101
102 insert_record(records)
103
104def create_duration():
105 records = [
106 {"doctype": "Prescription Duration", "name": "3 Month", "number": "3", "period": "Month" },
107 {"doctype": "Prescription Duration", "name": "2 Month", "number": "2", "period": "Month" },
108 {"doctype": "Prescription Duration", "name": "1 Month", "number": "1", "period": "Month" },
109 {"doctype": "Prescription Duration", "name": "12 Hour", "number": "12", "period": "Hour" },
110 {"doctype": "Prescription Duration", "name": "11 Hour", "number": "11", "period": "Hour" },
111 {"doctype": "Prescription Duration", "name": "10 Hour", "number": "10", "period": "Hour" },
112 {"doctype": "Prescription Duration", "name": "9 Hour", "number": "9", "period": "Hour" },
113 {"doctype": "Prescription Duration", "name": "8 Hour", "number": "8", "period": "Hour" },
114 {"doctype": "Prescription Duration", "name": "7 Hour", "number": "7", "period": "Hour" },
115 {"doctype": "Prescription Duration", "name": "6 Hour", "number": "6", "period": "Hour" },
116 {"doctype": "Prescription Duration", "name": "5 Hour", "number": "5", "period": "Hour" },
117 {"doctype": "Prescription Duration", "name": "4 Hour", "number": "4", "period": "Hour" },
118 {"doctype": "Prescription Duration", "name": "3 Hour", "number": "3", "period": "Hour" },
119 {"doctype": "Prescription Duration", "name": "2 Hour", "number": "2", "period": "Hour" },
120 {"doctype": "Prescription Duration", "name": "1 Hour", "number": "1", "period": "Hour" },
121 {"doctype": "Prescription Duration", "name": "5 Week", "number": "5", "period": "Week" },
122 {"doctype": "Prescription Duration", "name": "4 Week", "number": "4", "period": "Week" },
123 {"doctype": "Prescription Duration", "name": "3 Week", "number": "3", "period": "Week" },
124 {"doctype": "Prescription Duration", "name": "2 Week", "number": "2", "period": "Week" },
125 {"doctype": "Prescription Duration", "name": "1 Week", "number": "1", "period": "Week" },
126 {"doctype": "Prescription Duration", "name": "6 Day", "number": "6", "period": "Day" },
127 {"doctype": "Prescription Duration", "name": "5 Day", "number": "5", "period": "Day" },
128 {"doctype": "Prescription Duration", "name": "4 Day", "number": "4", "period": "Day" },
129 {"doctype": "Prescription Duration", "name": "3 Day", "number": "3", "period": "Day" },
130 {"doctype": "Prescription Duration", "name": "2 Day", "number": "2", "period": "Day" },
131 {"doctype": "Prescription Duration", "name": "1 Day", "number": "1", "period": "Day" }
132 ]
133 insert_record(records)
134
135def create_dosage():
136 records = [
137 {"doctype": "Prescription Dosage", "name": "1-1-1-1", "dosage": "1-1-1-1","dosage_strength":
138 [{"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"}]
139 },
140 {"doctype": "Prescription Dosage", "name": "0-0-1", "dosage": "0-0-1","dosage_strength":
141 [{"strength": "1.0","strength_time": "21:00:00"}]
142 },
143 {"doctype": "Prescription Dosage", "name": "1-0-0", "dosage": "1-0-0","dosage_strength":
144 [{"strength": "1.0","strength_time": "9:00:00"}]
145 },
146 {"doctype": "Prescription Dosage", "name": "0-1-0", "dosage": "0-1-0","dosage_strength":
147 [{"strength": "1.0","strength_time": "14:00:00"}]
148 },
149 {"doctype": "Prescription Dosage", "name": "1-1-1", "dosage": "1-1-1","dosage_strength":
150 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
151 },
152 {"doctype": "Prescription Dosage", "name": "1-0-1", "dosage": "1-0-1","dosage_strength":
153 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
154 },
155 {"doctype": "Prescription Dosage", "name": "Once Bedtime", "dosage": "Once Bedtime","dosage_strength":
156 [{"strength": "1.0","strength_time": "21:00:00"}]
157 },
158 {"doctype": "Prescription Dosage", "name": "5 times a day", "dosage": "5 times a day","dosage_strength":
159 [{"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"}]
160 },
161 {"doctype": "Prescription Dosage", "name": "QID", "dosage": "QID","dosage_strength":
162 [{"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"}]
163 },
164 {"doctype": "Prescription Dosage", "name": "TID", "dosage": "TID","dosage_strength":
165 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
166 },
167 {"doctype": "Prescription Dosage", "name": "BID", "dosage": "BID","dosage_strength":
168 [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
169 },
170 {"doctype": "Prescription Dosage", "name": "Once Daily", "dosage": "Once Daily","dosage_strength":
171 [{"strength": "1.0","strength_time": "9:00:00"}]
172 }
173 ]
174 insert_record(records)
175
176def create_healthcare_item_groups():
177 records = [
178 {'doctype': 'Item Group', 'item_group_name': _('Laboratory'),
179 'is_group': 0, 'parent_item_group': _('All Item Groups') },
180 {'doctype': 'Item Group', 'item_group_name': _('Drug'),
181 'is_group': 0, 'parent_item_group': _('All Item Groups') }
182 ]
183 insert_record(records)
184
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530185def create_sensitivity():
186 records = [
mbauskaree9da672017-10-10 12:15:48 +0530187 {"doctype": "Sensitivity", "sensitivity": _("Low Sensitivity")},
188 {"doctype": "Sensitivity", "sensitivity": _("High Sensitivity")},
189 {"doctype": "Sensitivity", "sensitivity": _("Moderate Sensitivity")},
190 {"doctype": "Sensitivity", "sensitivity": _("Susceptible")},
191 {"doctype": "Sensitivity", "sensitivity": _("Resistant")},
192 {"doctype": "Sensitivity", "sensitivity": _("Intermediate")}
Rushabh Mehtaf0569742017-09-13 12:52:30 +0530193 ]
194 insert_record(records)
Jamsheer0cde6ae2018-05-16 10:54:00 +0530195
196def add_healthcare_service_unit_tree_root():
197 record = [
198 {
199 "doctype": "Healthcare Service Unit",
Jamsheer425fb4c2018-07-23 13:05:35 +0530200 "healthcare_service_unit_name": "All Healthcare Service Units",
Jamsheer0cde6ae2018-05-16 10:54:00 +0530201 "is_group": 1
202 }
203 ]
204 insert_record(record)