Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
| 2 | import frappe |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 3 | |
| 4 | from frappe import _ |
| 5 | |
| 6 | def setup_healthcare(): |
Rushabh Mehta | bc4e2cd | 2017-10-17 12:30:34 +0530 | [diff] [blame] | 7 | if frappe.db.exists('Medical Department', 'Cardiology'): |
| 8 | # already setup |
| 9 | return |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 10 | create_medical_departments() |
| 11 | create_antibiotics() |
| 12 | create_test_uom() |
| 13 | create_duration() |
| 14 | create_dosage() |
| 15 | create_healthcare_item_groups() |
| 16 | create_lab_test_items() |
| 17 | create_lab_test_template() |
| 18 | create_sensitivity() |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 19 | |
| 20 | def create_medical_departments(): |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 21 | 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 Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 28 | mediacal_department = frappe.new_doc("Medical Department") |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 29 | mediacal_department.department = _(department) |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 30 | try: |
| 31 | mediacal_department.save() |
| 32 | except frappe.DuplicateEntryError: |
| 33 | pass |
| 34 | |
| 35 | def create_antibiotics(): |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 36 | 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 Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 68 | 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 | |
| 76 | def 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 | |
| 104 | def 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 | |
| 135 | def 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 | |
| 176 | def 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 | |
| 185 | def create_lab_test_items(): |
| 186 | records = [ |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 187 | {"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 188 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 189 | {"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 190 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 191 | {"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 192 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 193 | {"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 194 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 195 | {"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 196 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 197 | {"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 198 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 199 | {"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 200 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}, |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 201 | {"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": _("Laboratory"), |
Rushabh Mehta | b9fe146 | 2017-09-30 10:46:29 +0530 | [diff] [blame] | 202 | "stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1} |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 203 | ] |
| 204 | insert_record(records) |
| 205 | |
| 206 | def create_lab_test_template(): |
| 207 | records = [ |
| 208 | {"doctype": "Lab Test Template", "name": "MCH","test_name": "MCH","test_code": "MCH", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 209 | "test_group": _("Laboratory"),"department": _("Haematology"),"item": "MCH", |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 210 | "test_template_type": "Single","is_billable": 1,"test_rate": 0.0,"test_uom": "Microgram", |
| 211 | "test_normal_range": "27 - 32 Microgram", |
| 212 | "sensitivity": 0,"test_description": "Mean Corpuscular Hemoglobin"}, |
| 213 | {"doctype": "Lab Test Template", "name": "LDL","test_name": "LDL (Serum)","test_code": "LDL", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 214 | "test_group": _("Laboratory"),"department": _("Biochemistry"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 215 | "item": "LDL","test_template_type": "Single", |
| 216 | "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "70 - 160 mg/dlLow-density Lipoprotein (LDL)", |
| 217 | "sensitivity": 0,"test_description": "Low-density Lipoprotein (LDL)"}, |
| 218 | {"doctype": "Lab Test Template", "name": "GTT","test_name": "GTT","test_code": "GTT", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 219 | "test_group": _("Laboratory"),"department": _("Haematology"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 220 | "item": "GTT","test_template_type": "Single", |
| 221 | "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "Less than 85 mg/dl", |
| 222 | "sensitivity": 0,"test_description": "Glucose Tolerance Test"}, |
| 223 | {"doctype": "Lab Test Template", "name": "HDL","test_name": "HDL (Serum)","test_code": "HDL", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 224 | "test_group": _("Laboratory"),"department": _("Biochemistry"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 225 | "item": "HDL","test_template_type": "Single", |
| 226 | "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "35 - 65 mg/dl", |
| 227 | "sensitivity": 0,"test_description": "High-density Lipoprotein (HDL)"}, |
| 228 | {"doctype": "Lab Test Template", "name": "BILT","test_name": "Bilirubin Total","test_code": "BILT", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 229 | "test_group": _("Laboratory"),"department": _("Biochemistry"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 230 | "item": "BILT","test_template_type": "Single", |
| 231 | "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.2 - 1.2 mg / dl", |
| 232 | "sensitivity": 0,"test_description": "Bilirubin Total"}, |
| 233 | {"doctype": "Lab Test Template", "name": "BILD","test_name": "Bilirubin Direct","test_code": "BILD", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 234 | "test_group": _("Laboratory"),"department": _("Biochemistry"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 235 | "item": "BILD","test_template_type": "Single", |
| 236 | "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.4 mg / dl", |
| 237 | "sensitivity": 0,"test_description": "Bilirubin Direct"}, |
| 238 | |
| 239 | {"doctype": "Lab Test Template", "name": "BP","test_name": "Bile Pigment","test_code": "BP", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 240 | "test_group": _("Laboratory"),"department": _("Pathology"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 241 | "item": "BP","test_template_type": "Single", |
| 242 | "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "", |
| 243 | "sensitivity": 0,"test_description": "Bile Pigment"}, |
| 244 | {"doctype": "Lab Test Template", "name": "BS","test_name": "Bile Salt","test_code": "BS", |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 245 | "test_group": _("Laboratory"),"department": _("Pathology"), |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 246 | "item": "BS","test_template_type": "Single", |
| 247 | "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "", |
| 248 | "sensitivity": 0,"test_description": "Bile Salt"} |
| 249 | ] |
| 250 | insert_record(records) |
| 251 | |
| 252 | def create_sensitivity(): |
| 253 | records = [ |
mbauskar | ee9da67 | 2017-10-10 12:15:48 +0530 | [diff] [blame] | 254 | {"doctype": "Sensitivity", "sensitivity": _("Low Sensitivity")}, |
| 255 | {"doctype": "Sensitivity", "sensitivity": _("High Sensitivity")}, |
| 256 | {"doctype": "Sensitivity", "sensitivity": _("Moderate Sensitivity")}, |
| 257 | {"doctype": "Sensitivity", "sensitivity": _("Susceptible")}, |
| 258 | {"doctype": "Sensitivity", "sensitivity": _("Resistant")}, |
| 259 | {"doctype": "Sensitivity", "sensitivity": _("Intermediate")} |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 260 | ] |
| 261 | insert_record(records) |
| 262 | |
| 263 | def insert_record(records): |
| 264 | for r in records: |
| 265 | doc = frappe.new_doc(r.get("doctype")) |
| 266 | doc.update(r) |
| 267 | try: |
| 268 | doc.insert(ignore_permissions=True) |
| 269 | except frappe.DuplicateEntryError, e: |
| 270 | # pass DuplicateEntryError and continue |
| 271 | if e.args and e.args[0]==doc.doctype and e.args[1]==doc.name: |
| 272 | # make sure DuplicateEntryError is for the exact same doc and not a related doc |
| 273 | pass |
| 274 | else: |
| 275 | raise |