* 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
		
			
				
	
	
		
			336 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			336 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 | |
| # License: GNU General Public License v3. See license.txt
 | |
| 
 | |
| from __future__ import unicode_literals
 | |
| 
 | |
| # mappings for table dumps
 | |
| # "remember to add indexes!"
 | |
| 
 | |
| data_map = {
 | |
| 	"Company": {
 | |
| 		"columns": ["name"],
 | |
| 		"conditions": ["docstatus < 2"]
 | |
| 	},
 | |
| 	"Fiscal Year": {
 | |
| 		"columns": ["name", "year_start_date", "year_end_date"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 	},
 | |
| 
 | |
| 	# Accounts
 | |
| 	"Account": {
 | |
| 		"columns": ["name", "parent_account", "lft", "rgt", "report_type",
 | |
| 			"company", "is_group"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "lft",
 | |
| 		"links": {
 | |
| 			"company": ["Company", "name"],
 | |
| 		}
 | |
| 
 | |
| 	},
 | |
| 	"Cost Center": {
 | |
| 		"columns": ["name", "lft", "rgt"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "lft"
 | |
| 	},
 | |
| 	"GL Entry": {
 | |
| 		"columns": ["name", "account", "posting_date", "cost_center", "debit", "credit",
 | |
| 			"is_opening", "company", "voucher_type", "voucher_no", "remarks"],
 | |
| 		"order_by": "posting_date, account",
 | |
| 		"links": {
 | |
| 			"account": ["Account", "name"],
 | |
| 			"company": ["Company", "name"],
 | |
| 			"cost_center": ["Cost Center", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 
 | |
| 	# Stock
 | |
| 	"Item": {
 | |
| 		"columns": ["name", "if(item_name=name, '', item_name) as item_name", "description",
 | |
| 			"item_group as parent_item_group", "stock_uom", "brand", "valuation_method"],
 | |
| 		# "conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"parent_item_group": ["Item Group", "name"],
 | |
| 			"brand": ["Brand", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Item Group": {
 | |
| 		"columns": ["name", "parent_item_group"],
 | |
| 		# "conditions": ["docstatus < 2"],
 | |
| 		"order_by": "lft"
 | |
| 	},
 | |
| 	"Brand": {
 | |
| 		"columns": ["name"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Project": {
 | |
| 		"columns": ["name"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Warehouse": {
 | |
| 		"columns": ["name"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Stock Ledger Entry": {
 | |
| 		"columns": ["name", "posting_date", "posting_time", "item_code", "warehouse",
 | |
| 			"actual_qty as qty", "voucher_type", "voucher_no", "project",
 | |
| 			"incoming_rate as incoming_rate", "stock_uom", "serial_no",
 | |
| 			"qty_after_transaction", "valuation_rate"],
 | |
| 		"order_by": "posting_date, posting_time, name",
 | |
| 		"links": {
 | |
| 			"item_code": ["Item", "name"],
 | |
| 			"warehouse": ["Warehouse", "name"],
 | |
| 			"project": ["Project", "name"]
 | |
| 		},
 | |
| 		"force_index": "posting_sort_index"
 | |
| 	},
 | |
| 	"Serial No": {
 | |
| 		"columns": ["name", "purchase_rate as incoming_rate"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Stock Entry": {
 | |
| 		"columns": ["name", "purpose"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date, posting_time, name",
 | |
| 	},
 | |
| 	"Production Order": {
 | |
| 		"columns": ["name", "production_item as item_code",
 | |
| 			"(qty - produced_qty) as qty",
 | |
| 			"fg_warehouse as warehouse"],
 | |
| 		"conditions": ["docstatus=1", "status != 'Stopped'", "ifnull(fg_warehouse, '')!=''",
 | |
| 			"qty > produced_qty"],
 | |
| 		"links": {
 | |
| 			"item_code": ["Item", "name"],
 | |
| 			"warehouse": ["Warehouse", "name"]
 | |
| 		},
 | |
| 	},
 | |
| 	"Material Request Item": {
 | |
| 		"columns": ["item.name as name", "item_code", "warehouse",
 | |
| 			"(qty - ordered_qty) as qty"],
 | |
| 		"from": "`tabMaterial Request Item` item, `tabMaterial Request` main",
 | |
| 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
 | |
| 			"ifnull(warehouse, '')!=''", "qty > ordered_qty"],
 | |
| 		"links": {
 | |
| 			"item_code": ["Item", "name"],
 | |
| 			"warehouse": ["Warehouse", "name"]
 | |
| 		},
 | |
| 	},
 | |
| 	"Purchase Order Item": {
 | |
| 		"columns": ["item.name as name", "item_code", "warehouse",
 | |
| 			"(qty - received_qty)*conversion_factor as qty"],
 | |
| 		"from": "`tabPurchase Order Item` item, `tabPurchase Order` main",
 | |
| 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
 | |
| 			"ifnull(warehouse, '')!=''", "qty > received_qty"],
 | |
| 		"links": {
 | |
| 			"item_code": ["Item", "name"],
 | |
| 			"warehouse": ["Warehouse", "name"]
 | |
| 		},
 | |
| 	},
 | |
| 
 | |
| 	"Sales Order Item": {
 | |
| 		"columns": ["item.name as name", "item_code", "(qty - delivered_qty)*conversion_factor as qty", "warehouse"],
 | |
| 		"from": "`tabSales Order Item` item, `tabSales Order` main",
 | |
| 		"conditions": ["item.parent = main.name", "main.docstatus=1", "main.status != 'Stopped'",
 | |
| 			"ifnull(warehouse, '')!=''", "qty > delivered_qty"],
 | |
| 		"links": {
 | |
| 			"item_code": ["Item", "name"],
 | |
| 			"warehouse": ["Warehouse", "name"]
 | |
| 		},
 | |
| 	},
 | |
| 
 | |
| 	# Sales
 | |
| 	"Customer": {
 | |
| 		"columns": ["name", "if(customer_name=name, '', customer_name) as customer_name",
 | |
| 			"customer_group as parent_customer_group", "territory as parent_territory"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"parent_customer_group": ["Customer Group", "name"],
 | |
| 			"parent_territory": ["Territory", "name"],
 | |
| 		}
 | |
| 	},
 | |
| 	"Customer Group": {
 | |
| 		"columns": ["name", "parent_customer_group"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "lft"
 | |
| 	},
 | |
| 	"Territory": {
 | |
| 		"columns": ["name", "parent_territory"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "lft"
 | |
| 	},
 | |
| 	"Sales Invoice": {
 | |
| 		"columns": ["name", "customer", "posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date",
 | |
| 		"links": {
 | |
| 			"customer": ["Customer", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Sales Invoice Item": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Sales Invoice", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Sales Order": {
 | |
| 		"columns": ["name", "customer", "transaction_date as posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "transaction_date",
 | |
| 		"links": {
 | |
| 			"customer": ["Customer", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Sales Order Item[Sales Analytics]": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Sales Order", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Delivery Note": {
 | |
| 		"columns": ["name", "customer", "posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date",
 | |
| 		"links": {
 | |
| 			"customer": ["Customer", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Delivery Note Item[Sales Analytics]": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Delivery Note", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Supplier": {
 | |
| 		"columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
 | |
| 			"supplier_type as parent_supplier_type"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"parent_supplier_type": ["Supplier Type", "name"],
 | |
| 		}
 | |
| 	},
 | |
| 	"Supplier Type": {
 | |
| 		"columns": ["name"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Purchase Invoice": {
 | |
| 		"columns": ["name", "supplier", "posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date",
 | |
| 		"links": {
 | |
| 			"supplier": ["Supplier", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Purchase Invoice Item": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Purchase Invoice", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Purchase Order": {
 | |
| 		"columns": ["name", "supplier", "transaction_date as posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date",
 | |
| 		"links": {
 | |
| 			"supplier": ["Supplier", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Purchase Order Item[Purchase Analytics]": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Purchase Order", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Purchase Receipt": {
 | |
| 		"columns": ["name", "supplier", "posting_date", "company"],
 | |
| 		"conditions": ["docstatus=1"],
 | |
| 		"order_by": "posting_date",
 | |
| 		"links": {
 | |
| 			"supplier": ["Supplier", "name"],
 | |
| 			"company":["Company", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Purchase Receipt Item[Purchase Analytics]": {
 | |
| 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
 | |
| 		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 | |
| 		"order_by": "parent",
 | |
| 		"links": {
 | |
| 			"parent": ["Purchase Receipt", "name"],
 | |
| 			"item_code": ["Item", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	# Support
 | |
| 	"Issue": {
 | |
| 		"columns": ["name","status","creation","resolution_date","first_responded_on"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "creation"
 | |
| 	},
 | |
| 
 | |
| 	# Manufacturing
 | |
| 	"Production Order": {
 | |
| 		"columns": ["name","status","creation","planned_start_date","planned_end_date","status","actual_start_date","actual_end_date", "modified"],
 | |
| 		"conditions": ["docstatus = 1"],
 | |
| 		"order_by": "creation"
 | |
| 	},
 | |
| 
 | |
| 	#Medical
 | |
| 	"Patient": {
 | |
| 		"columns": ["name", "creation", "owner", "if(patient_name=name, '', patient_name) as patient_name"],
 | |
| 		"conditions": ["docstatus < 2"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"owner" : ["User", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Patient Appointment": {
 | |
| 		"columns": ["name", "appointment_type", "patient", "physician", "appointment_date", "department", "status", "company"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"physician": ["Physician", "name"],
 | |
| 			"appointment_type": ["Appointment Type", "name"]
 | |
| 		}
 | |
| 	},
 | |
| 	"Physician": {
 | |
| 		"columns": ["name", "department"],
 | |
| 		"order_by": "name",
 | |
| 		"links": {
 | |
| 			"department": ["Department", "name"],
 | |
| 		}
 | |
| 
 | |
| 	},
 | |
| 	"Appointment Type": {
 | |
| 		"columns": ["name"],
 | |
| 		"order_by": "name"
 | |
| 	},
 | |
| 	"Medical Department": {
 | |
| 		"columns": ["name"],
 | |
| 		"order_by": "name"
 | |
| 	}
 | |
| }
 |