chore: Removed healthcare module code in other modules
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index ba06716..23ce4e4 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -7,10 +7,8 @@
 import unittest
 
 import frappe
-from frappe import MandatoryError
 
 from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from healthcare.healthcare.doctype.lab_test_template.lab_test_template import make_item_price
 from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
 from erpnext.stock.doctype.item.test_item import make_item
 from erpnext.stock.get_item_details import get_item_details
@@ -623,3 +621,12 @@
 		"Pricing Rule Item Group", "Pricing Rule Brand"]:
 
 		frappe.db.sql("delete from `tab{0}`".format(doctype))
+
+
+def make_item_price(item, price_list_name, item_price):
+	frappe.get_doc({
+		'doctype': 'Item Price',
+		'price_list': price_list_name,
+		'item_code': item,
+		'price_list_rate': item_price
+	}).insert(ignore_permissions=True, ignore_mandatory=True)
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 22aa4e5..af72d30 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -40,7 +40,6 @@
 	post_depreciation_entries,
 )
 from erpnext.controllers.selling_controller import SellingController
-from healthcare.healthcare.utils import manage_invoice_submit_cancel
 from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
 from erpnext.setup.doctype.company.company import update_company_current_month_sales
 from erpnext.stock.doctype.batch.batch import set_batch_nos
@@ -263,13 +262,6 @@
 		if self.redeem_loyalty_points and not self.is_consolidated and self.loyalty_points:
 			self.apply_loyalty_points()
 
-		# Healthcare Service Invoice.
-		domain_settings = frappe.get_doc('Domain Settings')
-		active_domains = [d.domain for d in domain_settings.active_domains]
-
-		if "Healthcare" in active_domains:
-			manage_invoice_submit_cancel(self, "on_submit")
-
 		self.process_common_party_accounting()
 
 	def validate_pos_return(self):
@@ -352,12 +344,6 @@
 
 		unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
 
-		# Healthcare Service Invoice.
-		domain_settings = frappe.get_doc('Domain Settings')
-		active_domains = [d.domain for d in domain_settings.active_domains]
-
-		if "Healthcare" in active_domains:
-			manage_invoice_submit_cancel(self, "on_cancel")
 		self.unlink_sales_invoice_from_timesheets()
 		self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation')
 
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 1582d8b..6d3ad38 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -686,36 +686,6 @@
 
 @frappe.whitelist()
 @frappe.validate_and_sanitize_search_inputs
-def get_healthcare_service_units(doctype, txt, searchfield, start, page_len, filters):
-	query = """
-		select name
-		from `tabHealthcare Service Unit`
-		where
-			is_group = 0
-			and company = {company}
-			and name like {txt}""".format(
-				company = frappe.db.escape(filters.get('company')), txt = frappe.db.escape('%{0}%'.format(txt)))
-
-	if filters and filters.get('inpatient_record'):
-		from healthcare.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
-			get_current_healthcare_service_unit,
-		)
-		service_unit = get_current_healthcare_service_unit(filters.get('inpatient_record'))
-
-		# if the patient is admitted, then appointments should be allowed against the admission service unit,
-		# inspite of it being an Inpatient Occupancy service unit
-		if service_unit:
-			query += " and (allow_appointments = 1 or name = {service_unit})".format(service_unit = frappe.db.escape(service_unit))
-		else:
-			query += " and allow_appointments = 1"
-	else:
-		query += " and allow_appointments = 1"
-
-	return frappe.db.sql(query, filters)
-
-
-@frappe.whitelist()
-@frappe.validate_and_sanitize_search_inputs
 def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
 
 	item_doc = frappe.get_cached_doc('Item', filters.get('item_code'))
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 5be2420..bd744b2 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -6,7 +6,7 @@
 import frappe.utils
 
 import erpnext
-from erpnext.demo.setup import education, healthcare, manufacture, retail, setup_data
+from erpnext.demo.setup import education, manufacture, retail, setup_data
 from erpnext.demo.user import accounts
 from erpnext.demo.user import education as edu
 from erpnext.demo.user import fixed_asset, hr, manufacturing, projects, purchase, sales, stock
@@ -38,8 +38,6 @@
 		retail.setup_data()
 	elif domain== 'Education':
 		education.setup_data()
-	elif domain== 'Healthcare':
-		healthcare.setup_data()
 
 	site = frappe.local.site
 	frappe.destroy()
diff --git a/erpnext/demo/domains.py b/erpnext/demo/domains.py
index b1db7b5..7f48b92 100644
--- a/erpnext/demo/domains.py
+++ b/erpnext/demo/domains.py
@@ -16,9 +16,6 @@
 	'Education': {
 		'company_name': 'Whitmore College'
 	},
-	'Healthcare': {
-		'company_name': 'ABC Hospital Ltd.'
-	},
 	'Agriculture': {
 		'company_name': 'Schrute Farms'
   },
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 42f83a3..af53043 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -196,10 +196,6 @@
 		'Purchase Manager', 'Projects User', 'Manufacturing User', 'Manufacturing Manager',
 		'Support Team')
 
-	if domain == "Healthcare":
-		user.add_roles('Physician', 'Healthcare Administrator', 'Laboratory User',
-			'Nursing User', 'Patient')
-
 	if domain == "Education":
 		user.add_roles('Academics User')
 
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index bf45fed..dff5cc6 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -69,7 +69,6 @@
 	'Agriculture': 'erpnext.domains.agriculture',
 	'Distribution': 'erpnext.domains.distribution',
 	'Education': 'erpnext.domains.education',
-	'Healthcare': 'erpnext.domains.healthcare',
 	'Hospitality': 'erpnext.domains.hospitality',
 	'Manufacturing': 'erpnext.domains.manufacturing',
 	'Non Profit': 'erpnext.domains.non_profit',
@@ -164,7 +163,6 @@
 ]
 
 standard_portal_menu_items = [
-	{"title": _("Personal Details"), "route": "/personal-details", "reference_doctype": "Patient", "role": "Patient"},
 	{"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
 	{"title": _("Request for Quotations"), "route": "/rfq", "reference_doctype": "Request for Quotation", "role": "Supplier"},
 	{"title": _("Supplier Quotation"), "route": "/supplier-quotations", "reference_doctype": "Supplier Quotation", "role": "Supplier"},
@@ -177,9 +175,6 @@
 	{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"},
 	{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
 	{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
-	{"title": _("Lab Test"), "route": "/lab-test", "reference_doctype": "Lab Test", "role":"Patient"},
-	{"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Patient Encounter", "role":"Patient"},
-	{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
 	{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"},
 	{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"},
 	{"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission", "role": "Student"},
@@ -214,10 +209,6 @@
 	"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
 	"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
 	"Timesheet": "erpnext.controllers.website_list_for_contact.has_website_permission",
-	"Lab Test": "healthcare.healthcare.web_form.lab_test.lab_test.has_website_permission",
-	"Patient Encounter": "healthcare.healthcare.web_form.prescription.prescription.has_website_permission",
-	"Patient Appointment": "healthcare.healthcare.web_form.patient_appointments.patient_appointments.has_website_permission",
-	"Patient": "healthcare.healthcare.web_form.personal_details.personal_details.has_website_permission"
 }
 
 dump_report_map = "erpnext.startup.report_data_map.data_map"
@@ -226,15 +217,11 @@
 
 standard_queries = {
 	"Customer": "erpnext.selling.doctype.customer.customer.get_customer_list",
-	"Healthcare Practitioner": "healthcare.healthcare.doctype.healthcare_practitioner.healthcare_practitioner.get_practitioner_list"
 }
 
 doc_events = {
 	"*": {
 		"validate": "erpnext.support.doctype.service_level_agreement.service_level_agreement.apply",
-		"on_submit": "healthcare.healthcare.doctype.patient_history_settings.patient_history_settings.create_medical_record",
-		"on_update_after_submit": "healthcare.healthcare.doctype.patient_history_settings.patient_history_settings.update_medical_record",
-		"on_cancel": "healthcare.healthcare.doctype.patient_history_settings.patient_history_settings.delete_medical_record"
 	},
 	"Stock Entry": {
 		"on_submit": "erpnext.stock.doctype.material_request.material_request.update_completed_and_requested_qty",
@@ -295,7 +282,6 @@
 			'erpnext.regional.india.utils.validate_gstin_for_india',
 			'erpnext.regional.italy.utils.set_state_code',
 			'erpnext.regional.india.utils.update_gst_category',
-			'healthcare.healthcare.utils.update_address_links'
 		],
 	},
 	'Supplier': {
@@ -307,7 +293,7 @@
 	"Contact": {
 		"on_trash": "erpnext.support.doctype.issue.issue.update_issue",
 		"after_insert": "erpnext.telephony.doctype.call_log.call_log.link_existing_conversations",
-		"validate": ["erpnext.crm.utils.update_lead_phone_numbers", "healthcare.healthcare.utils.update_patient_email_and_phone_numbers"]
+		"validate": ["erpnext.crm.utils.update_lead_phone_numbers"]
 	},
 	"Email Unsubscribe": {
 		"after_insert": "erpnext.crm.doctype.email_campaign.email_campaign.unsubscribe_recipient"
@@ -325,7 +311,6 @@
 # if payment entry not in auto cancel exempted doctypes it will cancel payment entry.
 auto_cancel_exempted_doctypes= [
 	"Payment Entry",
-	"Inpatient Medication Entry"
 ]
 
 after_migrate = ["erpnext.setup.install.update_select_perm_after_install"]
@@ -338,7 +323,6 @@
 	},
 	"all": [
 		"erpnext.projects.doctype.project.project.project_status_update_reminder",
-		"healthcare.healthcare.doctype.patient_appointment.patient_appointment.send_appointment_reminder",
 		"erpnext.crm.doctype.social_media_post.social_media_post.process_scheduled_social_media_posts"
 	],
 	"hourly": [
@@ -379,7 +363,6 @@
 		"erpnext.crm.doctype.email_campaign.email_campaign.send_email_to_leads_or_contacts",
 		"erpnext.crm.doctype.email_campaign.email_campaign.set_email_campaign_status",
 		"erpnext.selling.doctype.quotation.quotation.set_expired_status",
-		"healthcare.healthcare.doctype.patient_appointment.patient_appointment.update_appointment_status",
 		"erpnext.buying.doctype.supplier_quotation.supplier_quotation.set_expired_status",
 		"erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts.send_auto_email",
 		"erpnext.non_profit.doctype.membership.membership.set_expired_status"
@@ -532,32 +515,6 @@
 		{"doctype": "Maintenance Visit", "index": 46},
 		{"doctype": "Warranty Claim", "index": 47},
 	],
-	"Healthcare": [
-		{'doctype': 'Patient', 'index': 1},
-		{'doctype': 'Medical Department', 'index': 2},
-		{'doctype': 'Vital Signs', 'index': 3},
-		{'doctype': 'Healthcare Practitioner', 'index': 4},
-		{'doctype': 'Patient Appointment', 'index': 5},
-		{'doctype': 'Healthcare Service Unit', 'index': 6},
-		{'doctype': 'Patient Encounter', 'index': 7},
-		{'doctype': 'Antibiotic', 'index': 8},
-		{'doctype': 'Diagnosis', 'index': 9},
-		{'doctype': 'Lab Test', 'index': 10},
-		{'doctype': 'Clinical Procedure', 'index': 11},
-		{'doctype': 'Inpatient Record', 'index': 12},
-		{'doctype': 'Sample Collection', 'index': 13},
-		{'doctype': 'Patient Medical Record', 'index': 14},
-		{'doctype': 'Appointment Type', 'index': 15},
-		{'doctype': 'Fee Validity', 'index': 16},
-		{'doctype': 'Practitioner Schedule', 'index': 17},
-		{'doctype': 'Dosage Form', 'index': 18},
-		{'doctype': 'Lab Test Sample', 'index': 19},
-		{'doctype': 'Prescription Duration', 'index': 20},
-		{'doctype': 'Prescription Dosage', 'index': 21},
-		{'doctype': 'Sensitivity', 'index': 22},
-		{'doctype': 'Complaint', 'index': 23},
-		{'doctype': 'Medical Code', 'index': 24},
-	],
 	"Education": [
 		{'doctype': 'Article', 'index': 1},
 		{'doctype': 'Video', 'index': 2},
diff --git a/erpnext/modules.txt b/erpnext/modules.txt
index 62f5dce..a9f94ce 100644
--- a/erpnext/modules.txt
+++ b/erpnext/modules.txt
@@ -15,7 +15,6 @@
 Maintenance
 Education
 Regional
-Healthcare
 Restaurant
 Agriculture
 ERPNext Integrations
@@ -26,4 +25,4 @@
 Communication
 Loan Management
 Payroll
-Telephony
\ No newline at end of file
+Telephony
diff --git a/erpnext/non_profit/doctype/donation/donation.py b/erpnext/non_profit/doctype/donation/donation.py
index 3a6c5ee..880a983 100644
--- a/erpnext/non_profit/doctype/donation/donation.py
+++ b/erpnext/non_profit/doctype/donation/donation.py
@@ -170,9 +170,6 @@
 
 def get_company_for_donations():
 	company = frappe.db.get_single_value('Non Profit Settings', 'donation_company')
-	if not company:
-		from healthcare.healthcare.setup import get_company
-		company = get_company()
 	return company
 
 
diff --git a/erpnext/non_profit/doctype/membership/membership.py b/erpnext/non_profit/doctype/membership/membership.py
index 173e292..b64daa5 100644
--- a/erpnext/non_profit/doctype/membership/membership.py
+++ b/erpnext/non_profit/doctype/membership/membership.py
@@ -354,9 +354,6 @@
 
 def get_company_for_memberships():
 	company = frappe.db.get_single_value("Non Profit Settings", "company")
-	if not company:
-		from healthcare.healthcare.setup import get_company
-		company = get_company()
 	return company
 
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f7f3ddf..a48daa5 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -30,15 +30,12 @@
 erpnext.patches.v11_0.set_default_email_template_in_hr #08-06-2018
 erpnext.patches.v11_0.uom_conversion_data #30-06-2018
 erpnext.patches.v11_0.update_account_type_in_party_type
-erpnext.patches.v11_0.rename_healthcare_doctype_and_fields
 erpnext.patches.v11_0.rename_supplier_type_to_supplier_group
 erpnext.patches.v10_1.transfer_subscription_to_auto_repeat
 erpnext.patches.v11_0.update_brand_in_item_price
 erpnext.patches.v11_0.create_default_success_action
-erpnext.patches.v11_0.add_healthcare_service_unit_tree_root
 erpnext.patches.v11_0.rename_field_max_days_allowed
 erpnext.patches.v11_0.create_salary_structure_assignments
-erpnext.patches.v11_0.rename_health_insurance
 erpnext.patches.v11_0.rebuild_tree_for_company
 erpnext.patches.v11_0.create_department_records_for_each_company
 erpnext.patches.v11_0.make_location_from_warehouse
@@ -65,9 +62,7 @@
 erpnext.patches.v11_0.reset_publish_in_hub_for_all_items
 erpnext.patches.v11_0.update_hub_url # 2018-08-31  # 2018-09-03
 erpnext.patches.v11_0.make_job_card
-erpnext.patches.v11_0.redesign_healthcare_billing_work_flow
 erpnext.patches.v10_0.delete_hub_documents # 12-08-2018
-erpnext.patches.v11_0.rename_healthcare_fields
 erpnext.patches.v11_0.add_default_dispatch_notification_template
 erpnext.patches.v11_0.add_market_segments
 erpnext.patches.v11_0.add_sales_stages
@@ -169,7 +164,6 @@
 erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom
 erpnext.patches.v12_0.rename_account_type_doctype
 erpnext.patches.v12_0.recalculate_requested_qty_in_bin
-erpnext.patches.v12_0.update_healthcare_refactored_changes
 erpnext.patches.v12_0.set_total_batch_quantity
 erpnext.patches.v12_0.rename_mws_settings_fields
 erpnext.patches.v12_0.set_updated_purpose_in_pick_list
@@ -178,7 +172,6 @@
 erpnext.patches.v12_0.update_end_date_and_status_in_email_campaign
 erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123
 erpnext.patches.v12_0.fix_quotation_expired_status
-erpnext.patches.v12_0.update_appointment_reminder_scheduler_entry
 erpnext.patches.v12_0.rename_pos_closing_doctype
 erpnext.patches.v13_0.replace_pos_payment_mode_table #2020-12-29
 erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries #2020-05-22
@@ -196,7 +189,6 @@
 execute:frappe.reload_doc('desk', 'doctype', 'number_card_link')
 execute:frappe.delete_doc_if_exists('Dashboard', 'Accounts')
 erpnext.patches.v13_0.update_actual_start_and_end_date_in_wo
-erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes #2021-04-16
 erpnext.patches.v12_0.update_bom_in_so_mr
 execute:frappe.delete_doc("Report", "Department Analytics")
 execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
@@ -222,7 +214,6 @@
 erpnext.patches.v13_0.delete_report_requested_items_to_order
 erpnext.patches.v12_0.update_item_tax_template_company
 erpnext.patches.v13_0.move_branch_code_to_bank_account
-erpnext.patches.v13_0.healthcare_lab_module_rename_doctypes
 erpnext.patches.v13_0.add_standard_navbar_items #2021-03-24
 erpnext.patches.v13_0.stock_entry_enhancements
 erpnext.patches.v12_0.update_state_code_for_daman_and_diu
@@ -236,7 +227,6 @@
 erpnext.patches.v13_0.set_app_name
 erpnext.patches.v13_0.print_uom_after_quantity_patch
 erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account
-erpnext.patches.v13_0.create_healthcare_custom_fields_in_stock_entry_detail
 erpnext.patches.v13_0.updates_for_multi_currency_payroll
 erpnext.patches.v13_0.update_reason_for_resignation_in_employee
 execute:frappe.delete_doc("Report", "Quoted Item Comparison")
@@ -251,7 +241,6 @@
 erpnext.patches.v13_0.update_project_template_tasks
 erpnext.patches.v13_0.set_company_in_leave_ledger_entry
 erpnext.patches.v13_0.convert_qi_parameter_to_link_field
-erpnext.patches.v13_0.setup_patient_history_settings_for_standard_doctypes
 erpnext.patches.v13_0.add_naming_series_to_old_projects # 1-02-2021
 erpnext.patches.v13_0.update_payment_terms_outstanding
 erpnext.patches.v12_0.add_state_code_for_ladakh
@@ -263,7 +252,6 @@
 erpnext.patches.v13_0.setup_gratuity_rule_for_india_and_uae
 erpnext.patches.v13_0.setup_uae_vat_fields
 execute:frappe.db.set_value('System Settings', None, 'app_name', 'ERPNext')
-erpnext.patches.v13_0.rename_discharge_date_in_ip_record
 erpnext.patches.v12_0.create_taxable_value_field
 erpnext.patches.v12_0.add_gst_category_in_delivery_note
 erpnext.patches.v12_0.purchase_receipt_status
diff --git a/erpnext/patches/v11_0/refactor_naming_series.py b/erpnext/patches/v11_0/refactor_naming_series.py
index 9f231ed..a124ff8 100644
--- a/erpnext/patches/v11_0/refactor_naming_series.py
+++ b/erpnext/patches/v11_0/refactor_naming_series.py
@@ -27,7 +27,6 @@
 	'Fee Schedule': 'EDU-FSH-.YYYY.-',
 	'Fee Structure': 'EDU-FST-.YYYY.-',
 	'Fees': 'EDU-FEE-.YYYY.-',
-	'Inpatient Record': 'HLC-INP-.YYYY.-',
 	'Installation Note': 'MAT-INS-.YYYY.-',
 	'Instructor': 'EDU-INS-.YYYY.-',
 	'Issue': 'ISS-.YYYY.-',
@@ -43,9 +42,6 @@
 	'Member': 'NPO-MEM-.YYYY.-',
 	'Opportunity': 'CRM-OPP-.YYYY.-',
 	'Packing Slip': 'MAT-PAC-.YYYY.-',
-	'Patient': 'HLC-PAT-.YYYY.-',
-	'Patient Encounter': 'HLC-ENC-.YYYY.-',
-	'Patient Medical Record': 'HLC-PMR-.YYYY.-',
 	'Payment Entry': 'ACC-PAY-.YYYY.-',
 	'Payment Request': 'ACC-PRQ-.YYYY.-',
 	'Production Plan': 'MFG-PP-.YYYY.-',