program-in-chinese / vscode_english_chinese_dictionary

vscode插件, 实现离线英汉词典功能
93 stars 14 forks source link

patient_id => 忍耐的_识别 #22

Open nobodxbodon opened 5 years ago

nobodxbodon commented 5 years ago

尝试通过上下文确定为医疗相关: https://github.com/OCA/vertical-medical/blob/10.0/medical_disease/models/medical_patient_disease.py#L61

from openerp import models, fields, api

class MedicalPatientDisease(models.Model):
    _name = 'medical.patient.disease'
    _description = 'Medical Patient Disease'

    @api.one
    @api.depends('short_comment', 'pathology_id', 'pathology_id.name')
    def _compute_name(self):
        name = self.pathology_id.name
        if self.short_comment:
            name = '%s - %s' % (name, self.short_comment)
        self.name = name

    @api.one
    @api.depends('active')
    def _compute_expire_date(self):
        if self.active:
            self.expire_date = False
        else:
            self.expire_date = fields.Datetime.now()

    @api.one
    def action_invalidate(self):
        self.active = False

    @api.one
    def action_revalidate(self):
        self.active = True

    name = fields.Char(compute='_compute_name', store=True)
    treatment_description = fields.Char()
    expire_date = fields.Datetime(compute='_compute_expire_date', store=True)
    short_comment = fields.Char()
    pathology_id = fields.Many2one(
        comodel_name='medical.pathology', string='Pathology', index=True,
        required=True)
    physician_id = fields.Many2one(
        comodel_name='medical.physician', string='Physician', index=True)
    patient_id = fields.Many2one(
        comodel_name='medical.patient', string='Patient', required=True,
        index=True)
    disease_severity = fields.Selection([
        ('1_mi', 'Mild'),
        ('2_mo', 'Moderate'),
        ('3_sv', 'Severe')
    ], string='Severity')
    state = fields.Selection([
        ('a', 'Acute'),
        ('c', 'Chronic'),
        ('u', 'Unchanged'),
        ('h', 'Healed'),
        ('i', 'Improving'),
        ('w', 'Worsening'),
    ], string='Status of the disease')
    allergy_type = fields.Selection([
        ('da', 'Drug Allergy'),
        ('fa', 'Food Allergy'),
        ('ma', 'Misc Allergy'),
        ('mc', 'Misc Contraindication'),
    ])
    weeks_of_pregnancy = fields.Integer(
        help='Week number of pregnancy when disease contracted',
        string='Pregnancy Week#')
    age = fields.Integer(string='Age when diagnosed')
    active = fields.Boolean(default=True)
    is_infectious = fields.Boolean(string='Infectious Disease')
    is_allergy = fields.Boolean(string='Allergic Disease')
    pregnancy_warning = fields.Boolean()
    is_pregnant = fields.Boolean(string='Pregnancy warning')
    is_on_treatment = fields.Boolean(string='Currently on Treatment')
    treatment_start_date = fields.Date()
    treatment_end_date = fields.Date()
    diagnosed_date = fields.Date(string='Date of Diagnosis')
    healed_date = fields.Date(string='Date of Healing')
    notes = fields.Text()
nobodxbodon commented 5 years ago

https://github.com/program-in-chinese/vscode_english_chinese_dictionary/issues/12 的"形容词+名词"搭配导致