Initial commit: SKEEN Derma Experts - Sistema Integral de Gestión Clínica
- Frontend React (SKEEN Brand) con Vite, TypeScript, Tailwind - Frontend Homenest (versión alternativa) - Módulos Odoo 17 custom (citas, pacientes, monedero, pagos, ventas, inventario, whatsapp) - WACRM fork (Next.js 16 + Supabase) - Hermes + Bridge + Skills (Qwen3.6 via Nan Builders) - Scripts de migración y operación - Documentación extensiva en docs/
This commit is contained in:
3
odoo-addons/skeen_pacientes/__init__.py
Normal file
3
odoo-addons/skeen_pacientes/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
22
odoo-addons/skeen_pacientes/__manifest__.py
Normal file
22
odoo-addons/skeen_pacientes/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': 'SKEEN Pacientes',
|
||||
'version': '1.0.0',
|
||||
'category': 'Healthcare',
|
||||
'summary': 'Gestión de pacientes para SKEEN Derma Experts',
|
||||
'description': """
|
||||
Módulo de gestión de pacientes para clínica dermatológica.
|
||||
Extiende res.partner con campos específicos para pacientes.
|
||||
""",
|
||||
'author': 'Consultoria Alcaraz Salazar, S.A.S.',
|
||||
'website': 'https://skeen.mx',
|
||||
'depends': ['base', 'contacts', 'hr'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/paciente_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'auto_install': False,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
4
odoo-addons/skeen_pacientes/models/__init__.py
Normal file
4
odoo-addons/skeen_pacientes/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import res_partner
|
||||
from . import hr_employee
|
||||
13
odoo-addons/skeen_pacientes/models/hr_employee.py
Normal file
13
odoo-addons/skeen_pacientes/models/hr_employee.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class HrEmployee(models.Model):
|
||||
_inherit = 'hr.employee'
|
||||
|
||||
commission_pct = fields.Float(
|
||||
string='% Comisión',
|
||||
default=0.0,
|
||||
help='Porcentaje de comisión sobre la venta de artículos recetados por este médico.',
|
||||
)
|
||||
145
odoo-addons/skeen_pacientes/models/res_partner.py
Normal file
145
odoo-addons/skeen_pacientes/models/res_partner.py
Normal file
@@ -0,0 +1,145 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
# Campos de paciente
|
||||
is_patient = fields.Boolean(string='Es Paciente', default=False)
|
||||
patient_id = fields.Char(string='ID Paciente', readonly=True, copy=False)
|
||||
legacy_id = fields.Char(string='ID Legacy', help='ID del sistema legacy SKEEN', index=True, copy=False)
|
||||
legacy_ref = fields.Char(string='Referencia Legacy', help='Referencia externa del sistema legacy', index=True, copy=False)
|
||||
|
||||
# Información médica básica
|
||||
birth_date = fields.Date(string='Fecha de Nacimiento')
|
||||
age = fields.Integer(string='Edad', compute='_compute_age', store=True)
|
||||
gender = fields.Selection([
|
||||
('male', 'Masculino'),
|
||||
('female', 'Femenino'),
|
||||
('other', 'Otro'),
|
||||
], string='Género')
|
||||
blood_type = fields.Selection([
|
||||
('a+', 'A+'), ('a-', 'A-'),
|
||||
('b+', 'B+'), ('b-', 'B-'),
|
||||
('ab+', 'AB+'), ('ab-', 'AB-'),
|
||||
('o+', 'O+'), ('o-', 'O-'),
|
||||
], string='Tipo de Sangre')
|
||||
|
||||
allergies = fields.Text(string='Alergias')
|
||||
medical_history = fields.Text(string='Historial Médico')
|
||||
current_medication = fields.Text(string='Medicación Actual')
|
||||
|
||||
# Información de contacto preferida
|
||||
preferred_contact = fields.Selection([
|
||||
('whatsapp', 'WhatsApp'),
|
||||
('phone', 'Teléfono'),
|
||||
('email', 'Email'),
|
||||
], string='Contacto Preferido', default='whatsapp')
|
||||
|
||||
# Datos personales extendidos (basado en expediente SKEEN actual)
|
||||
birthplace = fields.Char(string='Lugar de Nacimiento')
|
||||
occupation = fields.Char(string='Empleo / Ocupación')
|
||||
marital_status = fields.Selection([
|
||||
('single', 'Soltero/a'),
|
||||
('married', 'Casado/a'),
|
||||
('divorced', 'Divorciado/a'),
|
||||
('widowed', 'Viudo/a'),
|
||||
('union', 'Unión libre'),
|
||||
('other', 'Otro'),
|
||||
], string='Estado Civil')
|
||||
emergency_contact = fields.Char(string='Contacto de Emergencia')
|
||||
emergency_phone = fields.Char(string='Teléfono de Emergencia')
|
||||
home_phone = fields.Char(string='Teléfono Casa')
|
||||
mobile = fields.Char(string='Celular')
|
||||
address_notes = fields.Text(string='Dirección Completa')
|
||||
referred_by = fields.Char(string='Recomendado Por')
|
||||
patient_comments = fields.Text(string='Comentarios del Paciente')
|
||||
internal_notes = fields.Text(string='Notas Internas', help='Notas internas del equipo (no visibles para el paciente)')
|
||||
|
||||
# Historia clínica — cuestionario SKEEN
|
||||
is_pregnant = fields.Boolean(string='¿Está embarazada?')
|
||||
is_breastfeeding = fields.Boolean(string='¿Está lactando?')
|
||||
uses_contraceptives = fields.Boolean(string='¿Usa anticonceptivos?')
|
||||
children_count = fields.Integer(string='Número de Hijos', default=0)
|
||||
|
||||
# Historia clínica — antecedentes patológicos
|
||||
kidney_problems = fields.Boolean(string='Problemas de riñón')
|
||||
back_pain = fields.Boolean(string='Dolor de espalda')
|
||||
heart_disease = fields.Boolean(string='Enfermedades cardíacas')
|
||||
respiratory_problems = fields.Boolean(string='Problemas respiratorios')
|
||||
blood_pressure = fields.Boolean(string='Presión arterial')
|
||||
diabetes = fields.Boolean(string='Diabetes')
|
||||
thyroid = fields.Boolean(string='Problemas de tiroides')
|
||||
colitis = fields.Boolean(string='Colitis')
|
||||
constipation = fields.Boolean(string='Estreñimiento')
|
||||
liver_problems = fields.Boolean(string='Problemas de hígado')
|
||||
surgeries = fields.Boolean(string='Cirugías')
|
||||
surgeries_notes = fields.Text(string='Detalle de cirugías')
|
||||
varicose_veins = fields.Boolean(string='Varices')
|
||||
migraine = fields.Boolean(string='Migraña')
|
||||
faints_with_needles = fields.Boolean(string='¿Se desmaya con agujas?')
|
||||
medical_notes = fields.Text(string='Notas Médicas Adicionales')
|
||||
|
||||
# Campos para sincronización WACRM
|
||||
wacrm_contact_id = fields.Char(string='WACRM Contact ID')
|
||||
wacrm_synced = fields.Boolean(string='Sincronizado con WACRM', default=False)
|
||||
|
||||
# Médico principal y etiquetas
|
||||
primary_doctor_id = fields.Many2one('hr.employee', string='Médico Principal')
|
||||
tag_ids = fields.Many2many('skeen.patient.tag', string='Etiquetas')
|
||||
is_vip = fields.Boolean(string='VIP', default=False)
|
||||
|
||||
# Estadísticas
|
||||
last_visit = fields.Date(string='Última Visita')
|
||||
total_visits = fields.Integer(string='Total Visitas', default=0)
|
||||
total_spent = fields.Float(string='Total Gastado', default=0.0)
|
||||
|
||||
# Fuente de captación
|
||||
source = fields.Selection([
|
||||
('whatsapp', 'WhatsApp'),
|
||||
('facebook', 'Facebook'),
|
||||
('instagram', 'Instagram'),
|
||||
('google', 'Google'),
|
||||
('referral', 'Referido'),
|
||||
('walkin', 'Presencial'),
|
||||
('other', 'Otro'),
|
||||
], string='Fuente', default='whatsapp')
|
||||
|
||||
@api.depends('birth_date')
|
||||
def _compute_age(self):
|
||||
for rec in self:
|
||||
if rec.birth_date:
|
||||
today = fields.Date.today()
|
||||
rec.age = today.year - rec.birth_date.year - (
|
||||
(today.month, today.day) < (rec.birth_date.month, rec.birth_date.day)
|
||||
)
|
||||
else:
|
||||
rec.age = 0
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if vals.get('is_patient') and not vals.get('patient_id'):
|
||||
vals['patient_id'] = self.env['ir.sequence'].next_by_code('skeen.patient') or 'PAT-001'
|
||||
return super(ResPartner, self).create(vals_list)
|
||||
|
||||
def action_view_appointments(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Citas',
|
||||
'res_model': 'skeen.cita',
|
||||
'domain': [('partner_id', '=', self.id)],
|
||||
'view_mode': 'tree,form',
|
||||
}
|
||||
|
||||
|
||||
class SkeenPatientTag(models.Model):
|
||||
_name = 'skeen.patient.tag'
|
||||
_description = 'Etiqueta de Paciente'
|
||||
|
||||
name = fields.Char(string='Nombre', required=True)
|
||||
color = fields.Integer(string='Color')
|
||||
patient_ids = fields.Many2many('res.partner', string='Pacientes')
|
||||
2
odoo-addons/skeen_pacientes/security/ir.model.access.csv
Normal file
2
odoo-addons/skeen_pacientes/security/ir.model.access.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_skeen_patient_tag_user,Acceso a Etiquetas Paciente SKEEN,model_skeen_patient_tag,base.group_user,1,1,1,1
|
||||
|
92
odoo-addons/skeen_pacientes/views/paciente_views.xml
Normal file
92
odoo-addons/skeen_pacientes/views/paciente_views.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Vista de formulario de paciente (res.partner) -->
|
||||
<record id="view_partner_form_skeen" model="ir.ui.view">
|
||||
<field name="name">res.partner.form.skeen</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='vat']" position="after">
|
||||
<field name="is_patient" />
|
||||
<field name="patient_id" invisible="not is_patient" />
|
||||
<field name="age" invisible="not is_patient" />
|
||||
<field name="birth_date" invisible="not is_patient" />
|
||||
<field name="birthplace" invisible="not is_patient" />
|
||||
<field name="gender" invisible="not is_patient" />
|
||||
<field name="blood_type" invisible="not is_patient" />
|
||||
<field name="marital_status" invisible="not is_patient" />
|
||||
<field name="occupation" invisible="not is_patient" />
|
||||
<field name="home_phone" invisible="not is_patient" />
|
||||
<field name="mobile" invisible="not is_patient" />
|
||||
<field name="emergency_contact" invisible="not is_patient" />
|
||||
<field name="emergency_phone" invisible="not is_patient" />
|
||||
<field name="address_notes" invisible="not is_patient" />
|
||||
<field name="referred_by" invisible="not is_patient" />
|
||||
<field name="preferred_contact" invisible="not is_patient" />
|
||||
<field name="source" invisible="not is_patient" />
|
||||
<field name="primary_doctor_id" invisible="not is_patient" />
|
||||
<field name="tag_ids" invisible="not is_patient" widget="many2many_tags" />
|
||||
<field name="is_vip" invisible="not is_patient" />
|
||||
<field name="patient_comments" invisible="not is_patient" />
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='internal_notes']" position="after">
|
||||
<page string="Historia Clínica" invisible="not is_patient">
|
||||
<group>
|
||||
<group string="Antecedentes Gineco-Obstétricos">
|
||||
<field name="is_pregnant" />
|
||||
<field name="is_breastfeeding" />
|
||||
<field name="uses_contraceptives" />
|
||||
<field name="children_count" />
|
||||
</group>
|
||||
<group string="Antecedentes Patológicos">
|
||||
<field name="kidney_problems" />
|
||||
<field name="back_pain" />
|
||||
<field name="heart_disease" />
|
||||
<field name="respiratory_problems" />
|
||||
<field name="blood_pressure" />
|
||||
<field name="diabetes" />
|
||||
<field name="thyroid" />
|
||||
<field name="colitis" />
|
||||
<field name="constipation" />
|
||||
<field name="liver_problems" />
|
||||
<field name="surgeries" />
|
||||
<field name="varicose_veins" />
|
||||
<field name="migraine" />
|
||||
<field name="faints_with_needles" />
|
||||
</group>
|
||||
<group string="Medicación y Alergias" colspan="2">
|
||||
<field name="allergies" />
|
||||
<field name="medical_history" />
|
||||
<field name="current_medication" />
|
||||
<field name="surgeries_notes" />
|
||||
<field name="medical_notes" />
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Estadísticas SKEEN" invisible="not is_patient">
|
||||
<group>
|
||||
<field name="last_visit" />
|
||||
<field name="total_visits" />
|
||||
<field name="total_spent" />
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Vista de lista de pacientes -->
|
||||
<record id="view_partner_tree_skeen" model="ir.ui.view">
|
||||
<field name="name">res.partner.tree.skeen</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='email']" position="after">
|
||||
<field name="is_patient"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="age"/>
|
||||
<field name="last_visit"/>
|
||||
<field name="total_visits"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user