feat(health): Phase 1 业务改进 — 诊断编码/统计API/体征表合并/积分修复
1.1 Dashboard 统计: 新增 3 个统计端点 (patient/consultation/follow-up) 1.2 事件发布: follow_up.overdue + health_data.critical_alert 事件 1.3 体征表合并: vital_signs 添加 source 列, daily_monitoring 委托写入 1.4 实时预警: 创建体征时检测血压/心率/血糖异常并发布事件 1.5 诊断编码: 新建 diagnosis entity/service/handler + ICD-10 支持 1.6 积分过期: expire_points 定时任务 + 修复 r#type 列名问题 修复: points_transaction.r#type → transaction_type 列重命名 修复: consultation_message.sender_type → sender_role SQL 列名 前端: 3 个统计 API 从伪实现改为真实调用
This commit is contained in:
49
crates/erp-health/src/entity/diagnosis.rs
Normal file
49
crates/erp-health/src/entity/diagnosis.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "diagnosis")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub tenant_id: Uuid,
|
||||
pub patient_id: Uuid,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub health_record_id: Option<Uuid>,
|
||||
pub icd_code: String,
|
||||
pub diagnosis_name: String,
|
||||
pub diagnosis_type: String,
|
||||
pub diagnosed_date: chrono::NaiveDate,
|
||||
pub status: String,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub diagnosed_by: Option<Uuid>,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub notes: Option<String>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub created_by: Option<Uuid>,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub updated_by: Option<Uuid>,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
pub version: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::patient::Entity",
|
||||
from = "Column::PatientId",
|
||||
to = "super::patient::Column::Id"
|
||||
)]
|
||||
Patient,
|
||||
}
|
||||
|
||||
impl Related<super::patient::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Patient.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -3,6 +3,7 @@ pub mod article;
|
||||
pub mod consultation_message;
|
||||
pub mod consultation_session;
|
||||
pub mod daily_monitoring;
|
||||
pub mod diagnosis;
|
||||
pub mod dialysis_record;
|
||||
pub mod doctor_profile;
|
||||
pub mod doctor_schedule;
|
||||
|
||||
@@ -8,7 +8,8 @@ pub struct Model {
|
||||
pub id: Uuid,
|
||||
pub tenant_id: Uuid,
|
||||
pub account_id: Uuid,
|
||||
pub r#type: String,
|
||||
#[sea_orm(column_name = "transaction_type")]
|
||||
pub transaction_type: String,
|
||||
pub amount: i32,
|
||||
pub remaining_amount: i32,
|
||||
pub status: String,
|
||||
|
||||
@@ -29,6 +29,7 @@ pub struct Model {
|
||||
pub urine_output_ml: Option<i32>,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
pub notes: Option<String>,
|
||||
pub source: String,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
Reference in New Issue
Block a user