Commit 07e176af authored by Ángel Ramírez Isea's avatar Ángel Ramírez Isea
Browse files

style: PEP-8 a commed_history. refactor: Cambiar medical_history a commed_history.

parent 51d451de
# Copyright (C) 2008-2019 Luis Falcon <falcon@gnuhealth.org>
# Copyright (C) 2011-2019 GNU Solidario <health@gnusolidario.org>
# Copyright 2020 LabViv.
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from . import reports
# Copyright (C) 2008-2019 Luis Falcon <falcon@gnuhealth.org>
# Copyright (C) 2011-2019 GNU Solidario <health@gnusolidario.org>
# Copyright 2020 LabViv.
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
{
'name': 'Community Medical - Medical history',
'description': 'Community Medical personal and medical history package',
'author': 'LabViv',
'website': 'https://git.labviv.org.ve/',
'category': 'Medical',
'version': '13.0.0.0.1',
'depends': [
'base',
'commed_base',
'commed_lifestyle',
'commed_center',
'commed_disease',
'commed_practitioner',
'commed_vaccination',
'commed_pathology',
'commed_gyneco',
'commed_evaluation',
'commed_genetics'
],
'data': [
'reports/report_definition.xml',
'reports/patient_evaluation_report.xml',
],
'installable': True,
'maintainer': 'Julio César Méndez <mendezjcx@thoriumcorp.website>'
}
# Copyright (C) 2008-2019 Luis Falcon <falcon@gnuhealth.org>
# Copyright (C) 2011-2019 GNU Solidario <health@gnusolidario.org>
# Copyright 2020 LabViv.
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from . import patient_evaluation_report
# Copyright (C) 2008-2019 Luis Falcon <falcon@gnuhealth.org>
# Copyright (C) 2011-2019 GNU Solidario <health@gnusolidario.org>
# Copyright 2020 LabViv.
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from odoo import models, api
class ReportCommedHistoryPatientEvaluation(models.AbstractModel):
_name = 'report.commed_history.patient_evaluation'
def get_marital_status(self, ids):
this = self.env["commed.patient"].search([('id', '=', ids)])
for record in this:
if record.marital_status == 's':
aux = 'Single'
elif record.marital_status == 'm':
aux = 'Married'
elif record.marital_status == 'w':
aux = 'Widow(er)'
elif record.marital_status == 'd':
aux = 'Divorced'
else:
aux = 'Separated'
return aux
def get_loc_eyes(self, ids):
this = self.env["commed.patient_evaluation"].search([('id', '=', ids)])
for record in this:
if record.loc_eyes == '1':
aux = 'Does not Open Eyes'
elif record.loc_eyes == '2':
aux = 'Opens eyes in response to painful stimuli'
elif record.loc_eyes == '3':
aux = 'Opens eyes in response to voice'
else:
aux = 'Opens eyes spontaneously'
return aux
def get_loc_verbal(self, ids):
this = self.env["commed.patient_evaluation"].search([('id', '=', ids)])
for record in this:
if record.loc_verbal == '1':
aux = 'Makes no sounds'
elif record.loc_verbal == '2':
aux = 'Incomprehensible sounds'
elif record.loc_verbal == '3':
aux = 'Utters inappropriate words'
elif record.loc_verbal == '4':
aux = 'Confused, disoriented'
else:
aux = 'Oriented, converses normally'
return aux
def get_loc_motor(self, ids):
this = self.env["commed.patient_evaluation"].search([('id', '=', ids)])
for record in this:
if record.loc_motor == '1':
aux = 'Makes no movement'
elif record.loc_motor == '2':
aux = 'Extension to painful stimuli - decerebrate response -'
elif record.loc_motor == '3':
aux = 'Abnormal flexion to painful stimuli \
(decorticate response)'
elif record.loc_motor == '4':
aux = 'Flexion / Withdrawal to painful stimuli'
elif record.loc_motor == '5':
aux = 'Localizes painful stimuli'
else:
aux = 'Obeys commands'
return aux
def get_discharge_reason(self, ids):
this = self.env["commed.patient_evaluation"].search([('id', '=', ids)])
for record in this:
if record.discharge_reason == 'home':
aux = 'Home / Selfcare'
elif record.discharge_reason == 'transfer':
aux = 'Transferred to another institution'
else:
aux = 'Death'
return aux
def get_xory(self, ids):
this = self.env["commed.patient_family_diseases"].\
search([('patient', '=', ids)])
for record in this:
if record.xory == 'm':
aux = 'Maternal'
elif record.xory == 'f':
aux = 'Paternal'
elif record.xory == 's':
aux = 'Sibling'
else:
aux = ''
return aux
def get_relative(self, ids):
this = self.env["commed.patient_family_diseases"].\
search([('patient', '=', ids)])
for record in this:
if record.relative == 'mother':
aux = 'Mother'
elif record.relative == 'father':
aux = 'Father'
elif record.relative == 'brother':
aux = 'Brother'
elif record.relative == 'sister':
aux = 'Sister'
elif record.relative == 'aunt':
aux = 'Aunt'
elif record.relative == 'uncle':
aux = 'Uncle'
elif record.relative == 'nephew':
aux = 'Nephew'
elif record.relative == 'niece':
aux = 'Niece'
elif record.relative == 'grandfather':
aux = 'Grandfather'
elif record.relative == 'grandmother':
aux = 'Grandmother'
else:
aux = 'Cousin'
return aux
def get_sexual_preferences(self, ids):
this = self.env["commed.patient"].search([('id', '=', ids)])
for record in this:
if record.sexual_preferences == 'h':
aux = 'Heterosexual'
elif record.sexual_preferences == 'g':
aux = 'Homosexual'
elif record.sexual_preferences == 'b':
aux = 'Bisexual'
else:
aux = 'Transexual'
return aux
@api.model
def _get_report_values(self, docids, data=None):
patient = self.env['commed.patient_evaluation'].browse(docids)
return {
'doc_ids': docids,
'doc_model': 'commed.patient_evaluation',
'docs': patient,
'data': data,
'marital_status': self.get_marital_status,
'loc_eyes': self.get_loc_eyes,
'loc_verbal': self.get_loc_verbal,
'loc_motor': self.get_loc_motor,
'discharge_reason': self.get_discharge_reason,
'xory': self.get_xory,
'relative': self.get_relative,
'sexual_preferences': self.get_sexual_preferences,
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 LabViv.
License GPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). -->
<odoo>
<report
id="report_patient_evaluation_action"
model="commed.patient_evaluation"
string="Patient evaluation"
report_type="qweb-pdf"
name="medical_history.patient_evaluation"
file="medical_history.patient_evaluation"
/>
<record id="paperformat_report_contract_sale_portrait" model="report.paperformat">
<field name="name">Report Letter Portrait Evaluation</field>
<field name="format">Letter</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">35</field>
<field name="margin_bottom">13</field>
<field name="margin_left">10</field>
<field name="margin_right">10</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">30</field>
<field name="dpi">90</field>
<field name="report_ids"
eval="[(6, 0, [ref('report_patient_evaluation_action')])]"/>
</record>
</odoo>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment