Skip to content

生成测试 #2

Open
Open
@BreakUps

Description

@BreakUps

1. 接口定义

POST /resident/archives/add

2. 输入参数

参数名称: requestParams

参数详情:

参数名 是否必填 参数类型 参数限制
resident_id bigint
external_userid string 最大长度100
relation int 1-7(与本人的关系)
name string 最大长度50
gender int 0-2(性别,0表示未知)
phone string 最大长度20
birthday string
certificate_type int 1(证件类型,1表示身份证)
certificate_no string 最大长度50
domicile_address string 最大长度100
province_code string 最大长度20
city_code string 最大长度20
area_code string 最大长度20
address string 最大长度100
company_name string 最大长度50
company_address string 最大长度50
nation_code string 最大长度20
education_code string 最大长度20
marriage_code string 最大长度20
contact_name string 最大长度20
contact_phone string 最大长度20

3. 输出参数

输出参数名称: response

参数详情:

参数名 是否必填 参数类型 参数限制
code int
msg string
data object 包含archive_id档案ID
archive_id bigint 新增的居民健康档案基础信息表中的主键ID

4. 数据处理逻辑图

graph TD;
    A[客户端请求新增居民档案] --> B{参数校验}
    B -- 参数不合法 --> B1[返回参数校验失败信息]
    B -- 参数合法 --> C[生成档案ID]
    C --> D[插入档案信息至archive_base]
    D -->|档案基础信息| E[检查插入结果]
    E -- 插入失败 --> F[返回新增失败信息]
    E -- 插入成功 --> G[返回新增成功信息]
    E -->|档案ID| H(关联其他信息)
    H --> I[hrb_blood_glucose]
    H --> J[hrb_blood_pressure]
    H --> K[hrb_diet]
    H --> L[hrb_exercise]
    H --> M[svc_state]
    I --> N{检查关联表插入结果}
    J --> N
    K --> N
    L --> N
    M --> N
    N -- 关联失败 --> O[回滚archive_base插入操作,返回失败信息]
    N -- 关联成功 --> P[确认档案信息全部成功插入,返回成功信息]

    classDef tableName fill:#f9f,stroke:#333,stroke-width:2px;
    class D,E,H,I,J,K,L,M tableName;

Loading

5. 数据处理逻辑图解

  1. 接口调用:客户端通过 [POST /residents/archives/add] 请求新增居民档案信息。
  2. 参数校验:首先进行输入参数的合法性校验。
    • 参数不合法:返回参数校验失败信息给客户端。
    • 参数合法:继续进行流程。
  3. 生成档案ID:使用唯一ID生成机制(如雪花算法)为每份居民档案信息生成ID。
  4. 数据插入:将档案基础信息插入到archive_base表中。
  5. 检查插入结果:确认archive_base表数据是否成功插入。
    • 插入失败:返回新增失败信息。
    • 插入成功:关联其他支持信息表。
  6. 关联其他信息:使用生成的档案ID,关联居民的血糖记录(hrb_blood_glucose)、血压记录(hrb_blood_pressure)、饮食记录(hrb_diet)、运动记录(hrb_exercise)、服务状态(svc_state)等信息。
  7. 检查关联表插入结果:确保所有关联信息也成功插入相应的表。
    • 关联失败:若任一关联信息插入失败,执行回滚,确保数据一致性,并返回失败信息。
    • 关联成功:确保所有信息一致性,返回成功信息给客户端。

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions