| 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') |
|
|