基于Django的web的病历管理系统模型类设计
时间: 2024-06-12 21:07:59 浏览: 12
以下是一个基于Django的病历管理系统的模型类设计:
```
from django.db import models
from django.contrib.auth.models import User
class Patient(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
dob = models.DateField()
gender = models.CharField(max_length=1)
address = models.CharField(max_length=100)
phone_number = models.CharField(max_length=20)
email = models.EmailField()
class Doctor(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
specialty = models.CharField(max_length=50)
license_number = models.CharField(max_length=20)
class Encounter(models.Model):
patient = models.ForeignKey(Patient, on_delete=models.CASCADE)
doctor = models.ForeignKey(Doctor, on_delete=models.CASCADE)
date = models.DateTimeField()
chief_complaint = models.CharField(max_length=200)
history_of_present_illness = models.TextField()
past_medical_history = models.TextField()
physical_exam = models.TextField()
assessment = models.TextField()
plan = models.TextField()
class Prescription(models.Model):
encounter = models.ForeignKey(Encounter, on_delete=models.CASCADE)
medication = models.CharField(max_length=100)
dosage = models.CharField(max_length=50)
instructions = models.CharField(max_length=200)
class LabTest(models.Model):
encounter = models.ForeignKey(Encounter, on_delete=models.CASCADE)
test_name = models.CharField(max_length=100)
result = models.CharField(max_length=50)
reference_range = models.CharField(max_length=50)
class ImagingStudy(models.Model):
encounter = models.ForeignKey(Encounter, on_delete=models.CASCADE)
study_type = models.CharField(max_length=50)
result = models.CharField(max_length=200)
```
在这个模型类设计中,有以下几个模型类:
- Patient: 代表病人,有基本信息(如出生日期、性别、地址、电话、邮箱)和与Django内置的User模型类的一对一关系。
- Doctor: 代表医生,有专业领域和执照号码等信息,也与User模型类有一对一关系。
- Encounter: 代表一次看病的记录,包括病人、医生、就诊时间、主诉、现病史、过往病史、体格检查、诊断和治疗计划等信息。
- Prescription: 代表一次看病中开出的处方,包括药品、剂量和用法等信息,与Encounter模型类有外键关系。
- LabTest: 代表一次看病中进行的实验室检测,包括检测项目、结果和参考范围等信息,与Encounter模型类有外键关系。
- ImagingStudy: 代表一次看病中进行的影像学检查,包括检查类型、结果等信息,与Encounter模型类有外键关系。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![tar](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![xlsx](https://img-home.csdnimg.cn/images/20210720083732.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)