Commit 72c266f9 authored by Ángel Ramírez Isea's avatar Ángel Ramírez Isea
Browse files

refactor: Podar gyneco para tener funcionalidad mínima en parroquiano.

parent 5d2abbad
......@@ -24,7 +24,7 @@
],
'data': [
'security/ir.model.access.csv',
'views/commed_gyneco_view.xml',
# 'views/commed_gyneco_view.xml',
],
'installable': True,
'maintainer': 'Julio César Méndez <mendezjcx@thoriumcorp.website>'
......
......@@ -15,14 +15,14 @@ class CommedPatientPregnancy(models.Model):
'commed.patient',
'Patient',
domain=[('gender', '=', 'female')],
required=True
required=False
)
gravida = fields.Integer(string='Pregnancy #', required=True)
gravida = fields.Integer(string='Pregnancy #', required=False)
computed_age = fields.Char(
string='Age',
help='Computed patient age at the moment of LMP',
compute='patient_age_at_pregnancy',
requerid=True
required=True
)
warning = fields.Boolean(
string='Warn',
......@@ -30,7 +30,7 @@ class CommedPatientPregnancy(models.Model):
)
warning_icon = fields.Char(
string='Pregnancy warning icon',
compute='get_warn_icon'
# compute='get_warn_icon'
)
reverse = fields.Boolean(
string='Reverse',
......@@ -46,32 +46,17 @@ class CommedPatientPregnancy(models.Model):
lmp = fields.Date(
string='LMP',
help="Last Menstrual Period",
required=True
required=False
)
pdd = fields.Date(
string='Pregnancy Due Date',
compute='get_pregnancy_data'
)
prenatal_evaluations = fields.One2many(
comodel_name='commed.patient_prenatal_evaluation',
inverse_name='name',
string='Prenatal Evaluations'
)
perinatal = fields.One2many(
comodel_name='commed.perinatal',
inverse_name='name',
string='Perinatal Info'
)
puerperium_monitor = fields.One2many(
comodel_name='commed.puerperium_monitor',
inverse_name='name',
string='Puerperium Monitor'
# compute='get_pregnancy_data'
)
current_pregnancy = fields.Boolean(
string='Current Pregnancy',
help='This field marks the current pregnancy'
)
fetuses = fields.Integer(string='Fetuses', required=True)
fetuses = fields.Integer(string='Fetuses', required=False)
monozygotic = fields.Boolean(string='Monozygotic')
pregnancy_end_result = fields.Selection(
[
......@@ -89,98 +74,133 @@ class CommedPatientPregnancy(models.Model):
pregnancy_end_age = fields.Integer(
string='Weeks',
help='Weeks at the end of pregnancy',
compute='get_pregnancy_data'
# compute='get_pregnancy_data'
)
iugr = fields.Selection(
[('symmetric', 'Symmetric'), ('assymetric', 'Asymmetric')],
string='IUGR',
sort=False
)
institution = fields.Many2one(
comodel_name='commed.center',
string='Institution',
domain=[('commed_type', '=', 'medical_center')]
)
healthprof = fields.Many2one(
comodel_name='commed.practitioner',
string='Health Prof',
readonly=True,
help="Health Professional who created this initial obstetric record"
)
gravidae = fields.Integer(
string='Pregnancies',
help="Number of pregnancies, computed from Obstetric history",
compute='patient_obstetric_info'
)
premature = fields.Integer(
string='Premature',
help="Preterm < 37 wks live births",
compute='patient_obstetric_info'
)
abortions = fields.Integer(
string='Abortions',
compute='patient_obstetric_info'
)
stillbirths = fields.Integer(
string='Stillbirths',
compute='patient_obstetric_info'
)
_sql_constraints = [(
'gravida_uniq',
'unique(name, gravida)',
'This pregnancy code for this patient already exists'
)]
def patient_obstetric_info(self):
self.gravidae = self.name.gravida
self.premature = self.name.premature
self.abortions = self.name.abortions
self.stillbirths = self.name.stillbirths
def patient_blood_info(self):
self.blood_type = self.name.blood_type
self.rh = self.name.rh
self.hb = self.name.hb
@api.onchange('name')
def on_change_name(self):
self.gravidae = self.name.gravida
self.premature = self.name.premature
self.abortions = self.name.abortions
self.stillbirths = self.name.stillbirths
self.blood_type = self.name.blood_type
self.rh = self.name.rh
self.hb = self.name.hb
@api.depends('reverse_weeks', 'pregnancy_end_date')
def on_change_with_lmp(self):
if (self.reverse_weeks and self.pregnancy_end_date):
estimated_lmp = datetime.\
date(self.pregnancy_end_date - timedelta(self.reverse_weeks*7))
return estimated_lmp
def patient_age_at_pregnancy(self):
for rec in self:
if (rec.name.birthdate_date and rec.lmp):
rdelta = relativedelta(rec.lmp, rec.name.birthdate_date)
rec.computed_age = str(rdelta.years)
def get_pregnancy_data(self):
for rec in self:
rec.pdd = self.lmp + timedelta(days=280)
if rec.pregnancy_end_date:
gestational_age = datetime.date(self.pregnancy_end_date) - \
self.lmp
rec.pregnancy_end_age = int((gestational_age.days) / 7)
else:
rec.pregnancy_end_age = 0
def get_warn_icon(self):
for rec in self:
rec.warning_icon = 'commed-normal'
if rec.warning:
rec.warning_icon = 'commed-warning'
# prenatal_evaluations = fields.One2many(
# comodel_name='commed.patient_prenatal_evaluation',
# inverse_name='name',
# string='Prenatal Evaluations'
# )
# perinatal = fields.One2many(
# comodel_name='commed.perinatal',
# inverse_name='name',
# string='Perinatal Info'
# )
# puerperium_monitor = fields.One2many(
# comodel_name='commed.puerperium_monitor',
# inverse_name='name',
# string='Puerperium Monitor'
# )
# institution = fields.Many2one(
# comodel_name='commed.center',
# string='Institution',
# domain=[('commed_type', '=', 'medical_center')]
# )
# healthprof = fields.Many2one(
# comodel_name='commed.practitioner',
# string='Health Prof',
# readonly=True,
# help="Health Professional who created this initial obstetric record"
# )
# gravidae = fields.Integer(
# string='Pregnancies',
# help="Number of pregnancies, computed from Obstetric history",
# compute='patient_obstetric_info'
# )
# premature = fields.Integer(
# string='Premature',
# help="Preterm < 37 wks live births",
# compute='patient_obstetric_info'
# )
# abortions = fields.Integer(
# string='Abortions',
# compute='patient_obstetric_info'
# )
# stillbirths = fields.Integer(
# string='Stillbirths',
# compute='patient_obstetric_info'
# )
#
# _sql_constraints = [(
# 'gravida_uniq',
# 'unique(name, gravida)',
# 'This pregnancy code for this patient already exists'
# )]
# def patient_obstetric_info(self):
# if self.name:
# if self.name.gravida:
# self.gravidae = self.name.gravida
# if self.name.premature:
# self.premature = self.name.premature
# if self.name.abortions:
# self.abortions = self.name.abortions
# if self.name.stillbirths:
# self.stillbirths = self.name.stillbirths
# def patient_blood_info(self):
# if self.name:
# if self.name.blood_type:
# self.blood_type = self.name.blood_type
# if self.name.rh:
# self.rh = self.name.rh
# if self.name.hb:
# self.hb = self.name.hb
# @api.onchange('name')
# def on_change_name(self):
# if self.name:
# if self.name.gravida:
# self.gravidae = self.name.gravida
# if self.name.premature:
# self.premature = self.name.premature
# if self.name.abortions:
# self.abortions = self.name.abortions
# if self.name.stillbirths:
# self.stillbirths = self.name.stillbirths
# if self.name.blood_type:
# self.blood_type = self.name.blood_type
# if self.name.rh:
# self.rh = self.name.rh
# if self.name.hb:
# self.hb = self.name.hb
# @api.depends('reverse_weeks', 'pregnancy_end_date')
# def on_change_with_lmp(self):
# if (self.reverse_weeks and self.pregnancy_end_date):
# estimated_lmp = datetime.\
# date(
# self.pregnancy_end_date - timedelta(self.reverse_weeks * 7)
# )
# return estimated_lmp
#
# def patient_age_at_pregnancy(self):
# for rec in self:
# if (rec.name.birthdate_date and rec.lmp):
# rdelta = relativedelta(rec.lmp, rec.name.birthdate_date)
# rec.computed_age = str(rdelta.years)
# def get_pregnancy_data(self):
# for rec in self:
# if self.lmp:
# rec.pdd = self.lmp + timedelta(days=280)
# if rec.pregnancy_end_date:
# gestational_age = datetime.date(self.pregnancy_end_date) - \
# self.lmp
# rec.pregnancy_end_age = int((gestational_age.days) / 7)
# else:
# rec.pregnancy_end_age = 0
# def get_warn_icon(self):
# for rec in self:
# rec.warning_icon = 'commed-normal'
# if rec.warning:
# rec.warning_icon = 'commed-warning'
class CommedPrenatalEvaluation(models.Model):
......@@ -867,7 +887,7 @@ class CommedPatientColposcopyHistory(models.Model):
def default_get(self, fields):
res = super(CommedPatientColposcopyHistory, self).default_get(fields)
res.update({
'evaluation_date': datetime.now(),
'last_colposcopy': datetime.now()
'evaluation_date': datetime.now(),
'last_colposcopy': datetime.now()
})
return res
......@@ -7,4 +7,4 @@ access_commed_patient_menstrual_history,access_commed_patient_menstrual_history,
access_commed_patient_mammography_history,access_commed_patient_mammography_history,model_commed_patient_mammography_history,base.group_user,1,1,1,1
access_commed_patient_pap_history,access_commed_patient_pap_history,model_commed_patient_pap_history,base.group_user,1,1,1,1
access_commed_patient_colposcopy_history,access_commed_patient_colposcopy_history,model_commed_patient_colposcopy_history,base.group_user,1,1,1,1
access_commed_patient_prenatal_evaluation,access_commed_patient_prenatal_evaluation,model_commed_patient_prenatal_evaluation,base.group_user,1,1,1,1
\ No newline at end of file
access_commed_patient_prenatal_evaluation,access_commed_patient_prenatal_evaluation,model_commed_patient_prenatal_evaluation,base.group_user,1,1,1,1
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