File size: 5,590 Bytes
c6ad4a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, TextAreaField, SelectField, DateField, IntegerField, BooleanField, PasswordField
from wtforms.validators import DataRequired, Email, Length, Optional, NumberRange
from wtforms.widgets import TextArea

class LoginForm(FlaskForm):
    username = StringField('Username', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])

class PatientForm(FlaskForm):
    first_name = StringField('First Name', validators=[DataRequired(), Length(max=64)])
    last_name = StringField('Last Name', validators=[DataRequired(), Length(max=64)])
    date_of_birth = DateField('Date of Birth', validators=[DataRequired()])
    gender = SelectField('Gender', choices=[('Male', 'Male'), ('Female', 'Female'), ('Other', 'Other')])
    phone = StringField('Phone', validators=[Length(max=20)])
    email = StringField('Email', validators=[Optional(), Email(), Length(max=120)])
    address = TextAreaField('Address')
    emergency_contact = StringField('Emergency Contact', validators=[Length(max=100)])
    emergency_phone = StringField('Emergency Phone', validators=[Length(max=20)])
    allergies = TextAreaField('Allergies')
    medical_history = TextAreaField('Medical History')
    insurance_info = TextAreaField('Insurance Information')

class VisitForm(FlaskForm):
    visit_type = SelectField('Visit Type', choices=[
        ('Consultation', 'Consultation'),
        ('Follow-up', 'Follow-up'),
        ('Emergency', 'Emergency'),
        ('Procedure', 'Procedure'),
        ('Screening', 'Screening')
    ], validators=[DataRequired()])
    chief_complaint = TextAreaField('Chief Complaint', validators=[DataRequired()])
    diagnosis = TextAreaField('Diagnosis')
    treatment_notes = TextAreaField('Treatment Notes')
    follow_up_date = DateField('Follow-up Date', validators=[Optional()])

class VisitNoteForm(FlaskForm):
    content = TextAreaField('Note Content', validators=[DataRequired()], widget=TextArea())
    note_type = SelectField('Note Type', choices=[
        ('Clinical', 'Clinical'),
        ('Administrative', 'Administrative'),
        ('Follow-up', 'Follow-up')
    ], validators=[DataRequired()])

class ImageUploadForm(FlaskForm):
    image = FileField('Patient Image', validators=[
        DataRequired(),
        FileAllowed(['jpg', 'jpeg', 'png', 'gif'], 'Images only!')
    ])
    description = TextAreaField('Description')
    body_location = StringField('Body Location', validators=[Length(max=100)])
    image_type = SelectField('Image Type', choices=[
        ('Clinical Photo', 'Clinical Photo'),
        ('Dermoscopy', 'Dermoscopy'),
        ('Before Treatment', 'Before Treatment'),
        ('After Treatment', 'After Treatment'),
        ('Progress Photo', 'Progress Photo')
    ])

class TreatmentPlanForm(FlaskForm):
    diagnosis = StringField('Diagnosis', validators=[DataRequired(), Length(max=200)])
    medications = TextAreaField('Medications')
    instructions = TextAreaField('Instructions')
    duration = StringField('Duration', validators=[Length(max=50)])
    follow_up_date = DateField('Follow-up Date', validators=[Optional()])
    notes = TextAreaField('Additional Notes')

class TreatmentTemplateForm(FlaskForm):
    name = StringField('Template Name', validators=[DataRequired(), Length(max=100)])
    description = TextAreaField('Description')
    condition_id = SelectField('Condition', coerce=int, validators=[Optional()])
    medications = TextAreaField('Medications')
    instructions = TextAreaField('Instructions')
    duration = StringField('Duration', validators=[Length(max=50)])
    follow_up_weeks = IntegerField('Follow-up (weeks)', validators=[Optional(), NumberRange(min=1, max=52)])

class ConditionForm(FlaskForm):
    name = StringField('Condition Name', validators=[DataRequired(), Length(max=100)])
    description = TextAreaField('Description')
    icd_code = StringField('ICD Code', validators=[Length(max=20)])
    category = StringField('Category', validators=[Length(max=50)])

class InventoryForm(FlaskForm):
    item_name = StringField('Item Name', validators=[DataRequired(), Length(max=100)])
    category = SelectField('Category', choices=[
        ('Medications', 'Medications'),
        ('Instruments', 'Instruments'),
        ('Supplies', 'Supplies'),
        ('Equipment', 'Equipment')
    ])
    current_stock = IntegerField('Current Stock', validators=[DataRequired(), NumberRange(min=0)])
    min_threshold = IntegerField('Minimum Threshold', validators=[DataRequired(), NumberRange(min=1)])
    unit = StringField('Unit', validators=[Length(max=20)])
    supplier = StringField('Supplier', validators=[Length(max=100)])

class UserForm(FlaskForm):
    username = StringField('Username', validators=[DataRequired(), Length(max=64)])
    email = StringField('Email', validators=[DataRequired(), Email(), Length(max=120)])
    first_name = StringField('First Name', validators=[DataRequired(), Length(max=64)])
    last_name = StringField('Last Name', validators=[DataRequired(), Length(max=64)])
    role_id = SelectField('Role', coerce=int, validators=[DataRequired()])
    is_active = BooleanField('Active')

class BriefingPreferencesForm(FlaskForm):
    show_patient_summary = BooleanField('Show Patient Summary')
    show_appointments = BooleanField('Show Appointments')
    show_urgent_cases = BooleanField('Show Urgent Cases')
    show_follow_ups = BooleanField('Show Follow-ups')
    show_inventory_alerts = BooleanField('Show Inventory Alerts')