schema.md 8.4 KB

1、医生问诊模块

  • 医生问诊模块描述
    • 医生问诊模块的主要功能包括患者根据自己的病状判断所需要的科室,并进行预约就诊,然后医生与其预约的人进行在线咨询,并通过患者提供的症状,给出相应的病症以及相应的药物等。

Parse Schema 设计

  1. User(用户表)

    • objectId: String
    • createdAt: Date
    • username: String
    • password: String
    • email: String
    • phoneNumber: String
    • userType: String(例如:患者或医生)
    • medicalHistory: String(仅适用于患者)
  2. Doctor(医生表)

    • objectId: String
    • createdAt: Date
    • user: Pointer
    • specialty: String(专业领域)
    • qualifications: String(资格证书)
  3. Department(科室表)

    • objectId: String
    • createdAt: Date
    • departmentName: String
    • description: String
  4. Appointment(预约表)

    • objectId: String
    • createdAt: Date
    • patient: Pointer(患者)
    • doctor: Pointer(医生)
    • department: Pointer
    • appointmentDate: Date
    • status: String(例如:已预约、已取消、已完成)
    • Consultation(在线咨询表)

      • objectId: String
      • createdAt: Date
      • appointment: Pointer
      • symptoms: String
      • diagnosis: String
      • prescribedMedication: String
      • consultationDate: Date
    • PlantUML 类图表示

      @startuml
      class User {
          +objectId: String
          +createdAt: Date
          +username: String
          +password: String
          +email: String
          +phoneNumber: String
          +userType: String
          +medicalHistory: String
      }
      
      class Doctor {
          +objectId: String
          +createdAt: Date
          +user: Pointer<User>
          +specialty: String
          +qualifications: String
      }
      
      class Department {
          +objectId: String
          +createdAt: Date
          +departmentName: String
          +description: String
      }
      
      class Appointment {
          +objectId: String
          +createdAt: Date
          +patient: Pointer<User>
          +doctor: Pointer<Doctor>
          +department: Pointer<Department>
          +appointmentDate: Date
          +status: String
      }
      
      class Consultation {
          +objectId: String
          +createdAt: Date
          +appointment: Pointer<Appointment>
          +symptoms: String
          +diagnosis: String
          +prescribedMedication: String
          +consultationDate: Date
      }
      
      User "1" -- "0..*" Appointment : books
      Doctor "1" -- "0..*" Appointment : provides
      Department "1" -- "0..*" Appointment : offers
      Appointment "1" -- "1" Consultation : includes
      
      @enduml
      

      表说明

      • User 表:存储用户信息,包含患者和医生的基本信息。患者的病史信息存储在 medicalHistory 字段中。
      • Doctor 表:存储医生的详细信息,包含与用户表的关联、专业领域和资格证书。
      • Department 表:存储科室信息,如科室名称及描述。
      • Appointment 表:记录患者的预约信息,包括患者、医生、科室、预约时间和状态。
      • Consultation 表:记录在线咨询的信息,包括相关的预约、患者提供的症状、医生的诊断和处方药物。

      这种设计确保了患者和医生的角色分离,同时也符合数据库的范式要求。每个表都有唯一的 objectIdcreatedAt 字段,方便进行数据管理和跟踪。

      2、健康科普模块

      • 健康科普模块描述
        • 健康科普模块的主要功能包括用户根据某一身体情况进行相关搜索相关病症或是身体需要的营养元素,同时每天还会推送与用户最近线上就诊的病情相关的的健康知识

      Parse Schema 设计

      1. User

        • objectId (默认)
        • createdAt (默认)
        • username: String
        • email: String
        • phoneNumber: String
      2. Condition

        • objectId (默认)
        • createdAt (默认)
        • name: String
        • description: String
        • relatedNutrients: Array>
      3. Nutrient

        • objectId (默认)
        • createdAt (默认)
        • name: String
        • benefits: String
      4. VisitRecord

        • objectId (默认)
        • createdAt (默认)
        • user: Pointer
        • condition: Pointer
        • visitDate: Date
        • notes: String
        • HealthKnowledge

          • objectId (默认)
          • createdAt (默认)
          • title: String
          • content: String
          • relatedCondition: Pointer
          • pushDate: Date
        • PlantUML 类图表示

          @startuml
          class User {
              +objectId: String
              +createdAt: Date
              +username: String
              +email: String
              +phoneNumber: String
          }
          
          class Condition {
              +objectId: String
              +createdAt: Date
              +name: String
              +description: String
              +relatedNutrients: Array<Pointer<Nutrient>>
          }
          
          class Nutrient {
              +objectId: String
              +createdAt: Date
              +name: String
              +benefits: String
          }
          
          class VisitRecord {
              +objectId: String
              +createdAt: Date
              +user: Pointer<User>
              +condition: Pointer<Condition>
              +visitDate: Date
              +notes: String
          }
          
          class HealthKnowledge {
              +objectId: String
              +createdAt: Date
              +title: String
              +content: String
              +relatedCondition: Pointer<Condition>
              +pushDate: Date
          }
          
          User "1" -- "0..*" VisitRecord : has
          Condition "1" -- "0..*" VisitRecord : is related to
          Condition "1" -- "0..*" HealthKnowledge : is related to
          Condition "1" -- "0..*" Nutrient : contains
          @enduml
          

          说明

          • User 表:存储用户信息。
          • Condition 表:存储病症信息,并通过 relatedNutrients 字段与营养元素表关联。
          • Nutrient 表:存储营养元素信息。
          • VisitRecord 表:存储用户的就诊记录,关联用户和病症。
          • HealthKnowledge 表:存储健康知识,关联特定病症。

          这种设计确保了数据的规范化,避免了冗余,同时通过外键关联保持了数据的一致性和完整性。

          3、我的健康模块

          • 我的健康模块描述
            • 我的健康模块的主要功能包括将用户个人信息整合生成一个病历表来记录用户有什么过敏史或者遗传病史,同时将用户自己以往的ai问诊记录整合起成一个可随时更新的表单来展现用户的健康历程,以及将用户关注过的健康科普知识整合在一个收藏夹中便于下次查找。

          表设计

          1. UserProfile

            • objectId
            • createdAt
            • name: String
            • age: Number
            • gender: String
            • allergyHistory: String
            • geneticHistory: String
          2. MedicalRecord

            • objectId
            • createdAt
            • userProfile: Pointer
            • recordDate: Date
            • symptoms: String
            • diagnosis: String
            • treatment: String
          3. ConsultationRecord

            • objectId
            • createdAt
            • userProfile: Pointer
            • consultationDate: Date
            • questions: String
            • answers: String
          4. HealthKnowledge

            • objectId
            • createdAt
            • title: String
            • content: String
            • category: String
            • userProfile: Pointer
          5. HealthKnowledgeCollection

            • objectId
            • createdAt
            • userProfile: Pointer
            • healthKnowledge: Pointer

            PlantUML 类图

            以下是用PlantUML表示的类图:

            @startuml
            class UserProfile {
                +objectId: String
                +createdAt: Date
                +name: String
                +age: Number
                +gender: String
                +allergyHistory: String
                +geneticHistory: String
            }
            
            class MedicalRecord {
                +objectId: String
                +createdAt: Date
                +recordDate: Date
                +symptoms: String
                +diagnosis: String
                +treatment: String
            }
            
            class ConsultationRecord {
                +objectId: String
                +createdAt: Date
                +consultationDate: Date
                +questions: String
                +answers: String
            }
            
            class HealthKnowledge {
                +objectId: String
                +createdAt: Date
                +title: String
                +content: String
                +category: String
            }
            
            class HealthKnowledgeCollection {
                +objectId: String
                +createdAt: Date
            }
            
            UserProfile "1" -- "0..*" MedicalRecord : has
            UserProfile "1" -- "0..*" ConsultationRecord : has
            UserProfile "1" -- "0..*" HealthKnowledge : has
            UserProfile "1" -- "0..*" HealthKnowledgeCollection : has
            HealthKnowledgeCollection "1" -- "0..*" HealthKnowledge : contains
            @enduml
            

            设计说明

            • UserProfile 表用于存储用户的基本信息,包括过敏史和遗传病史。
            • MedicalRecord 表用于记录用户的病历信息,关联到相应的用户。
            • ConsultationRecord 表用于存储用户的AI问诊记录,记录咨询日期、问题和答案。
            • HealthKnowledge 表用于存储健康科普知识的内容。
            • HealthKnowledgeCollection 表用于存储用户收藏的健康知识,使用指针关联到 HealthKnowledge 表。