changeset 5289:887060c8ebf3

task #16247: Enhancements on Surgery package. Add initial models, menus and links to Preoperative Assessment
author Luis Falcon <falcon@gnuhealth.org>
date Sun, 28 Aug 2022 16:51:57 +0100
parents a333be04abe1
children 0445ee301a24
files tryton/health_surgery/__init__.py tryton/health_surgery/health_surgery.py tryton/health_surgery/health_surgery_view.xml tryton/health_surgery/view/gnuhealth_preoperative_assessment.xml tryton/health_surgery/view/gnuhealth_preoperative_assessment_tree.xml
diffstat 5 files changed, 157 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health_surgery/__init__.py
+++ b/tryton/health_surgery/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 ##############################################################################
 #
 #    GNU Health: The Free Health and Hospital Information System
@@ -38,6 +37,7 @@
         health_surgery.SurgerySupply,
         health_surgery.PatientData,
         health_surgery.SurgeryTeam,
+        health_surgery.PreOperativeAssessment,
         module='health_surgery', type_='model')
     Pool.register(
         report.SurgeryReport,
--- a/tryton/health_surgery/health_surgery.py
+++ b/tryton/health_surgery/health_surgery.py
@@ -45,7 +45,9 @@
     get_institution
 
 __all__ = ['RCRI', 'Surgery', 'Operation', 'SurgeryMainProcedure',
-           'SurgerySupply', 'PatientData', 'SurgeryTeam']
+           'SurgerySupply', 'PatientData', 'SurgeryTeam',
+           'PreOperativeAssessment']
+
 
 class RCRI(ModelSQL, ModelView):
     'Revised Cardiac Risk Index'
@@ -300,21 +302,6 @@
 
 
     description = fields.Char('Description')
-    preop_mallampati = fields.Selection([
-        (None, ''),
-        ('Class 1', 'Class 1: Full visibility of tonsils, uvula and soft '
-                    'palate'),
-        ('Class 2', 'Class 2: Visibility of hard and soft palate, '
-                    'upper portion of tonsils and uvula'),
-        ('Class 3', 'Class 3: Soft and hard palate and base of the uvula are '
-                    'visible'),
-        ('Class 4', 'Class 4: Only Hard Palate visible'),
-        ], 'Mallampati Score', sort=False)
-    preop_bleeding_risk = fields.Boolean(
-        'Risk of Massive bleeding',
-        help="Patient has a risk of losing more than 500 "
-        "ml in adults of over 7ml/kg in infants. If so, make sure that "
-        "intravenous access and fluids are available")
 
     preop_oximeter = fields.Boolean(
         'Pulse Oximeter in place',
@@ -333,6 +320,27 @@
         'Sterility confirmed',
         help="Nursing team has confirmed sterility of the devices and room")
 
+    """ Mallampati, ASA, bleeding risk, RCRI are now part of the
+        preoperative assessment.
+        They will not be shown in the main surgery view
+    """
+    
+    preop_mallampati = fields.Selection([
+        (None, ''),
+        ('Class 1', 'Class 1: Full visibility of tonsils, uvula and soft '
+                    'palate'),
+        ('Class 2', 'Class 2: Visibility of hard and soft palate, '
+                    'upper portion of tonsils and uvula'),
+        ('Class 3', 'Class 3: Soft and hard palate and base of the uvula are '
+                    'visible'),
+        ('Class 4', 'Class 4: Only Hard Palate visible'),
+        ], 'Mallampati Score', sort=False)
+    preop_bleeding_risk = fields.Boolean(
+        'Risk of Massive bleeding',
+        help="Patient has a risk of losing more than 500 "
+        "ml in adults of over 7ml/kg in infants. If so, make sure that "
+        "intravenous access and fluids are available")
+
     preop_asa = fields.Selection([
         (None, ''),
         ('ps1', 'PS 1 : Normal healthy patient'),
@@ -677,8 +685,69 @@
     
     notes = fields.Char('Notes')
 
+
+class PreOperativeAssessment(ModelSQL, ModelView):
+    'Preoperative Assessment'
+    __name__ = 'gnuhealth.preoperative_assessment'
+
+
+    """ Preoperative Assessment class contains the necessary patient
+        and anesthesia information to be taken into account 
+        in the upcoming surgery
+    """
+    patient = fields.Many2One('gnuhealth.patient', 'Patient', required=True)
+
+    health_professional = fields.Many2One(
+        'gnuhealth.healthprofessional', 'Health Prof',
+        help="Health professional that signs this assessment")
+
+    surgery = fields.Many2One('gnuhealth.surgery', 'Surgery')
+
+    assessment_date = fields.Date(
+        'Date', help="Date of the assessment")
+
+    preop_mallampati = fields.Selection([
+        (None, ''),
+        ('Class 1', 'Class 1: Full visibility of tonsils, uvula and soft '
+                    'palate'),
+        ('Class 2', 'Class 2: Visibility of hard and soft palate, '
+                    'upper portion of tonsils and uvula'),
+        ('Class 3', 'Class 3: Soft and hard palate and base of the uvula are '
+                    'visible'),
+        ('Class 4', 'Class 4: Only Hard Palate visible'),
+        ], 'Mallampati Score', sort=False)
+    preop_bleeding_risk = fields.Boolean(
+        'Risk of Massive bleeding',
+        help="Patient has a risk of losing more than 500 "
+        "ml in adults of over 7ml/kg in infants. If so, make sure that "
+        "intravenous access and fluids are available")
+
+    preop_asa = fields.Selection([
+        (None, ''),
+        ('ps1', 'PS 1 : Normal healthy patient'),
+        ('ps2', 'PS 2 : Patients with mild systemic disease'),
+        ('ps3', 'PS 3 : Patients with severe systemic disease'),
+        ('ps4', 'PS 4 : Patients with severe systemic disease that is'
+            ' a constant threat to life '),
+        ('ps5', 'PS 5 : Moribund patients who are not expected to'
+            ' survive without the operation'),
+        ('ps6', 'PS 6 : A declared brain-dead patient who organs are'
+            ' being removed for donor purposes'),
+        ], 'ASA PS',
+        help="ASA pre-operative Physical Status", sort=False)
+
+    preop_rcri = fields.Many2One(
+        'gnuhealth.rcri', 'RCRI',
+        help='Patient Revised Cardiac Risk Index\n'
+        'Points 0: Class I Very Low (0.4% complications)\n'
+        'Points 1: Class II Low (0.9% complications)\n'
+        'Points 2: Class III Moderate (6.6% complications)\n'
+        'Points 3 or more : Class IV High (>11% complications)')
+
 class PatientData(ModelSQL, ModelView):
     __name__ = 'gnuhealth.patient'
 
     surgery = fields.One2Many(
         'gnuhealth.surgery', 'patient', 'Surgeries', readonly=True)
+
+
--- a/tryton/health_surgery/health_surgery_view.xml
+++ b/tryton/health_surgery/health_surgery_view.xml
@@ -193,5 +193,55 @@
             <field name="name">gnuhealth_patient</field>
         </record>
 
+<!-- Preoperative Assessment -->
+
+        <record model="ir.ui.view" id="gnuhealth_preoperative_assessment_view">
+            <field name="model">gnuhealth.preoperative_assessment</field>
+            <field name="type">form</field>
+            <field name="name">gnuhealth_preoperative_assessment</field>
+        </record>
+
+        <record model="ir.ui.view" id="gnuhealth_preoperative_assessment_tree">
+            <field name="model">gnuhealth.preoperative_assessment</field>
+            <field name="type">tree</field>
+            <field name="name">gnuhealth_preoperative_assessment_tree</field>
+        </record>
+
+<!-- Preoperative Assessment Menu -->
+
+        <record model="ir.action.act_window" id="action_gnuhealth_preoperative_assessment_view">
+            <field name="name">Preoperative Assessments</field>
+            <field name="res_model">gnuhealth.preoperative_assessment</field>
+        </record>
+
+        <record model="ir.action.act_window.view" id="act_gnuhealth_preoperative_assessment_view_list">
+            <field name="sequence" eval="10"/>
+            <field name="view" ref="gnuhealth_preoperative_assessment_tree"/>
+            <field name="act_window" ref="action_gnuhealth_preoperative_assessment_view"/>
+        </record>
+        <record model="ir.action.act_window.view" id="act_gnuhealth_preoperative_assessment_form">
+            <field name="sequence" eval="20"/>
+            <field name="view" ref="gnuhealth_preoperative_assessment_view"/>
+            <field name="act_window" ref="action_gnuhealth_preoperative_assessment_view"/>
+        </record>
+
+        <menuitem name="Preoperative Assessments" parent="gnuhealth_surgery_menu"
+            id="gnuhealth_preoperative_assessment" sequence="50"
+            action="action_gnuhealth_preoperative_assessment_view"
+            icon="icon-ok"/>
+
+    <!-- Shortcut to the Pre-operative assessment from the Patient -->
+        <record model="ir.action.act_window" id="act_preoperative_assessment_form1">
+            <field name="name">Preoperative Assessment</field>
+            <field name="res_model">gnuhealth.preoperative_assessment</field>
+            <field name="domain" eval="[('patient', '=', Eval('active_id'))]" pyson="1"/>
+        </record>
+        <record model="ir.action.keyword"
+                id="act_open_preop_keyword1">
+            <field name="keyword">form_relate</field>
+            <field name="model">gnuhealth.patient,-1</field>
+            <field name="action" ref="act_preoperative_assessment_form1"/>
+        </record>
+
     </data>
 </tryton>
new file mode 100644
--- /dev/null
+++ b/tryton/health_surgery/view/gnuhealth_preoperative_assessment.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<form>
+    <group id="preop_header" col="6">
+        <label name="patient"/>
+        <field name="patient"/>
+        <label name="health_professional"/>
+        <field name="health_professional"/>
+        <label name="assessment_date"/>
+        <field name="assessment_date"/>
+        <label name="surgery"/>
+        <field name="surgery"/>
+    </group>
+    <newline/>
+</form>
new file mode 100644
--- /dev/null
+++ b/tryton/health_surgery/view/gnuhealth_preoperative_assessment_tree.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<tree>
+    <field name="patient"/>
+    <field name="assessment_date"/>
+    <field name="surgery"/>
+    <field name="health_professional"/>
+</tree>