chore: Sample Collection Form clean-up
This commit is contained in:
parent
afa001a1d1
commit
fa2c20ea9e
@ -64,8 +64,8 @@ class LabTest(Document):
|
|||||||
if self.descriptive_test_items:
|
if self.descriptive_test_items:
|
||||||
for item in self.descriptive_test_items:
|
for item in self.descriptive_test_items:
|
||||||
if not item.result_value and not item.allow_blank and item.require_result_value:
|
if not item.result_value and not item.allow_blank and item.require_result_value:
|
||||||
frappe.throw(_('Row #{0}: Please enter the result value {1}').format(
|
frappe.throw(_('Row #{0}: Please enter the result value for {1}').format(
|
||||||
item.idx, frappe.bold(item.lab_test_name)), title=_('Mandatory Results'))
|
item.idx, frappe.bold(item.lab_test_particulars)), title=_('Mandatory Results'))
|
||||||
|
|
||||||
|
|
||||||
def create_test_from_template(lab_test):
|
def create_test_from_template(lab_test):
|
||||||
@ -103,7 +103,7 @@ def create_multiple(doctype, docname):
|
|||||||
lab_test_created = create_lab_test_from_encounter(docname)
|
lab_test_created = create_lab_test_from_encounter(docname)
|
||||||
|
|
||||||
if lab_test_created:
|
if lab_test_created:
|
||||||
frappe.msgprint(_('Lab Test(s) {0} created'.format(lab_test_created)), indicator='green')
|
frappe.msgprint(_('Lab Test(s) {0} created successfully').format(lab_test_created), indicator='green')
|
||||||
else:
|
else:
|
||||||
frappe.msgprint(_('No Lab Tests created'))
|
frappe.msgprint(_('No Lab Tests created'))
|
||||||
|
|
||||||
|
|||||||
@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Sample Collection', {
|
frappe.ui.form.on('Sample Collection', {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
if(frappe.defaults.get_default("create_sample_collection_for_lab_test")){
|
if (frappe.defaults.get_default('create_sample_collection_for_lab_test')) {
|
||||||
frm.add_custom_button(__("View Lab Tests"), function() {
|
frm.add_custom_button(__('View Lab Tests'), function() {
|
||||||
frappe.route_options = {"sample": frm.doc.name};
|
frappe.route_options = {'sample': frm.doc.name};
|
||||||
frappe.set_route("List", "Lab Test");
|
frappe.set_route('List', 'Lab Test');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("Sample Collection", "patient", function(frm) {
|
frappe.ui.form.on('Sample Collection', 'patient', function(frm) {
|
||||||
if(frm.doc.patient){
|
if(frm.doc.patient){
|
||||||
frappe.call({
|
frappe.call({
|
||||||
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
|
'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
|
||||||
args: {
|
args: {
|
||||||
patient: frm.doc.patient
|
patient: frm.doc.patient
|
||||||
},
|
},
|
||||||
@ -24,8 +24,8 @@ frappe.ui.form.on("Sample Collection", "patient", function(frm) {
|
|||||||
if (data.message.dob){
|
if (data.message.dob){
|
||||||
age = calculate_age(data.message.dob);
|
age = calculate_age(data.message.dob);
|
||||||
}
|
}
|
||||||
frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
|
frappe.model.set_value(frm.doctype,frm.docname, 'patient_age', age);
|
||||||
frappe.model.set_value(frm.doctype,frm.docname, "patient_sex", data.message.sex);
|
frappe.model.set_value(frm.doctype,frm.docname, 'patient_sex', data.message.sex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -36,5 +36,5 @@ var calculate_age = function(birth) {
|
|||||||
var age = new Date();
|
var age = new Date();
|
||||||
age.setTime(ageMS);
|
age.setTime(ageMS);
|
||||||
var years = age.getFullYear() - 1970;
|
var years = age.getFullYear() - 1970;
|
||||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,8 +9,10 @@
|
|||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
|
"patient_details_section",
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"patient",
|
"patient",
|
||||||
|
"patient_name",
|
||||||
"patient_age",
|
"patient_age",
|
||||||
"patient_sex",
|
"patient_sex",
|
||||||
"column_break_4",
|
"column_break_4",
|
||||||
@ -25,15 +27,17 @@
|
|||||||
"collected_by",
|
"collected_by",
|
||||||
"collected_time",
|
"collected_time",
|
||||||
"num_print",
|
"num_print",
|
||||||
"amended_from",
|
|
||||||
"section_break_15",
|
"section_break_15",
|
||||||
"sample_details"
|
"sample_details",
|
||||||
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fetch_from": "patient.inpatient_record",
|
"fetch_from": "patient.inpatient_record",
|
||||||
"fieldname": "inpatient_record",
|
"fieldname": "inpatient_record",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"label": "Inpatient Record",
|
"label": "Inpatient Record",
|
||||||
"options": "Inpatient Record",
|
"options": "Inpatient Record",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
@ -42,6 +46,8 @@
|
|||||||
"bold": 1,
|
"bold": 1,
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"label": "Series",
|
"label": "Series",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "HLC-SC-.YYYY.-",
|
"options": "HLC-SC-.YYYY.-",
|
||||||
@ -52,6 +58,8 @@
|
|||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "invoiced",
|
"fieldname": "invoiced",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"label": "Invoiced",
|
"label": "Invoiced",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
@ -61,41 +69,60 @@
|
|||||||
"fetch_from": "inpatient_record.patient",
|
"fetch_from": "inpatient_record.patient",
|
||||||
"fieldname": "patient",
|
"fieldname": "patient",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Patient",
|
"label": "Patient",
|
||||||
"options": "Patient",
|
"options": "Patient",
|
||||||
|
"reqd": 1,
|
||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_4",
|
"fieldname": "column_break_4",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "patient_age",
|
"fieldname": "patient_age",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Age"
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
|
"label": "Age",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "patient.sex",
|
"fetch_from": "patient.sex",
|
||||||
"fieldname": "patient_sex",
|
"fieldname": "patient_sex",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"label": "Gender"
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
|
"label": "Gender",
|
||||||
|
"options": "Gender",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"options": "Company"
|
"options": "Company"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_6",
|
"fieldname": "section_break_6",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
|
"label": "Sample Details"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sample",
|
"fieldname": "sample",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
@ -108,16 +135,23 @@
|
|||||||
"fetch_from": "sample.sample_uom",
|
"fetch_from": "sample.sample_uom",
|
||||||
"fieldname": "sample_uom",
|
"fieldname": "sample_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "UOM"
|
"label": "UOM",
|
||||||
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_10",
|
"fieldname": "column_break_10",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "collected_by",
|
"fieldname": "collected_by",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
"label": "Collected By",
|
"label": "Collected By",
|
||||||
"options": "User"
|
"options": "User"
|
||||||
@ -125,20 +159,27 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "collected_time",
|
"fieldname": "collected_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Collected Time"
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
|
"label": "Collected On"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"default": "1",
|
"default": "1",
|
||||||
|
"description": "Number of prints required for labelling the samples",
|
||||||
"fieldname": "num_print",
|
"fieldname": "num_print",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "No. of print",
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
|
"label": "No. of prints",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"report_hide": 1
|
"report_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"label": "Amended From",
|
"label": "Amended From",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Sample Collection",
|
"options": "Sample Collection",
|
||||||
@ -147,25 +188,43 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_15",
|
"fieldname": "section_break_15",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "sample_qty",
|
"fieldname": "sample_qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Quantity"
|
"label": "Quantity"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sample_details",
|
"fieldname": "sample_details",
|
||||||
"fieldtype": "Long Text",
|
"fieldtype": "Long Text",
|
||||||
|
"hide_days": 1,
|
||||||
|
"hide_seconds": 1,
|
||||||
"ignore_xss_filter": 1,
|
"ignore_xss_filter": 1,
|
||||||
"label": "Collection Details"
|
"label": "Collection Details"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "patient_details_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Patient Details"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fetch_from": "patient.patient_name",
|
||||||
|
"fieldname": "patient_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Patient Name",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-05-25 14:36:46.990469",
|
"modified": "2020-07-30 16:53:13.076104",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Sample Collection",
|
"name": "Sample Collection",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user