test: Healthcare Consultation DocTypes
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
index 99a4b91..181c0e3 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
@@ -112,7 +112,7 @@
 
 		return allow_start
 
-	def make_material_receipt(self):
+	def make_material_receipt(self, submit=False):
 		stock_entry = frappe.new_doc('Stock Entry')
 
 		stock_entry.stock_entry_type = 'Material Receipt'
@@ -133,6 +133,9 @@
 				cost_center = frappe.get_cached_value('Company',  self.company,  'cost_center')
 				se_child.cost_center = cost_center
 				se_child.expense_account = expense_account
+		if submit:
+			stock_entry.submit()
+			return stock_entry
 		return stock_entry.as_dict()
 
 
diff --git a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
index 09059e1..9c65e12 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
@@ -4,6 +4,61 @@
 from __future__ import unicode_literals
 
 import unittest
+import frappe
+from frappe.utils import nowdate
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_clinical_procedure_template
 
 class TestClinicalProcedure(unittest.TestCase):
-	pass
+	def test_procedure_template_item(self):
+		patient, medical_department, practitioner = create_healthcare_docs()
+		procedure_template = create_clinical_procedure_template()
+		self.assertTrue(frappe.db.exists('Item', procedure_template.item))
+
+		procedure_template.disabled = 1
+		procedure_template.save()
+		self.assertEquals(frappe.db.get_value('Item', procedure_template.item, 'disabled'), 1)
+
+	def test_consumables(self):
+		patient, medical_department, practitioner = create_healthcare_docs()
+		procedure_template = create_clinical_procedure_template()
+		procedure_template.allow_stock_consumption = 1
+		consumable = create_consumable()
+		procedure_template.append('items', {
+			'item_code': consumable.item_code,
+			'qty': 1,
+			'uom': consumable.stock_uom,
+			'stock_uom': consumable.stock_uom
+		})
+		procedure_template.save()
+		procedure = create_procedure(procedure_template, patient, practitioner)
+		result = procedure.start_procedure()
+		if result == 'insufficient stock':
+			material_receipt = procedure.make_material_receipt(submit=True)
+			result = procedure.start_procedure()
+		self.assertEqual(procedure.status, 'In Progress')
+		result = procedure.complete_procedure()
+		# check consumption
+		self.assertTrue(frappe.db.exists('Stock Entry', result))
+
+
+def create_consumable():
+	if frappe.db.exists('Item', 'Syringe'):
+		return frappe.get_doc('Item', 'Syringe')
+	consumable = frappe.new_doc('Item')
+	consumable.item_code = 'Syringe'
+	consumable.item_group = '_Test Item Group'
+	consumable.stock_uom = 'Nos'
+	consumable.valuation_rate = 5.00
+	consumable.save()
+	return consumable
+
+def create_procedure(procedure_template, patient, practitioner):
+	procedure = frappe.new_doc('Clinical Procedure')
+	procedure.procedure_template = procedure_template.name
+	procedure.patient = patient
+	procedure.practitioner = practitioner
+	procedure.consume_stock = procedure_template.allow_stock_consumption
+	procedure.items = procedure_template.items
+	procedure.warehouse = frappe.db.get_single_value('Stock Settings', 'default_warehouse')
+	procedure.submit()
+	return procedure
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
index ec9a4cb..4b2d96e 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
@@ -27,13 +27,6 @@
 			else:
 				frappe.db.set_value('Item', self.item, 'disabled', 0)
 
-	def on_trash(self):
-		if self.item:
-			try:
-				frappe.delete_doc('Item', self.item)
-			except Exception:
-				frappe.throw(_('Not permitted. Please disable the Procedure Template'), title='Not Permitted')
-
 	def update_item_and_item_price(self):
 		if self.is_billable and self.item:
 			item_doc = frappe.get_doc('Item', {'item_code': self.item})
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
index 3f32b10..237034b 100644
--- a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
@@ -7,6 +7,7 @@
 import unittest
 from frappe.utils.make_random import get_random
 from frappe.utils import nowdate, add_days, getdate
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_appointment
 
 test_dependencies = ["Company"]
 
@@ -16,41 +17,7 @@
 		frappe.db.sql("""delete from `tabFee Validity`""")
 
 	def test_fee_validity(self):
-		patient = get_random("Patient")
-		practitioner = get_random("Healthcare Practitioner")
-		medical_department = get_random("Medical Department")
-
-		item = create_healthcare_service_items()
-		healthcare_settings = frappe.get_single("Healthcare Settings")
-		healthcare_settings.enable_free_follow_ups = 1
-		healthcare_settings.max_visits = 2
-		healthcare_settings.valid_days = 7
-		healthcare_settings.automate_appointment_invoicing = 1
-		healthcare_settings.op_consulting_charge_item = item
-		healthcare_settings.save(ignore_permissions=True)
-
-		if not patient:
-			patient = frappe.new_doc("Patient")
-			patient.first_name = "_Test Patient"
-			patient.sex = "Male"
-			patient.save(ignore_permissions=True)
-			patient = patient.name
-
-		if not medical_department:
-			medical_department = frappe.new_doc("Medical Department")
-			medical_department.department = "_Test Medical Department"
-			medical_department.save(ignore_permissions=True)
-			department = medical_department.name
-
-		if not practitioner:
-			practitioner = frappe.new_doc("Healthcare Practitioner")
-			practitioner.first_name = "_Test Healthcare Practitioner"
-			practitioner.gender = 'Female'
-			practitioner.department = department
-			practitioner.op_consulting_charge = 500
-			practitioner.save(ignore_permissions=True)
-			practitioner = practitioner.name
-
+		patient, medical_department, practitioner = create_healthcare_docs()
 		# appointment should not be invoiced as it is within fee validity
 		appointment = create_appointment(patient, practitioner, nowdate())
 		invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
@@ -69,29 +36,4 @@
 		# appointment should be invoiced as it is not within fee validity and the max_visits are exceeded
 		appointment = create_appointment(patient, practitioner, add_days(nowdate(), 10), invoice=1)
 		invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
-		self.assertEqual(invoiced, 1)
-
-def create_appointment(patient, practitioner, appointment_date, invoice=0):
-	appointment = frappe.new_doc("Patient Appointment")
-	appointment.patient = patient
-	appointment.practitioner = practitioner
-	appointment.department = "_Test Medical Department"
-	appointment.appointment_date = appointment_date
-	appointment.company = "_Test Company"
-	appointment.duration = 15
-	if invoice:
-		appointment.mode_of_payment = "Cash"
-		appointment.paid_amount = 500
-	appointment.save(ignore_permissions=True)
-	return appointment
-
-def create_healthcare_service_items():
-	if frappe.db.exists("Item", "HLC-SI-001"):
-		return "HLC-SI-001"
-	item = frappe.new_doc("Item")
-	item.item_code = "HLC-SI-001"
-	item.item_name = "Consulting Charges"
-	item.item_group = "Services"
-	item.is_stock_item = 0
-	item.save()
-	return item.name
\ No newline at end of file
+		self.assertEqual(invoiced, 1)
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
index 77b6b6a..d32d7b6 100755
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
@@ -104,10 +104,14 @@
 def invoice_appointment(appointment_doc):
 	automate_invoicing = frappe.db.get_single_value('Healthcare Settings', 'automate_appointment_invoicing')
 	appointment_invoiced = frappe.db.get_value('Patient Appointment', appointment_doc.name, 'invoiced')
-	fee_validity = check_fee_validity(appointment_doc)
-	if not fee_validity:
-		if frappe.db.exists('Fee Validity Reference', {'appointment': appointment_doc.name}):
-			return
+	enable_free_follow_ups = frappe.db.get_single_value('Healthcare Settings', 'enable_free_follow_ups')
+	if enable_free_follow_ups:
+		fee_validity = check_fee_validity(appointment_doc)
+		if not fee_validity:
+			if frappe.db.exists('Fee Validity Reference', {'appointment': appointment_doc.name}):
+				return
+	else:
+		fee_validity = None
 
 	if automate_invoicing and not appointment_invoiced and not fee_validity:
 		sales_invoice = frappe.new_doc('Sales Invoice')
@@ -126,11 +130,10 @@
 		payment.amount = appointment_doc.paid_amount
 
 		sales_invoice.set_missing_values(for_validate=True)
-		frappe.as_json('Sales Invoice')
 		sales_invoice.save(ignore_permissions=True)
 		sales_invoice.submit()
 		frappe.msgprint(_('Sales Invoice {0} created as paid'.format(sales_invoice.name)), alert=True)
-		frappe.db.set_value('Patient Appointment', appointment_doc.name, 'invoiced', True)
+		frappe.db.set_value('Patient Appointment', appointment_doc.name, 'invoiced', 1)
 		frappe.db.set_value('Patient Appointment', appointment_doc.name, 'ref_sales_invoice', sales_invoice.name)
 
 
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
index 3536a5f..025f052 100644
--- a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
@@ -3,8 +3,137 @@
 # See license.txt
 from __future__ import unicode_literals
 import unittest
-
-# test_records = frappe.get_test_records('Patient Appointment')
+import frappe
+from erpnext.healthcare.doctype.patient_appointment.patient_appointment import update_status
+from frappe.utils import nowdate, add_days, getdate
+from frappe.utils.make_random import get_random
 
 class TestPatientAppointment(unittest.TestCase):
-	pass
+	def setUp(self):
+		frappe.db.sql("""delete from `tabPatient Appointment`""")
+		frappe.db.sql("""delete from `tabFee Validity""")
+
+	def test_status(self):
+		patient, medical_department, practitioner = create_healthcare_docs()
+		frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 0)
+		appointment = create_appointment(patient, practitioner, nowdate())
+		self.assertEquals(appointment.status, 'Open')
+		appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2))
+		self.assertEquals(appointment.status, 'Scheduled')
+		create_encounter(appointment)
+		self.assertEquals(frappe.db.get_value('Patient Appointment', appointment.name, 'status'), 'Closed')
+
+	def test_invoicing(self):
+		patient, medical_department, practitioner = create_healthcare_docs()
+		frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
+		frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 0)
+		appointment = create_appointment(patient, practitioner, nowdate())
+		self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'invoiced'), 0)
+
+		frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
+		appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2), invoice=1)
+		self.assertEqual(frappe.db.get_value('Patient Appointment', appointment.name, 'invoiced'), 1)
+		self.assertTrue(frappe.db.get_value('Patient Appointment', appointment.name, 'ref_sales_invoice'))
+
+	def test_appointment_cancel(self):
+		patient, medical_department, practitioner = create_healthcare_docs()
+		frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 1)
+		appointment = create_appointment(patient, practitioner, nowdate())
+		fee_validity = frappe.db.get_value('Fee Validity Reference', {'appointment': appointment.name}, 'parent')
+		# fee validity created
+		self.assertTrue(fee_validity)
+
+		visited = frappe.db.get_value('Fee Validity', fee_validity, 'visited')
+		update_status(appointment.name, 'Cancelled')
+		# check fee validity updated
+		self.assertEqual(frappe.db.get_value('Fee Validity', fee_validity, 'visited'), visited - 1)
+
+		frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
+		frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
+		appointment = create_appointment(patient, practitioner, nowdate(), invoice=1)
+		update_status(appointment.name, 'Cancelled')
+		# check invoice cancelled
+		sales_invoice = frappe.db.get_value('Patient Appointment', appointment.name, 'ref_sales_invoice')
+		self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice, 'status'), 'Cancelled')
+
+
+def create_healthcare_docs():
+	patient = get_random('Patient')
+	practitioner = get_random('Healthcare Practitioner')
+	medical_department = get_random('Medical Department')
+	if not patient:
+		patient = frappe.new_doc('Patient')
+		patient.first_name = '_Test Patient'
+		patient.sex = 'Female'
+		patient.save(ignore_permissions=True)
+		patient = patient.name
+
+	if not medical_department:
+		medical_department = frappe.new_doc('Medical Department')
+		medical_department.department = '_Test Medical Department'
+		medical_department.save(ignore_permissions=True)
+		department = medical_department.name
+
+	if not practitioner:
+		practitioner = frappe.new_doc('Healthcare Practitioner')
+		practitioner.first_name = '_Test Healthcare Practitioner'
+		practitioner.gender = 'Female'
+		practitioner.department = department
+		practitioner.op_consulting_charge = 500
+		practitioner.save(ignore_permissions=True)
+		practitioner = practitioner.name
+
+	return patient, medical_department, practitioner
+
+def create_encounter(appointment=None):
+	encounter = frappe.new_doc('Patient Encounter')
+	if appointment:
+		encounter.appointment = appointment.name
+		encounter.patient = appointment.patient
+		encounter.practitioner = appointment.practitioner
+		encounter.encounter_date = appointment.appointment_date
+		encounter.encounter_time = appointment.appointment_time
+		encounter.save()
+		encounter.submit()
+		return encounter
+
+def create_appointment(patient, practitioner, appointment_date, invoice=0, procedure_template=0):
+	create_healthcare_service_items()
+	appointment = frappe.new_doc('Patient Appointment')
+	appointment.patient = patient
+	appointment.practitioner = practitioner
+	appointment.department = '_Test Medical Department'
+	appointment.appointment_date = appointment_date
+	appointment.company = '_Test Company'
+	appointment.duration = 15
+	if invoice:
+		appointment.mode_of_payment = 'Cash'
+		appointment.paid_amount = 500
+	if procedure_template:
+		appointment.procedure_template = create_clinical_procedure_template().get('name')
+	appointment.save(ignore_permissions=True)
+	return appointment
+
+def create_healthcare_service_items():
+	if frappe.db.exists('Item', 'HLC-SI-001'):
+		return 'HLC-SI-001'
+	item = frappe.new_doc('Item')
+	item.item_code = 'HLC-SI-001'
+	item.item_name = 'Consulting Charges'
+	item.item_group = 'Services'
+	item.is_stock_item = 0
+	item.save()
+	return item.name
+
+def create_clinical_procedure_template():
+	if frappe.db.exists('Clinical Procedure Template', 'Knee Surgery and Rehab'):
+		return frappe.get_doc('Clinical Procedure Template', 'Knee Surgery and Rehab')
+	template = frappe.new_doc('Clinical Procedure Template')
+	template.template = 'Knee Surgery and Rehab'
+	template.item_code = 'Knee Surgery and Rehab'
+	template.item_group = 'Services'
+	template.is_billable = 1
+	template.description = 'Knee Surgery and Rehab'
+	template.rate = 50000
+	template.save()
+	return template
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js
index 93c02f6..d8f63bd 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_list.js
@@ -2,5 +2,5 @@
 (c) ESS 2015-16
 */
 frappe.listview_settings['Patient Encounter'] = {
-	filters:[["docstatus","!=","1"]]
+	filters:[["docstatus","!=","2"]]
 };
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
index c6a6b44..3655e24 100644
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
@@ -1,457 +1,155 @@
 {
- "allow_copy": 1, 
- "allow_guest_to_view": 0, 
- "allow_import": 1, 
- "allow_rename": 0, 
- "autoname": "naming_series:", 
- "beta": 1, 
- "creation": "2016-06-09 11:30:44.972056", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Setup", 
- "editable_grid": 0, 
+ "actions": [],
+ "allow_copy": 1,
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "beta": 1,
+ "creation": "2016-06-09 11:30:44.972056",
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "engine": "InnoDB",
+ "field_order": [
+  "naming_series",
+  "patient",
+  "status",
+  "column_break_2",
+  "attach",
+  "section_break_4",
+  "subject",
+  "section_break_8",
+  "communication_date",
+  "reference_doctype",
+  "reference_name",
+  "column_break_9",
+  "reference_owner",
+  "user"
+ ],
  "fields": [
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "", 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Series", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "HLC-PMR-.YYYY.-", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 1, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Series",
+   "options": "HLC-PMR-.YYYY.-",
+   "print_hide": 1,
+   "report_hide": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "patient", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Patient", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Patient", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "patient",
+   "fieldtype": "Link",
+   "ignore_user_permissions": 1,
+   "in_list_view": 1,
+   "label": "Patient",
+   "options": "Patient",
+   "search_index": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "column_break_2",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "attach", 
-   "fieldtype": "Attach", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "attach",
+   "fieldtype": "Attach",
+   "label": "Attach Medical Record"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "section_break_4", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "section_break_4",
+   "fieldtype": "Section Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "subject", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 1, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Subject", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "subject",
+   "fieldtype": "Small Text",
+   "ignore_xss_filter": 1,
+   "label": "Subject"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Status", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Open\nClose", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "status",
+   "fieldtype": "Select",
+   "label": "Status",
+   "options": "Open\nClose",
+   "read_only": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "Today", 
-   "fieldname": "communication_date", 
-   "fieldtype": "Date", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Datetime", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "default": "Today",
+   "fieldname": "communication_date",
+   "fieldtype": "Date",
+   "in_list_view": 1,
+   "label": "Datetime",
+   "read_only": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_doctype", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Reference DocType", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "DocType", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "reference_doctype",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Reference DocType",
+   "options": "DocType",
+   "read_only": 1,
+   "search_index": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_name", 
-   "fieldtype": "Dynamic Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Reference Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "reference_name",
+   "fieldtype": "Dynamic Link",
+   "in_list_view": 1,
+   "label": "Reference Name",
+   "options": "reference_doctype",
+   "read_only": 1,
+   "search_index": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_from": "reference_name.owner", 
-   "fieldname": "reference_owner", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Reference Owner", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 1, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fetch_from": "reference_name.owner",
+   "fieldname": "reference_owner",
+   "fieldtype": "Data",
+   "label": "Reference Owner",
+   "no_copy": 1,
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "__user", 
-   "fieldname": "user", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "User", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "User", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 1, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
+   "default": "__user",
+   "fieldname": "user",
+   "fieldtype": "Link",
+   "label": "User",
+   "options": "User",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 1
+  },
+  {
+   "fieldname": "column_break_9",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "section_break_8",
+   "fieldtype": "Section Break"
   }
- ], 
- "has_web_view": 0, 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "idx": 0, 
- "image_view": 0, 
- "in_create": 1, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 0, 
- "max_attachments": 0, 
- "modified": "2018-08-21 14:44:37.927284", 
- "modified_by": "Administrator", 
- "module": "Healthcare", 
- "name": "Patient Medical Record", 
- "name_case": "", 
- "owner": "Administrator", 
+ ],
+ "in_create": 1,
+ "links": [],
+ "modified": "2020-03-23 19:26:59.308383",
+ "modified_by": "Administrator",
+ "module": "Healthcare",
+ "name": "Patient Medical Record",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Physician", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Physician",
+   "share": 1,
    "write": 1
   }
- ], 
- "quick_entry": 0, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "restrict_to_domain": "Healthcare", 
- "search_fields": "patient, subject, communication_date, reference_doctype, reference_name", 
- "show_name_in_global_search": 1, 
- "sort_field": "modified", 
- "sort_order": "DESC", 
- "title_field": "patient", 
- "track_changes": 1, 
- "track_seen": 1, 
- "track_views": 0
-}
+ ],
+ "restrict_to_domain": "Healthcare",
+ "search_fields": "patient, subject, communication_date, reference_doctype, reference_name",
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "patient",
+ "track_changes": 1,
+ "track_seen": 1
+}
\ No newline at end of file