[domain] Healthcare (#10664)
* Medical module for erpnext
* Changes in core for Medical module
* patient registration updated
* fix - appointment invioce - fields missing
* pages- indicator instead of bg-color
* Lab Test field renamed service type
* Department added Lab Test
* procedure name in prescription
* fixes sample collection
* filter disabled patient
* fix patient admission
* updated patient age
* availability check msg updated
* fixes, removed procedure from invoice
* sample print renamed
* fixes, validation
* service desk physician in filter
* refactor scheduler
* Appointment -field property - set only once = 1
* Appointment - Mark closed and pending buttons removed
* Appointment - readonly = 1 if value set
* Appointment - availabilty
* Appointment - Cancel - info - cancel invoice
* Appointment - set pending appointments
* Dosage form - new DT
* Drug Prescription - Dosage form added
* Facility - Floor - removed from Fecility
* Floor - removed
* Lab Test Template - item creation validation
* Procedure - Create Procedure
* Procedure Appointment - new DT
* Service Unit - Floor reference removed
* Zone Fcilities - Unused DT removed
* Appointment Desk - fixed
* Service Desk - method pointing from procedure changed to procedure_appointment
* Consultation print - got featured
* Consultation - removed patient refernce to procedure prescription
* Procedure Prescription - removed patient refernce
* Lab Test - Changed field properties and value
* Lab Test - field property changed
* Lab Test - methods rewrite - lab test doc creation
* Lab Test - create lab test from invoice and consultaion - got changed
* Button History changed to Medical Record
* Service Desk - Updated
* Notification - Procedure Appointment
* fix-get procedure prescription
* fix field added to test prescription
* msgprint on invoice creation
* fix data on install
* Merge branch erpnext/develop
* fixes- minor
* Setup wizard - Create Sensitivity
* Appointment - Validate and Save if there is no schedule for Physician
* Consultation - Button create vital signs and medical record
* Review Type - New DocType
* Review Detail and Treatment Plan - Childs - Consultation
* Patient Medical Record - field Attach doc
* Consultation - New Fields
* Consultation - Manage new Fields - Medical record add action
* Patient Relation - Child DocType - Patient
* Patient - Patient Relation added
* Patient - collapsible = 1
* Laboratory Settings - fields - message for lab test
* Laboratory Settings - get message for lab test
* SMS text for lab test and invoice test report
* Procedure Stock Detail - Stock detail for Procedure and Template
* Template Stage Detail - Stage detail for Procedure Template
* Procedure Stage Detail - Stage detail for Procedure
* Service Unit - field - warehouse
* Scheduler - msg - content changed
* Laboratory Settings - defualt - msg content
* Invoice Test Report - msg print
* Print Format-Changed-Consultation-Invoice Test Report-Lab Test
* OP Settings - Expnse Account for Stock Entry in Procedure
* Procedure and Procedure Template - Manage Stock Stage and Sample Collection
* Procedure Appointment - Manage Stock and Stage
* Lab Test - fixed - resource not find
* Invoice Test Report - fixed - resource not find
* Procedure - doc reload after insert
* Patient Medical Record - fixed - refernce missed
* Create Vital Signs -on client side
* Rename module Medical to Healthcare
* Remove In Patient (IP) Feature.
* Rename - Procedure to Clinical Procedure
* Remove spaces in Naming Series
* Rename Duration to Drug Prescription Duration
* Duration to Drug Prescription Duration
* Merge All Settings to Healthcare Settings
* Healthcare settings - import fixed
* Procedure related documents are removed
* Appointment Desk and Sevrvice Desk are removed
* Consultation - minimal
* Consultation - minimal
* Consultation - minimal - patient detials in collapsible section
* Message Print to Alerts
* Patient - some fields removed
* Patient - create consultation - message print to alerts
* Consultation - show patient details updated
* Setup wizard - Duration to Drug Prescritpion Duration
* Healthcare Settings - patient registration - fee collection
* Lab Test - Create Sales Invoice bug fixed
* Healthcare menu rearranged
* Healthcare Settings - Optimised and Rearragnged
* Healthcare Settings - Expense account removed
* Receivable account removed from patient
* Patient - Optimised and Rearragnged
* Removed Referring Physician
* Healthcare Settings - bold headings removed
* Physician - Patient - Fields are Segregated
* Remove Service Unit
* Remove - Service Type
* Consultation invoice
* Lab Test - invoice
* Patient - Invoice
* Rename Appointment to Patient Appointment
* wip
* Patient Dashboard, Physician Form cleanup
* Dosage renamed to Prescription Dosage
* Renamed Drug Prescription Duration to Prescription Duration
* Patient Appointment booking modal
* Patient Age - calculate by dob
* Remove - scheduler
* Consultation - Appointment to Patient Appointment
* Patient Dashboard - rearranged
* Patient Appointment
* Removed rer_physician from lab test and consultation
* Patient Appontment Changes
* Appointment and Consultation - optimized
* Patient Appointment - fee validity code optimized
* Consultation and Patient Appointment - Invoice validate two side
* fix: #13 remove relation to admission
* Healthcare - Patient Portal
* fix import error
* domain Healthcare added on install
* Removed - Invoice Test Report
* Physician Schedule - menu
* Consultation - patient details - re write
* New Doctype-Medical Code
* Consultation - Daignosis codification
* Medical Code - Codification - Settings
* Medical Code Standard - Medical Code - Codification - Settings
* fix appointment calendar
* fix appointment analytics
* Menu Medical Code Standard
* New Doctype - Medical Code Standard
* Set Physician Role insted of IP Physician and OP Physician Role
* fixed some json files
* Medical code - permission to physician
* Unused Childs - Work Schedule and User List - Removed
* Label Procedure to Lab Test
* Lab Test and Patient - code optimised
* Add Item Groups - setup wizard
* Healthcare Settings - add Role - Medical Administrator
* Healthcare - Demo setup - Make Demo
* Fee Validity - Logic Test
* Test Fee Validity - Optimised
* Healthcare Doctypes - Restricted to Domain Healthcare
* Domainify - remove Healthcare Roles - Other Domains
* Healthcare doctypes - beta checked
* Codacy fixes
* Codacy - fixes
* Codacy - fixes
* Codacy - fixes
* Codacy - fixes
* Codacy - fixes
* Lab Test - print hide =1 for some fields
* Consultation - Codification field label to Medical Coding
* Codacy fixes - import frappe and etc.
* Codacy fixes - import frappe in test_vital_signs
* Codacy fixes
* Codacy fixes
* Codacy fixes and remove delete perm for patient
* send_sms - import form frappe
* Healthcare Settings
* Lab Prescription - Consultation - Test Code - read_only = 0
* Portal fixes
* Patient Appointment - filter physician - if has schedule
* Physician - IP Charge - Removed
* test - files
* Web Form - Patient Profile - removed
* Role Medical Administrator to Healthcare Administrator
* WIP healthcare documentation
* Coday - fixes
* Travis - fixes
* Lab Test Report - menu
* Reorder Healthcare settings - group lab config to bottom
* Sample Collection - New - allow Sample and patient Selection
* Rate - similar behaviour and Label as in Item Standard Selling Rate
* Healthcare documentation
* Lab Test Samples to Lab Test sample
* Commplaints to Complaint
* Commplaints to Complaint
* Antibiotics to Antibiotic
* Appointment Token Number - remove
* View - Medical record
* Codacy fixes
* update healthcare docs
* Cleanup Docs - Search, quick entry, trsck change, etc.
* [minor] ux changes
diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py
index 7f333cc..ddb2a80 100644
--- a/erpnext/setup/setup_wizard/domainify.py
+++ b/erpnext/setup/setup_wizard/domainify.py
@@ -12,7 +12,8 @@
'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
'Production Order', 'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling',
'Accounts', 'HR', 'ToDo'],
- 'remove_roles': ['Academics User', 'Instructor'],
+ 'remove_roles': ['Academics User', 'Instructor', 'Physician', 'Nursing User',
+ 'Laboratory user', 'LabTest Approver', 'Healthcare Administrator'],
'properties': [
{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'collapsible_depends_on', 'value': 'is_stock_item'},
],
@@ -25,7 +26,9 @@
'Retail': {
'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Purchase Order',
'Warranty Claim', 'Accounts', 'Task', 'Buying', 'ToDo'],
- 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+ 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+ 'Physician', 'Nursing User', 'Laboratory user',
+ 'LabTest Approver', 'Healthcare Administrator'],
'properties': [
{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
{'doctype': 'Customer', 'fieldname': 'credit_limit_section', 'property': 'hidden', 'value': 1},
@@ -39,7 +42,9 @@
'Distribution': {
'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order', 'Task',
'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'],
- 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+ 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+ 'Physician', 'Nursing User', 'Laboratory user',
+ 'LabTest Approver', 'Healthcare Administrator'],
'set_value': [
['Stock Settings', None, 'show_barcode_field', 1]
],
@@ -49,7 +54,9 @@
'Services': {
'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice',
'Lead', 'Opportunity', 'Task', 'Expense Claim', 'Employee', 'HR', 'ToDo'],
- 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+ 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+ 'Physician', 'Nursing User', 'Laboratory user',
+ 'LabTest Approver', 'Healthcare Administrator'],
'properties': [
{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
],
@@ -66,6 +73,13 @@
'Student', 'Projects User', 'Instructor'],
'default_portal_role': 'Student'
},
+ 'Healthcare': {
+ 'desktop_icons': ['Patient', 'Patient Appointment', 'Consultation', 'Lab Test', 'Healthcare',
+ 'Accounts', 'Buying', 'Stock', 'HR', 'ToDo'],
+ 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Projects User', 'Projects Manager',
+ 'Academics User', 'Instructor'],
+ 'default_portal_role': 'Patient'
+ },
}
if not domain in data:
raise 'Invalid Domain {0}'.format(domain)
diff --git a/erpnext/setup/setup_wizard/healthcare.py b/erpnext/setup/setup_wizard/healthcare.py
new file mode 100644
index 0000000..ebc644e
--- /dev/null
+++ b/erpnext/setup/setup_wizard/healthcare.py
@@ -0,0 +1,281 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
+from frappe import _
+
+def setup_healthcare():
+ create_medical_departments()
+ create_antibiotics()
+ create_test_uom()
+ create_duration()
+ create_dosage()
+ create_healthcare_item_groups()
+ create_lab_test_items()
+ create_lab_test_template()
+ create_sensitivity()
+ make_custom_fields()
+
+def make_custom_fields():
+ custom_fields = {
+ 'Sales Invoice': [
+ dict(fieldname='appointment', label='Patient Appointment',
+ fieldtype='Link', options='Patient Appointment',
+ insert_after='customer')
+ ]
+ }
+
+ create_custom_fields(custom_fields)
+
+
+def create_medical_departments():
+ depts = ["Accident and emergency care" ,"Anaesthetics", "Biochemistry", "Cardiology", "Dermatology",
+ "Diagnostic imaging", "ENT", "Gastroenterology", "General Surgery", "Gynaecology",
+ "Haematology", "Maternity", "Microbiology", "Nephrology", "Neurology", "Oncology",
+ "Orthopaedics", "Pathology", "Physiotherapy", "Rheumatology", "Serology", "Urology"]
+ for d in depts:
+ mediacal_department = frappe.new_doc("Medical Department")
+ mediacal_department.department = d
+ try:
+ mediacal_department.save()
+ except frappe.DuplicateEntryError:
+ pass
+
+def create_antibiotics():
+ abt = ["Amoxicillin", "Ampicillin", "Bacampicillin", "Carbenicillin", "Cloxacillin", "Dicloxacillin",
+ "Flucloxacillin", "Mezlocillin", "Nafcillin", "Oxacillin", "Penicillin G", "Penicillin V",
+ "Piperacillin", "Pivampicillin", "Pivmecillinam", "Ticarcillin", "Cefacetrile (cephacetrile)",
+ "Cefadroxil (cefadroxyl)", "Cefalexin (cephalexin)", "Cefaloglycin (cephaloglycin)",
+ "Cefalonium (cephalonium)", "Cefaloridine (cephaloradine)", "Cefalotin (cephalothin)",
+ "Cefapirin (cephapirin)", "Cefatrizine", "Cefazaflur", "Cefazedone", "Cefazolin (cephazolin)",
+ "Cefradine (cephradine)", "Cefroxadine", "Ceftezole", "Cefaclor", "Cefamandole", "Cefmetazole",
+ "Cefonicid", "Cefotetan", "Cefoxitin", "Cefprozil (cefproxil)", "Cefuroxime", "Cefuzonam",
+ "Cefcapene", "Cefdaloxime", "Cefdinir", "Cefditoren", "Cefetamet", "Cefixime", "Cefmenoxime",
+ "Cefodizime", "Cefotaxime", "Cefpimizole", "Cefpodoxime", "Cefteram", "Ceftibuten", "Ceftiofur",
+ "Ceftiolene", "Ceftizoxime", "Ceftriaxone", "Cefoperazone", "Ceftazidime", "Cefclidine", "Cefepime",
+ "Cefluprenam", "Cefoselis", "Cefozopran", "Cefpirome", "Cefquinome", "Ceftobiprole", "Ceftaroline",
+ "Cefaclomezine","Cefaloram", "Cefaparole", "Cefcanel", "Cefedrolor", "Cefempidone", "Cefetrizole",
+ "Cefivitril", "Cefmatilen", "Cefmepidium", "Cefovecin", "Cefoxazole", "Cefrotil", "Cefsumide",
+ "Cefuracetime", "Ceftioxide", "Ceftazidime/Avibactam", "Ceftolozane/Tazobactam", "Aztreonam",
+ "Imipenem", "Imipenem/cilastatin", "Doripenem", "Meropenem", "Ertapenem", "Azithromycin",
+ "Erythromycin", "Clarithromycin", "Dirithromycin", "Roxithromycin", "Telithromycin", "Clindamycin",
+ "Lincomycin", "Pristinamycin", "Quinupristin/dalfopristin", "Amikacin", "Gentamicin", "Kanamycin",
+ "Neomycin", "Netilmicin", "Paromomycin", "Streptomycin", "Tobramycin", "Flumequine", "Nalidixic acid",
+ "Oxolinic acid", "Piromidic acid", "Pipemidic acid", "Rosoxacin", "Ciprofloxacin", "Enoxacin",
+ "Lomefloxacin", "Nadifloxacin", "Norfloxacin", "Ofloxacin", "Pefloxacin", "Rufloxacin", "Balofloxacin",
+ "Gatifloxacin", "Grepafloxacin", "Levofloxacin", "Moxifloxacin", "Pazufloxacin", "Sparfloxacin",
+ "Temafloxacin", "Tosufloxacin", "Besifloxacin", "Clinafloxacin", "Gemifloxacin",
+ "Sitafloxacin", "Trovafloxacin", "Prulifloxacin", "Sulfamethizole", "Sulfamethoxazole",
+ "Sulfisoxazole", "Trimethoprim-Sulfamethoxazole", "Demeclocycline", "Doxycycline", "Minocycline",
+ "Oxytetracycline", "Tetracycline", "Tigecycline", "Chloramphenicol", "Metronidazole",
+ "Tinidazole", "Nitrofurantoin", "Vancomycin", "Teicoplanin", "Telavancin", "Linezolid",
+ "Cycloserine 2", "Rifampin", "Rifabutin", "Rifapentine", "Rifalazil", "Bacitracin", "Polymyxin B",
+ "Viomycin", "Capreomycin"]
+ for a in abt:
+ antibiotic = frappe.new_doc("Antibiotic")
+ antibiotic.antibiotic_name = a
+ try:
+ antibiotic.save()
+ except frappe.DuplicateEntryError:
+ pass
+
+def create_test_uom():
+ records = [
+ {"doctype": "Lab Test UOM", "name": "umol/L", "test_uom": "umol/L", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "mg/L", "test_uom": "mg/L", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "mg / dl", "test_uom": "mg / dl", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "pg / ml", "test_uom": "pg / ml", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "U/ml", "test_uom": "U/ml", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "/HPF", "test_uom": "/HPF", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "Million Cells / cumm", "test_uom": "Million Cells / cumm", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "Lakhs Cells / cumm", "test_uom": "Lakhs Cells / cumm", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "U / L", "test_uom": "U / L", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "g / L", "test_uom": "g / L", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "IU / ml", "test_uom": "IU / ml", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "gm %", "test_uom": "gm %", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "Microgram", "test_uom": "Microgram", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "Micron", "test_uom": "Micron", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "Cells / cumm", "test_uom": "Cells / cumm", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "%", "test_uom": "%", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "mm / dl", "test_uom": "mm / dl", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "mm / hr", "test_uom": "mm / hr", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "ulU / ml", "test_uom": "ulU / ml", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "ng / ml", "test_uom": "ng / ml", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "ng / dl", "test_uom": "ng / dl", "uom_description": None },
+ {"doctype": "Lab Test UOM", "name": "ug / dl", "test_uom": "ug / dl", "uom_description": None }
+ ]
+
+ insert_record(records)
+
+def create_duration():
+ records = [
+ {"doctype": "Prescription Duration", "name": "3 Month", "number": "3", "period": "Month" },
+ {"doctype": "Prescription Duration", "name": "2 Month", "number": "2", "period": "Month" },
+ {"doctype": "Prescription Duration", "name": "1 Month", "number": "1", "period": "Month" },
+ {"doctype": "Prescription Duration", "name": "12 Hour", "number": "12", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "11 Hour", "number": "11", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "10 Hour", "number": "10", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "9 Hour", "number": "9", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "8 Hour", "number": "8", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "7 Hour", "number": "7", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "6 Hour", "number": "6", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "5 Hour", "number": "5", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "4 Hour", "number": "4", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "3 Hour", "number": "3", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "2 Hour", "number": "2", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "1 Hour", "number": "1", "period": "Hour" },
+ {"doctype": "Prescription Duration", "name": "5 Week", "number": "5", "period": "Week" },
+ {"doctype": "Prescription Duration", "name": "4 Week", "number": "4", "period": "Week" },
+ {"doctype": "Prescription Duration", "name": "3 Week", "number": "3", "period": "Week" },
+ {"doctype": "Prescription Duration", "name": "2 Week", "number": "2", "period": "Week" },
+ {"doctype": "Prescription Duration", "name": "1 Week", "number": "1", "period": "Week" },
+ {"doctype": "Prescription Duration", "name": "6 Day", "number": "6", "period": "Day" },
+ {"doctype": "Prescription Duration", "name": "5 Day", "number": "5", "period": "Day" },
+ {"doctype": "Prescription Duration", "name": "4 Day", "number": "4", "period": "Day" },
+ {"doctype": "Prescription Duration", "name": "3 Day", "number": "3", "period": "Day" },
+ {"doctype": "Prescription Duration", "name": "2 Day", "number": "2", "period": "Day" },
+ {"doctype": "Prescription Duration", "name": "1 Day", "number": "1", "period": "Day" }
+ ]
+ insert_record(records)
+
+def create_dosage():
+ records = [
+ {"doctype": "Prescription Dosage", "name": "1-1-1-1", "dosage": "1-1-1-1","dosage_strength":
+ [{"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"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "0-0-1", "dosage": "0-0-1","dosage_strength":
+ [{"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "1-0-0", "dosage": "1-0-0","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "0-1-0", "dosage": "0-1-0","dosage_strength":
+ [{"strength": "1.0","strength_time": "14:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "1-1-1", "dosage": "1-1-1","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "1-0-1", "dosage": "1-0-1","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "Once Bedtime", "dosage": "Once Bedtime","dosage_strength":
+ [{"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "5 times a day", "dosage": "5 times a day","dosage_strength":
+ [{"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"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "QID", "dosage": "QID","dosage_strength":
+ [{"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"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "TID", "dosage": "TID","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "BID", "dosage": "BID","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
+ },
+ {"doctype": "Prescription Dosage", "name": "Once Daily", "dosage": "Once Daily","dosage_strength":
+ [{"strength": "1.0","strength_time": "9:00:00"}]
+ }
+ ]
+ insert_record(records)
+
+def create_healthcare_item_groups():
+ records = [
+ {'doctype': 'Item Group', 'item_group_name': _('Laboratory'),
+ 'is_group': 0, 'parent_item_group': _('All Item Groups') },
+ {'doctype': 'Item Group', 'item_group_name': _('Drug'),
+ 'is_group': 0, 'parent_item_group': _('All Item Groups') }
+ ]
+ insert_record(records)
+
+def create_lab_test_items():
+ records = [
+ {"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+ {"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": "Laboratory",
+ "stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
+ ]
+ insert_record(records)
+
+def create_lab_test_template():
+ records = [
+ {"doctype": "Lab Test Template", "name": "MCH","test_name": "MCH","test_code": "MCH",
+ "test_group": "Laboratory","department": "Haematology","item": "MCH",
+ "test_template_type": "Single","is_billable": 1,"test_rate": 0.0,"test_uom": "Microgram",
+ "test_normal_range": "27 - 32 Microgram",
+ "sensitivity": 0,"test_description": "Mean Corpuscular Hemoglobin"},
+ {"doctype": "Lab Test Template", "name": "LDL","test_name": "LDL (Serum)","test_code": "LDL",
+ "test_group": "Laboratory","department": "Biochemistry",
+ "item": "LDL","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "70 - 160 mg/dlLow-density Lipoprotein (LDL)",
+ "sensitivity": 0,"test_description": "Low-density Lipoprotein (LDL)"},
+ {"doctype": "Lab Test Template", "name": "GTT","test_name": "GTT","test_code": "GTT",
+ "test_group": "Laboratory","department": "Haematology",
+ "item": "GTT","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "Less than 85 mg/dl",
+ "sensitivity": 0,"test_description": "Glucose Tolerance Test"},
+ {"doctype": "Lab Test Template", "name": "HDL","test_name": "HDL (Serum)","test_code": "HDL",
+ "test_group": "Laboratory","department": "Biochemistry",
+ "item": "HDL","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "35 - 65 mg/dl",
+ "sensitivity": 0,"test_description": "High-density Lipoprotein (HDL)"},
+ {"doctype": "Lab Test Template", "name": "BILT","test_name": "Bilirubin Total","test_code": "BILT",
+ "test_group": "Laboratory","department": "Biochemistry",
+ "item": "BILT","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.2 - 1.2 mg / dl",
+ "sensitivity": 0,"test_description": "Bilirubin Total"},
+ {"doctype": "Lab Test Template", "name": "BILD","test_name": "Bilirubin Direct","test_code": "BILD",
+ "test_group": "Laboratory","department": "Biochemistry",
+ "item": "BILD","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.4 mg / dl",
+ "sensitivity": 0,"test_description": "Bilirubin Direct"},
+
+ {"doctype": "Lab Test Template", "name": "BP","test_name": "Bile Pigment","test_code": "BP",
+ "test_group": "Laboratory","department": "Pathology",
+ "item": "BP","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
+ "sensitivity": 0,"test_description": "Bile Pigment"},
+ {"doctype": "Lab Test Template", "name": "BS","test_name": "Bile Salt","test_code": "BS",
+ "test_group": "Laboratory","department": "Pathology",
+ "item": "BS","test_template_type": "Single",
+ "is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
+ "sensitivity": 0,"test_description": "Bile Salt"}
+ ]
+ insert_record(records)
+
+def create_sensitivity():
+ records = [
+ {"doctype": "Sensitivity", "sensitivity": "Low Sensitivity"},
+ {"doctype": "Sensitivity", "sensitivity": "High Sensitivity"},
+ {"doctype": "Sensitivity", "sensitivity": "Moderate Sensitivity"},
+ {"doctype": "Sensitivity", "sensitivity": "Susceptible"},
+ {"doctype": "Sensitivity", "sensitivity": "Resistant"},
+ {"doctype": "Sensitivity", "sensitivity": "Intermediate"}
+ ]
+ insert_record(records)
+
+def insert_record(records):
+ for r in records:
+ doc = frappe.new_doc(r.get("doctype"))
+ doc.update(r)
+ try:
+ doc.insert(ignore_permissions=True)
+ except frappe.DuplicateEntryError, e:
+ # pass DuplicateEntryError and continue
+ if e.args and e.args[0]==doc.doctype and e.args[1]==doc.name:
+ # make sure DuplicateEntryError is for the exact same doc and not a related doc
+ pass
+ else:
+ raise
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index 53e58a1..8e0973d 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -19,6 +19,7 @@
{ 'doctype': 'Domain', 'domain': _('Retail')},
{ 'doctype': 'Domain', 'domain': _('Services')},
{ 'doctype': 'Domain', 'domain': _('Education')},
+ { 'doctype': 'Domain', 'domain': _('Healthcare')},
# Setup Progress
{'doctype': "Setup Progress", "actions": [
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 40d11e5..20f8b85 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -10,6 +10,7 @@
from frappe import _
from frappe.utils.file_manager import save_file
from .default_website import website_maker
+from .healthcare import setup_healthcare
import install_fixtures
from .sample_data import make_sample_data
from erpnext.accounts.doctype.account.account import RootNotEditable
@@ -37,6 +38,9 @@
create_academic_year()
create_academic_term()
+ if args.domain.lower() == 'healthcare':
+ setup_healthcare()
+
if args.get('setup_website'):
website_maker(args)
@@ -414,3 +418,4 @@
academic_year.save()
except frappe.DuplicateEntryError:
pass
+