Пример #1
0
def create_therapy_plan():
    patient = create_patient()
    therapy_type = create_therapy_type()
    plan = frappe.new_doc('Therapy Plan')
    plan.patient = patient
    plan.start_date = getdate()
    plan.append('therapy_plan_details', {
        'therapy_type': therapy_type.name,
        'no_of_sessions': 2
    })
    plan.save()
    return plan
Пример #2
0
def create_encounter(patient, medical_department, practitioner):
	encounter = frappe.new_doc('Patient Encounter')
	encounter.patient = patient
	encounter.practitioner = practitioner
	encounter.medical_department = medical_department
	therapy_type = create_therapy_type()
	encounter.append('therapies', {
		'therapy_type': therapy_type.name,
		'no_of_sessions': 2
	})
	encounter.save()
	encounter.submit()
	return encounter
Пример #3
0
def create_therapy_plan(template=None):
	patient = create_patient()
	therapy_type = create_therapy_type()
	plan = frappe.new_doc('Therapy Plan')
	plan.patient = patient
	plan.start_date = getdate()

	if template:
		plan.therapy_plan_template = template
		plan = plan.set_therapy_details_from_template()
	else:
		plan.append('therapy_plan_details', {
			'therapy_type': therapy_type.name,
			'no_of_sessions': 2
		})

	plan.save()
	return plan
Пример #4
0
def create_therapy_plan_template():
	template_name = frappe.db.exists('Therapy Plan Template', 'Complete Rehab')
	if not template_name:
		therapy_type = create_therapy_type()
		template = frappe.new_doc('Therapy Plan Template')
		template.plan_name = template.item_code = template.item_name = 'Complete Rehab'
		template.item_group = 'Services'
		rate = frappe.db.get_value('Therapy Type', therapy_type.name, 'rate')
		template.append('therapy_types', {
			'therapy_type': therapy_type.name,
			'no_of_sessions': 2,
			'rate': rate,
			'amount': 2 * flt(rate)
		})
		template.save()
		template_name = template.name

	return template_name