{"openapi":"3.1.0","info":{"title":"素衡医生端接口","description":"\n医生端在线业务 API：账号、诊所与患者、病历、处方报价、线下收款和退费。\n\n**联调顺序**：登录 → Authorize填写Access Token → `/clinics/me`获取租户 →\n填写 `X-Clinic-Id` → 建档/接诊/草稿 → 检查和报价 → 正式提交 → 收款或退费。\n\n**并发约定**：写操作使用唯一 `Idempotency-Key`；同一操作重试复用原键。\n更新先GET取得 `ETag`，通过 `If-Match`提交。患者、病历、药品、价格和财务ETag不可混用。\n金额是十进制字符串；时刻带时区，生日是纯日期；分页page从1开始、size最多100。\n\n**权限**：一个租户对应一家诊所。平台指定管理员，注册不会自动加入诊所。\n普通医生仅可见本人登记/接诊患者及本人病历。退费申请人不能自审；批准不等于实际退款。\n\n**基础资料**：字典、方剂模板、用法由诊所共享；先维护药品目录，再配置模板。\n个人资料只修改本人，诊所名称由平台管理、诊金仍以计价设置为准。改密后全部会话失效，需重新登录。\n\n**当前边界**：真实支付、医保、账单PDF、利润和PDF/XLSX报表导出尚未接入。\n照片须通过鉴权接口读取；报表以已落库业务为准。处方提交不预占，发药才扣库存，实际退药才回库。\n示例均为合成数据和占位ID；在此执行写接口会实际入库，须使用自己的有效ID。\n","version":"0.6.0"},"paths":{"/api/v1/auth/register":{"post":{"tags":["01 账号认证"],"summary":"注册医生账号","operationId":"register_api_v1_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"username":"doctor-demo","password":"ReplaceWithYourOwnPassword","displayName":"演示医生","clinicName":"演示诊所"}}}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoctorProfile"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"成功201。注册不会创建租户、加入诊所或授予管理员；密码使用scrypt保存，不回传。"}},"/api/v1/auth/login":{"post":{"tags":["01 账号认证"],"summary":"登录并获取双令牌","operationId":"login_api_v1_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"username":"doctor-demo","password":"ReplaceWithYourOwnPassword"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"Access Token默认30分钟，Refresh Token默认1天。保存令牌后使用Authorize填写Access Token。"}},"/api/v1/auth/refresh":{"post":{"tags":["01 账号认证"],"summary":"轮换访问和刷新令牌","operationId":"refresh_api_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"refreshToken":"replace-with-your-refresh-token"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"同时轮换双令牌，旧Refresh Token立即失效。并发请求应共用一次刷新；不要循环刷新。"}},"/api/v1/auth/me":{"get":{"tags":["01 账号认证"],"summary":"查询当前医生身份","operationId":"me_api_v1_auth_me_get","parameters":[],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoctorProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"账号全局role不等于诊所成员角色；诊所角色以/clinics/me结果为准。","security":[{"DoctorBearer":[]}]}},"/api/v1/auth/logout":{"post":{"tags":["01 账号认证"],"summary":"撤销当前登录会话","operationId":"logout_api_v1_auth_logout_post","parameters":[],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Logout Api V1 Auth Logout Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"使用Bearer令牌撤销会话，不删除账号或诊所成员关系。","security":[{"DoctorBearer":[]}]}},"/admin-api/system/auth/register":{"post":{"tags":["08 旧版兼容"],"summary":"旧客户端兼容：Legacy Register","operationId":"legacy_register_admin_api_system_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"username":"doctor-demo","password":"ReplaceWithYourOwnPassword","displayName":"演示医生","clinicName":"演示诊所"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"保留原响应格式。部分错误以HTTP200及code表示；不按新增clinic错误体解析。"}},"/admin-api/system/auth/login":{"post":{"tags":["08 旧版兼容"],"summary":"旧客户端兼容：Legacy Login","operationId":"legacy_login_admin_api_system_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"username":"doctor-demo","password":"ReplaceWithYourOwnPassword"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"保留原响应格式。部分错误以HTTP200及code表示；不按新增clinic错误体解析。"}},"/admin-api/system/auth/refresh-token":{"post":{"tags":["08 旧版兼容"],"summary":"旧客户端兼容：Legacy Refresh","operationId":"legacy_refresh_admin_api_system_auth_refresh_token_post","parameters":[{"name":"refreshToken","in":"query","required":true,"schema":{"type":"string","title":"Refreshtoken"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"保留原响应格式。部分错误以HTTP200及code表示；不按新增clinic错误体解析。"}},"/admin-api/system/auth/get-permission-info":{"get":{"tags":["08 旧版兼容"],"summary":"旧客户端兼容：Legacy Permission Info","operationId":"legacy_permission_info_admin_api_system_auth_get_permission_info_get","parameters":[],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"保留原响应格式。部分错误以HTTP200及code表示；不按新增clinic错误体解析。","security":[{"DoctorBearer":[]}]}},"/admin-api/system/auth/logout":{"post":{"tags":["08 旧版兼容"],"summary":"旧客户端兼容：Legacy Logout","operationId":"legacy_logout_admin_api_system_auth_logout_post","parameters":[],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"保留原响应格式。部分错误以HTTP200及code表示；不按新增clinic错误体解析。","security":[{"DoctorBearer":[]}]}},"/api/v1/analysis":{"post":{"tags":["08 旧版兼容"],"summary":"旧版五运六气分析报告","operationId":"analysis_api_v1_analysis_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"birth":"1990-05-01","as_of":"2026-11-03"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisReport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"当前接口不要求医生令牌。旧算法与新版context结构不同，尚有已知历法一致性问题；不得将体质倾向分当疾病概率。"}},"/analysis":{"post":{"tags":["08 旧版兼容"],"summary":"旧版五运六气分析报告","description":"当前接口不要求医生令牌。旧算法与新版context结构不同，尚有已知历法一致性问题；不得将体质倾向分当疾病概率。","operationId":"legacy_analysis_analysis_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"birth":"1990-05-01","as_of":"2026-11-03"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisReport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"deprecated":true}},"/api/v1/yunqi/context":{"post":{"tags":["07 运气服务"],"summary":"计算出生、年度与当下运气上下文","operationId":"context_api_v1_yunqi_context_post","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextRequest"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"birth":"1990-05-01","as_of":"2026-11-03T12:00:00+08:00"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Context Api V1 Yunqi Context Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"description":"时间必须带时区，内部转换为北京时间。未知出生时刻保留交界双方案，不输出疾病概率或自动处方。独立密钥未配置503、错误401、超过120次/分钟429。","security":[{"TcmServiceKey":[]}]}},"/api/v1/clinics/me":{"get":{"tags":["02 租户与患者"],"summary":"查询我的诊所与角色","operationId":"memberships_api_v1_clinics_me_get","parameters":[],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembershipList"},"example":{"items":[{"id":"00000000-0000-4000-8000-000000000005","name":"演示诊所","role":"DOCTOR"}]}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"仅返回当前账号的有效成员关系。注册后未加入诊所时items为空。","security":[{"DoctorBearer":[]}]}},"/api/v1/patients":{"get":{"tags":["02 租户与患者"],"summary":"检索可见患者","operationId":"patients_api_v1_patients_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":64,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientPage"},"example":{"items":[{"id":"00000000-0000-4000-8000-000000000001","caseNumber":"1","name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","version":1}],"total":1,"page":1,"size":20}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"支持姓名包含或档案号精确检索。列表不返回电话和地址。管理员看本租户；医生仅看本人关联患者。","security":[{"DoctorBearer":[]}]},"post":{"tags":["02 租户与患者"],"summary":"建立患者档案","operationId":"create_patient_api_v1_patients_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","phone":"","address":""}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDetail"},"example":{"id":"00000000-0000-4000-8000-000000000001","caseNumber":"1","name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","phone":"","address":"","version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}}},"description":"服务端并发安全分配租户内档案号。医生建档建立本人登记关联；管理员建档不自动授予其他医生访问权。","security":[{"DoctorBearer":[]}]}},"/api/v1/patients/{identifier}":{"get":{"tags":["02 租户与患者"],"summary":"读取患者详情","operationId":"patient_api_v1_patients__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDetail"},"example":{"id":"00000000-0000-4000-8000-000000000001","caseNumber":"1","name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","phone":"","address":"","version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"返回电话、地址及ETag。跨租户或非本人资源统一404。","security":[{"DoctorBearer":[]}]},"put":{"tags":["02 租户与患者"],"summary":"完整更新患者档案","operationId":"update_patient_api_v1_patients__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","phone":"","address":""}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDetail"},"example":{"id":"00000000-0000-4000-8000-000000000001","caseNumber":"1","name":"演示患者（合成数据）","sex":"unknown","birthday":"1990-05-01","phone":"","address":"","version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"PUT完整替换，省略字段回默认值。传入患者ETag；旧版本412，不自动覆盖。","security":[{"DoctorBearer":[]}]}},"/api/v1/operations/{key}":{"get":{"tags":["02 租户与患者"],"summary":"查询写操作是否已提交","operationId":"operation_api_v1_operations__key__get","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationView"},"example":{"status":"succeeded","resourceId":"00000000-0000-4000-8000-000000000002","httpStatus":200}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"仅查询本租户、当前操作者的幂等键。未知返回404，不能据此断定请求以后也不会提交。只返回结果元数据。","security":[{"DoctorBearer":[]}]}},"/api/v1/booking/stores":{"get":{"tags":["clinic"],"summary":"Stores","operationId":"stores_api_v1_booking_stores_get","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/stores/{platform}/{store}/confirm":{"put":{"tags":["clinic"],"summary":"Confirm","operationId":"confirm_api_v1_booking_stores__platform___store__confirm_put","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":0,"title":"Platform"}},{"name":"store","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"exclusiveMinimum":0,"title":"Store"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/stores/{platform}/{store}/doctors/{doctor}":{"put":{"tags":["clinic"],"summary":"Assign","operationId":"assign_api_v1_booking_stores__platform___store__doctors__doctor__put","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":0,"title":"Platform"}},{"name":"store","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"exclusiveMinimum":0,"title":"Store"}},{"name":"doctor","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"exclusiveMinimum":0,"title":"Doctor"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/stores/{platform}/{store}/slots":{"get":{"tags":["clinic"],"summary":"Clinic Slots","operationId":"clinic_slots_api_v1_booking_stores__platform___store__slots_get","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":0,"title":"Platform"}},{"name":"store","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"exclusiveMinimum":0,"title":"Store"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["clinic"],"summary":"Publish Slot","operationId":"publish_slot_api_v1_booking_stores__platform___store__slots_post","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"minimum":0,"title":"Platform"}},{"name":"store","in":"path","required":true,"schema":{"type":"integer","maximum":9223372036854775807,"exclusiveMinimum":0,"title":"Store"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotInput"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/slots/{slot}/close":{"put":{"tags":["clinic"],"summary":"Close Slot","operationId":"close_slot_api_v1_booking_slots__slot__close_put","parameters":[{"name":"slot","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Slot"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/slots/{slot}/appointments":{"get":{"tags":["clinic"],"summary":"Clinic Bookings","operationId":"clinic_bookings_api_v1_booking_slots__slot__appointments_get","parameters":[{"name":"slot","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Slot"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/appointments/{booking}/cancel":{"put":{"tags":["clinic"],"summary":"Cancel Clinic","operationId":"cancel_clinic_api_v1_booking_appointments__booking__cancel_put","parameters":[{"name":"booking","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Booking"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/booking/appointments/{booking}/check-in":{"put":{"tags":["clinic"],"summary":"Check In","operationId":"check_in_api_v1_booking_appointments__booking__check_in_put","parameters":[{"name":"booking","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Booking"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations":{"get":{"tags":["clinic"],"summary":"Listing","operationId":"listing_api_v1_consultations_get","parameters":[{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Before"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["WAITING","ACTIVE","COMPLETED","CANCELLED","REJECTED"],"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}":{"get":{"tags":["clinic"],"summary":"Detail","operationId":"detail_api_v1_consultations__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/state":{"put":{"tags":["clinic"],"summary":"Transition","operationId":"transition_api_v1_consultations__identifier__state_put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/messages":{"get":{"tags":["clinic"],"summary":"Messages","operationId":"messages_api_v1_consultations__identifier__messages_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"After"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Size"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":9223372036854775807,"minimum":0},{"type":"null"}],"title":"Before"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["clinic"],"summary":"Send","operationId":"send_api_v1_consultations__identifier__messages_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/read":{"put":{"tags":["clinic"],"summary":"Mark Read","operationId":"mark_read_api_v1_consultations__identifier__read_put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/attachments":{"get":{"tags":["clinic"],"summary":"Attachments","operationId":"attachments_api_v1_consultations__identifier__attachments_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["clinic"],"summary":"Upload","operationId":"upload_api_v1_consultations__identifier__attachments_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_api_v1_consultations__identifier__attachments_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/attachments/{attachment}":{"get":{"tags":["clinic"],"summary":"Image","operationId":"image_api_v1_consultations__identifier__attachments__attachment__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"attachment","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Attachment"}},{"name":"variant","in":"query","required":false,"schema":{"enum":["original","thumbnail"],"type":"string","default":"original","title":"Variant"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/diagnoses":{"get":{"tags":["clinic"],"summary":"Diagnosis","operationId":"diagnosis_api_v1_consultations__identifier__diagnoses_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/tongue-draft":{"put":{"tags":["clinic"],"summary":"Draft","operationId":"draft_api_v1_consultations__identifier__tongue_draft_put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TongueInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/tongue-publish":{"post":{"tags":["clinic"],"summary":"Publish","operationId":"publish_api_v1_consultations__identifier__tongue_publish_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TongueInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room":{"get":{"tags":["clinic"],"summary":"Roster","operationId":"roster_api_v1_consultations__identifier__room_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/messages":{"get":{"tags":["clinic"],"summary":"Messages","operationId":"messages_api_v1_consultations__identifier__room_messages_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"After"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Size"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":9223372036854775807,"minimum":0},{"type":"null"}],"title":"Before"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["clinic"],"summary":"Send","operationId":"send_api_v1_consultations__identifier__room_messages_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/read":{"put":{"tags":["clinic"],"summary":"Read","operationId":"read_api_v1_consultations__identifier__room_read_put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/attachments":{"post":{"tags":["clinic"],"summary":"Upload","operationId":"upload_api_v1_consultations__identifier__room_attachments_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_api_v1_consultations__identifier__room_attachments_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/attachments/{attachment}":{"get":{"tags":["clinic"],"summary":"Image","operationId":"image_api_v1_consultations__identifier__room_attachments__attachment__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"attachment","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Attachment"}},{"name":"variant","in":"query","required":false,"schema":{"enum":["original","thumbnail"],"type":"string","default":"original","title":"Variant"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/candidates":{"get":{"tags":["clinic"],"summary":"Candidates","operationId":"candidates_api_v1_consultations__identifier__room_candidates_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/ticket":{"post":{"tags":["clinic"],"summary":"Ticket","operationId":"ticket_api_v1_consultations__identifier__room_ticket_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/doctors":{"post":{"tags":["clinic"],"summary":"Invite","operationId":"invite_api_v1_consultations__identifier__room_doctors_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/{identifier}/room/doctors/{doctor_id}":{"delete":{"tags":["clinic"],"summary":"Remove","operationId":"remove_api_v1_consultations__identifier__room_doctors__doctor_id__delete","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"doctor_id","in":"path","required":true,"schema":{"type":"integer","title":"Doctor Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/consultations/rooms/mine":{"get":{"tags":["clinic"],"summary":"Rooms","operationId":"rooms_api_v1_consultations_rooms_mine_get","parameters":[{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Size"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding":{"get":{"tags":["clinic"],"summary":"Applications","operationId":"applications_api_v1_doctor_onboarding_get","parameters":[{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"After"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["clinic"],"summary":"Apply","operationId":"apply_api_v1_doctor_onboarding_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyInput"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding/agreement":{"get":{"tags":["clinic"],"summary":"Agreement","operationId":"agreement_api_v1_doctor_onboarding_agreement_get","parameters":[{"name":"storeId","in":"query","required":true,"schema":{"type":"integer","exclusiveMinimum":0,"title":"Storeid"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding/{account_id}/identity":{"put":{"tags":["clinic"],"summary":"Resubmit","operationId":"resubmit_api_v1_doctor_onboarding__account_id__identity_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer","exclusiveMinimum":0,"title":"Account Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding/{account_id}":{"get":{"tags":["clinic"],"summary":"Detail","operationId":"detail_api_v1_doctor_onboarding__account_id__get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer","exclusiveMinimum":0,"title":"Account Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding/{account_id}/certificate":{"put":{"tags":["clinic"],"summary":"Certificate","operationId":"certificate_api_v1_doctor_onboarding__account_id__certificate_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer","exclusiveMinimum":0,"title":"Account Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/doctor-onboarding/{account_id}/submit-review":{"post":{"tags":["clinic"],"summary":"Submit Review","operationId":"submit_review_api_v1_doctor_onboarding__account_id__submit_review_post","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer","exclusiveMinimum":0,"title":"Account Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/visits":{"post":{"tags":["03 就诊与病历"],"summary":"创建初诊或复诊","operationId":"create_visit_api_v1_visits_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"patientId":"00000000-0000-4000-8000-000000000001","type":"first"}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitView"},"example":{"resourceType":"visit","id":"00000000-0000-4000-8000-000000000003","visitId":"00000000-0000-4000-8000-000000000003","recordId":"00000000-0000-4000-8000-000000000002","patientId":"00000000-0000-4000-8000-000000000001","doctorId":1,"type":"first","status":"draft","version":1}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}}},"description":"一次就诊创建一份空草稿。初复诊按本诊所该患者是否已有非作废就诊判断；普通医生不能替别人创建接诊。管理员可指定有效成员。","security":[{"DoctorBearer":[]}]}},"/api/v1/patients/{patient_id}/records":{"get":{"tags":["03 就诊与病历"],"summary":"分页读取患者病历历史","operationId":"list_records_api_v1_patients__patient_id__records_get","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordPage"},"example":{"items":[{"id":"00000000-0000-4000-8000-000000000002","version":2,"status":"draft","doctorId":1,"visitType":"first","createdAt":"2026-11-03T04:00:00+00:00"}],"total":1,"page":1,"size":20}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"医生只见本人病历，即使患者也曾由其他医生接诊；管理员可读本诊所记录。","security":[{"DoctorBearer":[]}]}},"/api/v1/records/{identifier}":{"get":{"tags":["03 就诊与病历"],"summary":"读取病历与锁定金额","operationId":"read_record_api_v1_records__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordView"},"example":{"resourceType":"record","id":"00000000-0000-4000-8000-000000000002","recordId":"00000000-0000-4000-8000-000000000002","visitId":"00000000-0000-4000-8000-000000000003","patientId":"00000000-0000-4000-8000-000000000001","doctorId":1,"visitType":"first","status":"draft","version":2,"draft":{"chiefComplaint":"演示主诉","diagnosis":"演示诊断","pregnancy":"no","doses":1,"lines":[],"notes":"此示例不是真实诊疗资料"},"pricingStatus":"notPriced","createdAt":"2026-11-03T04:00:00+00:00","updatedAt":"2026-11-03T04:00:00+00:00"}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"返回草稿正文、临床版本和ETag；已提交记录包含pricing快照。","security":[{"DoctorBearer":[]}]},"put":{"tags":["03 就诊与病历"],"summary":"保存完整病历草稿","operationId":"save_draft_api_v1_records__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordDraft"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"chiefComplaint":"演示主诉","diagnosis":"演示诊断","pregnancy":"no","doses":1,"lines":[],"notes":"此示例不是真实诊疗资料"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordView"},"example":{"resourceType":"record","id":"00000000-0000-4000-8000-000000000002","recordId":"00000000-0000-4000-8000-000000000002","visitId":"00000000-0000-4000-8000-000000000003","patientId":"00000000-0000-4000-8000-000000000001","doctorId":1,"visitType":"first","status":"draft","version":2,"draft":{"chiefComplaint":"演示主诉","diagnosis":"演示诊断","pregnancy":"no","doses":1,"lines":[],"notes":"此示例不是真实诊疗资料"},"pricingStatus":"notPriced","createdAt":"2026-11-03T04:00:00+00:00","updatedAt":"2026-11-03T04:00:00+00:00"}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅接诊医生可改draft，管理员不能代改他人病历。省略字段恢复默认值；相同内容不增版本，不扣库存或收费。","security":[{"DoctorBearer":[]}]},"delete":{"tags":["03 就诊与病历"],"summary":"管理员作废草稿","operationId":"void_draft_api_v1_records__identifier__delete","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordView"},"example":{"resourceType":"record","id":"00000000-0000-4000-8000-000000000002","recordId":"00000000-0000-4000-8000-000000000002","visitId":"00000000-0000-4000-8000-000000000003","patientId":"00000000-0000-4000-8000-000000000001","doctorId":1,"visitType":"first","status":"voided","version":3,"draft":{"chiefComplaint":"演示主诉","diagnosis":"演示诊断","pregnancy":"no","doses":1,"lines":[],"notes":"此示例不是真实诊疗资料"},"pricingStatus":"notPriced","createdAt":"2026-11-03T04:00:00+00:00","updatedAt":"2026-11-03T04:00:00+00:00"}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅管理员可作废draft。保留正文、修订和审计；不是物理删除。submitted不可用此入口修改或删除。","security":[{"DoctorBearer":[]}]}},"/api/v1/herbs":{"get":{"tags":["04 药品与处方"],"summary":"检索本诊所启用药品","operationId":"herbs_api_v1_herbs_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":64,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbPage"},"example":{"items":[{"resourceType":"herb","id":"00000000-0000-4000-8000-000000000001","name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","taboo":"","reviewed":false,"reviewNote":"","active":true,"version":1}],"total":1,"page":1,"size":20}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"支持名称包含检索和分页。不提供库存、图片、拼音或医保状态占位值。","security":[{"DoctorBearer":[]}]},"post":{"tags":["04 药品与处方"],"summary":"管理员新增药品","operationId":"create_herb_api_v1_herbs_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","reviewed":false,"reviewNote":"","active":true}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbView"},"example":{"resourceType":"herb","id":"00000000-0000-4000-8000-000000000001","name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","taboo":"","reviewed":false,"reviewNote":"","active":true,"version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}}},"description":"单价最多4位小数，目前单位仅g。确认药品资料时必须填写核对依据并标注毒性。","security":[{"DoctorBearer":[]}]}},"/api/v1/herbs/{identifier}":{"get":{"tags":["04 药品与处方"],"summary":"读取药品资料与价格","operationId":"herb_api_v1_herbs__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbView"},"example":{"resourceType":"herb","id":"00000000-0000-4000-8000-000000000001","name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","taboo":"","reviewed":false,"reviewNote":"","active":true,"version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"包括毒性、字段禁忌、确认说明、启用状态和药品ETag。","security":[{"DoctorBearer":[]}]},"put":{"tags":["04 药品与处方"],"summary":"管理员更新或停用药品","operationId":"update_herb_api_v1_herbs__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","reviewed":false,"reviewNote":"","active":true}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HerbView"},"example":{"resourceType":"herb","id":"00000000-0000-4000-8000-000000000001","name":"演示药品","unit":"g","unitPrice":"0.5000","toxicity":"未标注","taboo":"","reviewed":false,"reviewNote":"","active":true,"version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"传入药品ETag。active=false为停用，不删除历史引用；资料变化会使旧报价失效。","security":[{"DoctorBearer":[]}]}},"/api/v1/settings/pricing":{"get":{"tags":["04 药品与处方"],"summary":"读取诊所诊金配置","operationId":"pricing_api_v1_settings_pricing_get","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingView"},"example":{"resourceType":"pricing","id":"00000000-0000-4000-8000-000000000005","configured":true,"consultationFee":"20.00","version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"未配置返回configured=false、金额null及v0 ETag，不静默用零元计费。","security":[{"DoctorBearer":[]}]},"put":{"tags":["04 药品与处方"],"summary":"管理员设置诊金","operationId":"update_pricing_api_v1_settings_pricing_put","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"consultationFee":"20.00"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingView"},"example":{"resourceType":"pricing","id":"00000000-0000-4000-8000-000000000005","configured":true,"consultationFee":"20.00","version":1}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"使用GET返回的pricing ETag，首次配置也需要v0。当前诊所统一诊金，未接理疗项目、折扣和价格档。","security":[{"DoctorBearer":[]}]}},"/api/v1/prescriptions/check":{"post":{"tags":["04 药品与处方"],"summary":"检查已保存处方","operationId":"check_api_v1_prescriptions_check_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordReference"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"recordId":"00000000-0000-4000-8000-000000000002"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckedPrescription"},"example":{"recordId":"00000000-0000-4000-8000-000000000002","recordVersion":2,"ruleVersion":"doctor-cda41c9-compatibility","blockedPairs":[],"warnings":[],"passed":true,"doseLimitsValidated":false}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}}},"description":"只读POST，不需要幂等键。从药库读取名称和禁忌。passed仅表示现有规则无阻断，不代表已验证剂量上限或可自动开药。","security":[{"DoctorBearer":[]}]}},"/api/v1/prescriptions/price":{"post":{"tags":["04 药品与处方"],"summary":"生成五分钟有效报价","operationId":"price_api_v1_prescriptions_price_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordReference"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"recordId":"00000000-0000-4000-8000-000000000002"}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteView"},"example":{"resourceType":"quote","id":"00000000-0000-4000-8000-000000000003","quoteId":"00000000-0000-4000-8000-000000000003","expiresAt":"2026-11-03T04:05:00+00:00","pricingAlgorithm":"per-dose-line-half-up-v1","pricingVersion":1,"ruleVersion":"doctor-cda41c9-compatibility","lines":[],"doses":1,"drugFee":"0.00","consultationFee":"20.00","total":"20.00","checks":{"blockedPairs":[],"warnings":[],"passed":true,"doseLimitsValidated":false},"recordId":"00000000-0000-4000-8000-000000000002","recordVersion":2,"draftHash":"0000000000000000000000000000000000000000000000000000000000000000"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}}},"description":"根据recordId读取已保存草稿，不信任客户端单价。逐味单剂舍入到分，求和乘剂数，再加诊金。存在阻断项也可返回报价，但不能提交。","security":[{"DoctorBearer":[]}]}},"/api/v1/records/{identifier}/submit":{"post":{"tags":["03 就诊与病历"],"summary":"正式提交并锁定报价","operationId":"submit_api_v1_records__identifier__submit_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"quoteId":"00000000-0000-4000-8000-000000000003","acknowledgedWarnings":[],"reviewNote":""}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordView"},"example":{"resourceType":"record","id":"00000000-0000-4000-8000-000000000002","recordId":"00000000-0000-4000-8000-000000000002","visitId":"00000000-0000-4000-8000-000000000003","patientId":"00000000-0000-4000-8000-000000000001","doctorId":1,"visitType":"first","status":"submitted","version":3,"draft":{"chiefComplaint":"演示主诉","diagnosis":"演示诊断","pregnancy":"no","doses":1,"lines":[],"notes":"此示例不是真实诊疗资料"},"pricingStatus":"locked","createdAt":"2026-11-03T04:00:00+00:00","updatedAt":"2026-11-03T04:00:00+00:00","pricing":{"pricingAlgorithm":"per-dose-line-half-up-v1","pricingVersion":1,"ruleVersion":"doctor-cda41c9-compatibility","lines":[],"doses":1,"drugFee":"0.00","consultationFee":"20.00","total":"20.00","checks":{"blockedPairs":[],"warnings":[],"passed":true,"doseLimitsValidated":false},"recordId":"00000000-0000-4000-8000-000000000002","recordVersion":2,"draftHash":"0000000000000000000000000000000000000000000000000000000000000000"}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅接诊医生。校验当前病历ETag、报价归属和5分钟有效期；重新校验价格及配伍。填写主诉和诊断，确认全部提示。提交不收款、不扣库存、不预占。","security":[{"DoctorBearer":[]}]}},"/api/v1/records/{identifier}/charges":{"get":{"tags":["05 收款与欠费"],"summary":"读取病历收款汇总","operationId":"finance_api_v1_records__identifier__charges_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCharges"},"example":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":1,"recordVersion":3,"charges":[{"resourceType":"charge","id":"00000000-0000-4000-8000-000000000004","recordId":"00000000-0000-4000-8000-000000000002","amount":"40.00","tendered":"50.00","change":"10.00","method":"cash","externalReference":null,"actorId":1,"createdAt":"2026-11-03T04:00:00+00:00"}],"chargesTruncated":false}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"包括独立财务ETag、临床recordVersion和最新100笔收款。chargesTruncated说明是否截断，汇总仍计算全部流水。","security":[{"DoctorBearer":[]}]}},"/api/v1/charges/{identifier}":{"get":{"tags":["05 收款与欠费"],"summary":"读取单笔收款及可退额度","operationId":"charge_api_v1_charges__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeView"},"example":{"resourceType":"charge","id":"00000000-0000-4000-8000-000000000004","recordId":"00000000-0000-4000-8000-000000000002","amount":"40.00","tendered":"50.00","change":"10.00","method":"cash","externalReference":null,"actorId":1,"createdAt":"2026-11-03T04:00:00+00:00","finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":1}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"顶层availableRefund是单笔可退额，finance.availableRefund是病历全部收款可退额。","security":[{"DoctorBearer":[]}]}},"/api/v1/charges":{"post":{"tags":["05 收款与欠费"],"summary":"登记已收到的款项","operationId":"collect_api_v1_charges_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"recordId":"00000000-0000-4000-8000-000000000002","recordVersion":3,"expectedOutstanding":"100.00","amount":"40.00","method":"cash","cashTendered":"50.00"}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeView"},"example":{"resourceType":"charge","id":"00000000-0000-4000-8000-000000000004","recordId":"00000000-0000-4000-8000-000000000002","amount":"40.00","tendered":"50.00","change":"10.00","method":"cash","externalReference":null,"actorId":1,"createdAt":"2026-11-03T04:00:00+00:00","finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":1}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅已提交病历。amount为入账净额，cashTendered为现金交付额；电子线下收款必须有流水号。不得超过未收金额。","security":[{"DoctorBearer":[]}]}},"/api/v1/debts":{"get":{"tags":["05 收款与欠费"],"summary":"分页查询未结清账单","operationId":"debts_api_v1_debts_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebtPage"},"example":{"items":[{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":1}],"total":1,"page":1,"size":20}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"含尚未首次付款的已提交记录；医生限本人接诊病历。先读单笔财务详情获取最新ETag再补收。","security":[{"DoctorBearer":[]}]}},"/api/v1/debts/{identifier}/collect":{"post":{"tags":["05 收款与欠费"],"summary":"登记欠费补收","operationId":"collect_debt_api_v1_debts__identifier__collect_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"recordId":"00000000-0000-4000-8000-000000000002","recordVersion":3,"expectedOutstanding":"100.00","amount":"40.00","method":"cash","cashTendered":"50.00"}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeView"},"example":{"resourceType":"charge","id":"00000000-0000-4000-8000-000000000004","recordId":"00000000-0000-4000-8000-000000000002","amount":"40.00","tendered":"50.00","change":"10.00","method":"cash","externalReference":null,"actorId":1,"createdAt":"2026-11-03T04:00:00+00:00","finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":1}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"路径identifier是recordId，请求recordId必须一致。金额、幂等及权限规则与收款相同。","security":[{"DoctorBearer":[]}]}},"/api/v1/refunds":{"post":{"tags":["06 退费审批"],"summary":"申请退费并预留额度","operationId":"request_refund_api_v1_refunds_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"填写实际退费原因"}}}}}},"responses":{"201":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundView"},"example":{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"pending","version":1,"requestedBy":1,"reviewedBy":null,"reviewNote":"","completedBy":null,"method":null,"externalReference":null,"completionNote":"","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":null,"completedAt":null,"finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"20.00","availableRefund":"20.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":2}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"按单笔已收金额减待审批、已批准及已完成退费计算可退额。申请不代表实际退款，不改变应收或净实收。","security":[{"DoctorBearer":[]}]},"get":{"tags":["06 退费审批"],"summary":"分页查询退费申请","operationId":"refunds_api_v1_refunds_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["pending","approved","rejected","completed"],"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundPage"},"example":{"items":[{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"pending","version":1,"requestedBy":1,"reviewedBy":null,"reviewNote":"","completedBy":null,"method":null,"externalReference":null,"completionNote":"","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":null,"completedAt":null}],"total":1,"page":1,"size":20}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"使用status筛选pending/approved/rejected/completed；医生只看本人接诊记录。","security":[{"DoctorBearer":[]}]}},"/api/v1/refunds/{identifier}":{"get":{"tags":["06 退费审批"],"summary":"读取退费详情与财务版本","operationId":"refund_api_v1_refunds__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundView"},"example":{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"pending","version":1,"requestedBy":1,"reviewedBy":null,"reviewNote":"","completedBy":null,"method":null,"externalReference":null,"completionNote":"","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":null,"completedAt":null,"finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"20.00","availableRefund":"20.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":2}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"包括申请、审批、实际退款登记信息。返回的是finance ETag，不是refund对象version。","security":[{"DoctorBearer":[]}]}},"/api/v1/refunds/{identifier}/approve":{"post":{"tags":["06 退费审批"],"summary":"另一位管理员批准退费","operationId":"approve_api_v1_refunds__identifier__approve_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"remark":"填写实际审核说明"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundView"},"example":{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"approved","version":2,"requestedBy":1,"reviewedBy":2,"reviewNote":"演示审核说明","completedBy":null,"method":null,"externalReference":null,"completionNote":"","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":"2026-11-03T04:00:00+00:00","completedAt":null,"finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"20.00","availableRefund":"20.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":2}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅pending。申请人本人不能审批；只有一位管理员时也不放行。批准不等于实际退款。","security":[{"DoctorBearer":[]}]}},"/api/v1/refunds/{identifier}/reject":{"post":{"tags":["06 退费审批"],"summary":"另一位管理员驳回退费","operationId":"reject_api_v1_refunds__identifier__reject_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"remark":"填写实际审核说明"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundView"},"example":{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"rejected","version":2,"requestedBy":1,"reviewedBy":2,"reviewNote":"演示审核说明","completedBy":null,"method":null,"externalReference":null,"completionNote":"","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":"2026-11-03T04:00:00+00:00","completedAt":null,"finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"0.00","adjustedReceivable":"100.00","receivedGross":"40.00","chargeCount":1,"refunded":"0.00","receivedNet":"40.00","refundReserved":"0.00","availableRefund":"40.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":3}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅pending，释放占用的可退额度；申请人同样不得自审。","security":[{"DoctorBearer":[]}]}},"/api/v1/refunds/{identifier}/complete":{"post":{"tags":["06 退费审批"],"summary":"登记实际线下退款完成","operationId":"complete_api_v1_refunds__identifier__complete_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteRefundInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"confirmation":"paid","method":"cash","note":"填写实际退还情况"}}}}}},"responses":{"200":{"description":"操作成功。示例为合成数据，请替换实际资源ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundView"},"example":{"resourceType":"refund","id":"00000000-0000-4000-8000-000000000006","recordId":"00000000-0000-4000-8000-000000000002","chargeId":"00000000-0000-4000-8000-000000000004","amount":"20.00","reason":"演示退费原因","status":"completed","version":3,"requestedBy":1,"reviewedBy":2,"reviewNote":"演示审核说明","completedBy":2,"method":"cash","externalReference":null,"completionNote":"演示实际退还记录","createdAt":"2026-11-03T04:00:00+00:00","reviewedAt":"2026-11-03T04:00:00+00:00","completedAt":"2026-11-03T04:00:00+00:00","finance":{"recordId":"00000000-0000-4000-8000-000000000002","originalReceivable":"100.00","credited":"20.00","adjustedReceivable":"80.00","receivedGross":"40.00","chargeCount":1,"refunded":"20.00","receivedNet":"20.00","refundReserved":"0.00","availableRefund":"20.00","outstanding":"60.00","collectionStatus":"partiallyPaid","version":4}}}},"headers":{"ETag":{"description":"对应资源或财务汇总的当前版本，修改时原样传入If-Match。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"仅管理员处理approved，confirmation必须为paid。完成后等额减免应收并保留原账单，不新增欠款，也不自动回库。","security":[{"DoctorBearer":[]}]}},"/api/v1/doctors/me/profile":{"get":{"tags":["13 医生资料"],"summary":"Profile","operationId":"profile_api_v1_doctors_me_profile_get","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n仅当前医生。资料和权限需要X-Clinic-Id；operation查询仅本人账号。诊所名称和诊金为只读，禁止修改账号和角色。","security":[{"DoctorBearer":[]}]},"put":{"tags":["13 医生资料"],"summary":"Update Profile","operationId":"update_profile_api_v1_doctors_me_profile_put","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"if-match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"displayName":"演示医生","prescriptionHeader":"演示诊所处方","dispenser":"","phone":"","address":"","pinyin":"ysys","department":"全科"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n仅当前医生。资料和权限需要X-Clinic-Id；operation查询仅本人账号。诊所名称和诊金为只读，禁止修改账号和角色。","security":[{"DoctorBearer":[]}]}},"/api/v1/doctors/me/permissions":{"get":{"tags":["13 医生资料"],"summary":"Permissions","operationId":"permissions_api_v1_doctors_me_permissions_get","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n仅当前医生。资料和权限需要X-Clinic-Id；operation查询仅本人账号。诊所名称和诊金为只读，禁止修改账号和角色。","security":[{"DoctorBearer":[]}]}},"/api/v1/auth/password":{"post":{"tags":["01 账号认证"],"summary":"修改本人密码并退出全部会话","operationId":"change_password_api_v1_auth_password_post","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"oldPassword":"ReplaceWithCurrentPassword","newPassword":"ReplaceWithNewPassword"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResult"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}}},"description":"Bearer与Idempotency-Key必填；验证原密码后原子更新scrypt密码，撤销全部访问与刷新会话。成功需重新登录；超时先用新密码登录，再查/doctors/me/operations/{key}。403原密码错误，422新旧密码相同。\n\nBearer与Idempotency-Key必填；验证原密码后原子更新scrypt密码，撤销全部访问与刷新会话。成功需重新登录；超时先用新密码登录，再查/doctors/me/operations/{key}。403原密码错误，422新旧密码相同。","security":[{"DoctorBearer":[]}]}},"/api/v1/doctors/me/operations/{key}":{"get":{"tags":["13 医生资料"],"summary":"Operation","operationId":"operation_api_v1_doctors_me_operations__key__get","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingsOperationView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n仅当前医生。资料和权限需要X-Clinic-Id；operation查询仅本人账号。诊所名称和诊金为只读，禁止修改账号和角色。","security":[{"DoctorBearer":[]}]}},"/api/v1/dict/{kind}":{"get":{"tags":["10 临床字典"],"summary":"检索诊所共享字典","operationId":"dictionaries_api_v1_dict__kind__get","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["diseases","syndromes","diagnoses","acupoints","cases"],"type":"string","title":"Kind"}},{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":100,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferencePage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所临床字典：病证/辨证/诊断/穴位/医案。医生读取、管理员维护；kind非法422。","security":[{"DoctorBearer":[]}]},"post":{"tags":["10 临床字典"],"summary":"管理员新建字典条目","operationId":"create_dictionary_api_v1_dict__kind__post","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["diseases","syndromes","diagnoses","acupoints","cases"],"type":"string","title":"Kind"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示条目","pinyin":"ystm","description":"演示说明","content":"请维护已审核内容"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所临床字典：病证/辨证/诊断/穴位/医案。医生读取、管理员维护；kind非法422。","security":[{"DoctorBearer":[]}]}},"/api/v1/dict/{kind}/{identifier}":{"get":{"tags":["10 临床字典"],"summary":"获取字典条目","operationId":"dictionary_api_v1_dict__kind___identifier__get","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["diseases","syndromes","diagnoses","acupoints","cases"],"type":"string","title":"Kind"}},{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所临床字典：病证/辨证/诊断/穴位/医案。医生读取、管理员维护；kind非法422。","security":[{"DoctorBearer":[]}]},"put":{"tags":["10 临床字典"],"summary":"管理员更新字典条目","operationId":"update_dictionary_api_v1_dict__kind___identifier__put","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["diseases","syndromes","diagnoses","acupoints","cases"],"type":"string","title":"Kind"}},{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示条目","pinyin":"ystm","description":"演示说明","content":"请维护已审核内容"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所临床字典：病证/辨证/诊断/穴位/医案。医生读取、管理员维护；kind非法422。","security":[{"DoctorBearer":[]}]},"delete":{"tags":["10 临床字典"],"summary":"管理员删除字典条目","operationId":"delete_dictionary_api_v1_dict__kind___identifier__delete","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["diseases","syndromes","diagnoses","acupoints","cases"],"type":"string","title":"Kind"}},{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所临床字典：病证/辨证/诊断/穴位/医案。医生读取、管理员维护；kind非法422。","security":[{"DoctorBearer":[]}]}},"/api/v1/drug-usages":{"get":{"tags":["12 药物用法"],"summary":"检索药物用法与煎法","operationId":"usages_api_v1_drug_usages_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":100,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsagePage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n药物用法和煎法共享目录。医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"post":{"tags":["12 药物用法"],"summary":"管理员新建药物用法","operationId":"create_usage_api_v1_drug_usages_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示用法","pinyin":"ysyf","decoction":"请填写已审核煎法"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n药物用法和煎法共享目录。医生读取、管理员维护。","security":[{"DoctorBearer":[]}]}},"/api/v1/drug-usages/{identifier}":{"get":{"tags":["12 药物用法"],"summary":"获取药物用法","operationId":"usage_api_v1_drug_usages__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n药物用法和煎法共享目录。医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"put":{"tags":["12 药物用法"],"summary":"管理员更新药物用法","operationId":"update_usage_api_v1_drug_usages__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示用法","pinyin":"ysyf","decoction":"请填写已审核煎法"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n药物用法和煎法共享目录。医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"delete":{"tags":["12 药物用法"],"summary":"管理员删除药物用法","operationId":"delete_usage_api_v1_drug_usages__identifier__delete","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrugUsageView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n药物用法和煎法共享目录。医生读取、管理员维护。","security":[{"DoctorBearer":[]}]}},"/api/v1/formulas":{"get":{"tags":["11 方剂模板"],"summary":"检索经验、辨病或经典方剂模板","operationId":"formulas_api_v1_formulas_get","parameters":[{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"enum":["experience","disease","classic"],"type":"string"},{"type":"null"}],"title":"Type"}},{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":100,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaPage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n三类处方模板：experience/disease/classic。模板不是已提交处方，不自动计价或扣库存；医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"post":{"tags":["11 方剂模板"],"summary":"管理员新建方剂模板","operationId":"create_formula_api_v1_formulas_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"type":"experience","name":"演示模板","pinyin":"ysmb","description":"合成示例，不是治疗建议","lines":[{"herbId":null,"herbName":"演示药品","dose":"1.0000","unit":"g","usage":""}]}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n三类处方模板：experience/disease/classic。模板不是已提交处方，不自动计价或扣库存；医生读取、管理员维护。","security":[{"DoctorBearer":[]}]}},"/api/v1/formulas/{identifier}":{"get":{"tags":["11 方剂模板"],"summary":"获取方剂模板及药味明细","operationId":"formula_api_v1_formulas__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n三类处方模板：experience/disease/classic。模板不是已提交处方，不自动计价或扣库存；医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"put":{"tags":["11 方剂模板"],"summary":"管理员更新方剂模板（分类不可变）","operationId":"update_formula_api_v1_formulas__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"type":"experience","name":"演示模板","pinyin":"ysmb","description":"合成示例，不是治疗建议","lines":[{"herbId":null,"herbName":"演示药品","dose":"1.0000","unit":"g","usage":""}]}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n三类处方模板：experience/disease/classic。模板不是已提交处方，不自动计价或扣库存；医生读取、管理员维护。","security":[{"DoctorBearer":[]}]},"delete":{"tags":["11 方剂模板"],"summary":"管理员删除方剂模板","operationId":"delete_formula_api_v1_formulas__identifier__delete","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FormulaView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n三类处方模板：experience/disease/classic。模板不是已提交处方，不自动计价或扣库存；医生读取、管理员维护。","security":[{"DoctorBearer":[]}]}},"/api/v1/patients/{patient}/photos":{"get":{"tags":["14 患者照片"],"summary":"读取患者四个照片位置","operationId":"slots_api_v1_patients__patient__photos_get","parameters":[{"name":"patient","in":"path","required":true,"schema":{"type":"string","title":"Patient"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"四个位置及最新患者版本；空位置的url/sha256为null。照片写入与患者档案共享版本。","headers":{"ETag":{"schema":{"type":"string"},"description":"患者ETag，例：\"patient-UUID-v1\"，修改照片时原样传入If-Match。"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhotoSlots"},"example":{"id":"00000000-0000-4000-8000-000000000001","patientId":"00000000-0000-4000-8000-000000000001","resourceType":"photo","version":1,"photos":[{"slot":1,"url":null,"sha256":null},{"slot":2,"url":null,"sha256":null},{"slot":3,"url":null,"sha256":null},{"slot":4,"url":null,"sha256":null}]}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n患者4槽位照片，slot为1..4；沿用患者可见范围。读取图片也必须携带Bearer与X-Clinic-Id，不公开静态图片地址。","security":[{"DoctorBearer":[]}]},"post":{"tags":["14 患者照片"],"summary":"上传照片至固定位置，替换原照片并清除EXIF信息","operationId":"upload_api_v1_patients__patient__photos_post","parameters":[{"name":"patient","in":"path","required":true,"schema":{"type":"string","title":"Patient"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_api_v1_patients__patient__photos_post"}}}},"responses":{"200":{"description":"四个位置及最新患者版本；空位置的url/sha256为null。照片写入与患者档案共享版本。","headers":{"ETag":{"schema":{"type":"string"},"description":"患者ETag，例：\"patient-UUID-v1\"，修改照片时原样传入If-Match。"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhotoSlots"},"example":{"id":"00000000-0000-4000-8000-000000000001","patientId":"00000000-0000-4000-8000-000000000001","resourceType":"photo","version":1,"photos":[{"slot":1,"url":null,"sha256":null},{"slot":2,"url":null,"sha256":null},{"slot":3,"url":null,"sha256":null},{"slot":4,"url":null,"sha256":null}]}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n患者4槽位照片，slot为1..4；沿用患者可见范围。读取图片也必须携带Bearer与X-Clinic-Id，不公开静态图片地址。\n\n使用multipart/form-data上传slot(1..4)和file；有效JPEG/PNG，最多5MiB、2000万像素；服务端重编码为JPEG并去除EXIF。写入前获取患者ETag。","security":[{"DoctorBearer":[]}]}},"/api/v1/patients/{patient}/photos/{slot}":{"get":{"tags":["14 患者照片"],"summary":"读取私有照片（须携带令牌与诊所头）","operationId":"photo_api_v1_patients__patient__photos__slot__get","parameters":[{"name":"patient","in":"path","required":true,"schema":{"type":"string","title":"Patient"}},{"name":"slot","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Slot"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"经鉴权的JPEG图片；Cache-Control:no-store。前端携带Authorization和X-Clinic-Id读取后显示，不是公开静态链接。","content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n患者4槽位照片，slot为1..4；沿用患者可见范围。读取图片也必须携带Bearer与X-Clinic-Id，不公开静态图片地址。","security":[{"DoctorBearer":[]}]},"delete":{"tags":["14 患者照片"],"summary":"删除患者指定位置照片","operationId":"delete_api_v1_patients__patient__photos__slot__delete","parameters":[{"name":"patient","in":"path","required":true,"schema":{"type":"string","title":"Patient"}},{"name":"slot","in":"path","required":true,"schema":{"type":"integer","maximum":4,"minimum":1,"title":"Slot"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"responses":{"200":{"description":"四个位置及最新患者版本；空位置的url/sha256为null。照片写入与患者档案共享版本。","headers":{"ETag":{"schema":{"type":"string"},"description":"患者ETag，例：\"patient-UUID-v1\"，修改照片时原样传入If-Match。"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhotoSlots"},"example":{"id":"00000000-0000-4000-8000-000000000001","patientId":"00000000-0000-4000-8000-000000000001","resourceType":"photo","version":1,"photos":[{"slot":1,"url":null,"sha256":null},{"slot":2,"url":null,"sha256":null},{"slot":3,"url":null,"sha256":null},{"slot":4,"url":null,"sha256":null}]}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n患者4槽位照片，slot为1..4；沿用患者可见范围。读取图片也必须携带Bearer与X-Clinic-Id，不公开静态图片地址。","security":[{"DoctorBearer":[]}]}},"/api/v1/reports/{kind}":{"get":{"tags":["15 业务报表"],"summary":"诊所管理员五类报表","description":"start/end为北京时间日期且均包含，最多366天。金额/克数为十进制字符串。返回basis说明口径；debt是当前余额，不是历史余额。利润与导出尚未开放。\n\n仅诊所管理员查询。start/end为北京时间日期且均包含、最多366天；余额为当前余额，非历史时点。利润及PDF/XLSX导出未接入。","operationId":"report_api_v1_reports__kind__get","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["revenue","refund","debt","workload","drug-sales"],"type":"string","title":"Kind"}},{"name":"start","in":"query","required":true,"schema":{"type":"string","format":"date","title":"Start"}},{"name":"end","in":"query","required":true,"schema":{"type":"string","format":"date","title":"End"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportView"},"examples":{"revenue":{"summary":"revenue（合成示例）","value":{"kind":"revenue","start":"2026-11-03","end":"2026-11-03","timezone":"Asia/Shanghai","basis":"具体统计口径见实际响应basis字段","items":[{"day":"2026-11-03","method":"cash","received":"100.00","refunded":"20.00","net":"80.00"}],"total":1,"page":1,"size":20}},"refund":{"summary":"refund（合成示例）","value":{"kind":"refund","start":"2026-11-03","end":"2026-11-03","timezone":"Asia/Shanghai","basis":"具体统计口径见实际响应basis字段","items":[{"id":"00000000-0000-4000-8000-000000000004","recordId":"00000000-0000-4000-8000-000000000002","amount":"20.00","method":"cash","completedAt":"2026-11-03T04:00:00+00:00","requestedBy":1,"reviewedBy":2,"completedBy":2}],"total":1,"page":1,"size":20}},"workload":{"summary":"workload（合成示例）","value":{"kind":"workload","start":"2026-11-03","end":"2026-11-03","timezone":"Asia/Shanghai","basis":"具体统计口径见实际响应basis字段","items":[{"doctorId":1,"encounters":1,"firstVisits":"1","followupVisits":"0","submittedRecords":"1","drafts":"0"}],"total":1,"page":1,"size":20}},"debt":{"summary":"debt（合成示例）","value":{"kind":"debt","start":"2026-11-03","end":"2026-11-03","timezone":"Asia/Shanghai","basis":"具体统计口径见实际响应basis字段","items":[{"recordId":"00000000-0000-4000-8000-000000000002","submittedAt":"2026-11-03T04:00:00+00:00","originalReceivable":"100.00","received":"40.00","outstanding":"60.00"}],"total":1,"page":1,"size":20}},"drug-sales":{"summary":"drug-sales（合成示例）","value":{"kind":"drug-sales","start":"2026-11-03","end":"2026-11-03","timezone":"Asia/Shanghai","basis":"具体统计口径见实际响应basis字段","items":[{"herbId":"00000000-0000-4000-8000-000000000003","name":"演示药品","quantity":"1.000","billedAmount":"1.00"}],"total":1,"page":1,"size":20}}}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/inventory":{"get":{"tags":["16 库存与发药"],"summary":"库存与预警（管理员）","description":"按克返回总量、未过期可用量及过期量。stock为零可用库存；expiry为30天内到期及已过期库存。\n\n诊所库存与实物流转。提交处方不预占，发药扣减；单纯退费不回库，实际验收退药才回库。","operationId":"inventory_api_v1_inventory_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":64,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"warn","in":"query","required":false,"schema":{"anyOf":[{"enum":["stock","expiry"],"type":"string"},{"type":"null"}],"title":"Warn"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockPage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/inventory/ledger":{"get":{"tags":["16 库存与发药"],"summary":"查询库存流水（管理员）","description":"start含、end不含，时间须带时区。数量为有符号克数；退款不产生库存流水。\n\n诊所库存与实物流转。提交处方不预占，发药扣减；单纯退费不回库，实际验收退药才回库。","operationId":"ledger_api_v1_inventory_ledger_get","parameters":[{"name":"herbId","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":36,"maxLength":36},{"type":"null"}],"title":"Herbid"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLedgerPage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/inventory/{herb_id}":{"get":{"tags":["16 库存与发药"],"summary":"读取药品库存及批次（管理员）","description":"首次库存版本为0。进货和盘点使用这里的inventory ETag，不能使用herb ETag。\n\n诊所库存与实物流转。提交处方不预占，发药扣减；单纯退费不回库，实际验收退药才回库。","operationId":"stock_api_v1_inventory__herb_id__get","parameters":[{"name":"herb_id","in":"path","required":true,"schema":{"type":"string","title":"Herb Id"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/inventory/purchases":{"post":{"tags":["16 库存与发药"],"summary":"登记批次进货（管理员）","description":"一条进货明细作为一笔原子操作。批号、效期、数量及单价必填；拒绝已过期批次。每笔创建独立批次，未实现成本估值。\n\n诊所库存与实物流转。提交处方不预占，发药扣减；单纯退费不回库，实际验收退药才回库。","operationId":"purchase_api_v1_inventory_purchases_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"herbId":"00000000-0000-4000-8000-000000000003","quantity":"100.0000","unitCost":"0.5000","supplierId":null,"lot":"DEMO-LOT","expiresOn":"2027-11-03","reason":"演示进货，需替换实际单据"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/inventory/stocktake":{"post":{"tags":["16 库存与发药"],"summary":"按批次盘点（管理员）","description":"actual为该批次实盘克数，非药品全部批次的总量；差异及原因入流水。\n\n诊所库存与实物流转。提交处方不预占，发药扣减；单纯退费不回库，实际验收退药才回库。","operationId":"stocktake_api_v1_inventory_stocktake_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StocktakeInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"herbId":"00000000-0000-4000-8000-000000000003","batchId":"00000000-0000-4000-8000-000000000005","actual":"90.0000","reason":"填写实际盘点原因"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/suppliers":{"get":{"tags":["17 供应商"],"summary":"供应商列表（管理员）","operationId":"suppliers_api_v1_suppliers_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","maxLength":100,"default":"","title":"Keyword"},"description":"检索词。当前支持的检索范围见接口说明。"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"},"description":"页码，从1开始。"},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"},"description":"每页条数，默认20，最大100。"},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierPage"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所供应商维护。读取需诊所身份，写入仅管理员。","security":[{"DoctorBearer":[]}]},"post":{"tags":["17 供应商"],"summary":"新增供应商（管理员）","operationId":"create_supplier_api_v1_suppliers_post","parameters":[{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示供应商","phone":"","address":"","active":true}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所供应商维护。读取需诊所身份，写入仅管理员。","security":[{"DoctorBearer":[]}]}},"/api/v1/suppliers/{identifier}":{"get":{"tags":["17 供应商"],"summary":"读取供应商（管理员）","operationId":"supplier_api_v1_suppliers__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"description":"\n\n诊所供应商维护。读取需诊所身份，写入仅管理员。","security":[{"DoctorBearer":[]}]},"put":{"tags":["17 供应商"],"summary":"修改或停用供应商（管理员）","description":"active=false停用供应商，保留历史进货引用。\n\n诊所供应商维护。读取需诊所身份，写入仅管理员。","operationId":"update_supplier_api_v1_suppliers__identifier__put","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"name":"演示供应商","phone":"","address":"","active":true}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/records/{identifier}/dispensing":{"get":{"tags":["16 库存与发药"],"summary":"查询处方发药及可退明细","description":"普通医生仅本人病历。返回dispensing ETag及原批次明细ID，供验收退药使用。\n\n发药使用独立dispensing ETag，提交处方不预占库存；按近效期优先分配有效批次。缺货整笔拒绝。退药需原发药明细ID及实际验收克数，不自动退款。","operationId":"dispensing_api_v1_records__identifier__dispensing_get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispensingView"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]},"post":{"tags":["16 库存与发药"],"summary":"整张处方发药，近效期优先","description":"仅正式提交处方。后端按冻结处方的每剂用量×剂数扣减，FEFO跨批次分配，排除已过期批次。任一药缺货整笔回滚；每张仅发一次。\n\n发药使用独立dispensing ETag，提交处方不预占库存；按近效期优先分配有效批次。缺货整笔拒绝。退药需原发药明细ID及实际验收克数，不自动退款。","operationId":"dispense_api_v1_records__identifier__dispensing_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispenseInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"reason":"填写实际发药说明"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispensingView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/api/v1/records/{identifier}/returns":{"post":{"tags":["16 库存与发药"],"summary":"登记验收退药，回原批次","description":"必须实际验收后提交原发药明细ID和退回克数，累计不得超过原出库。回原批次；过期批次不计可用量。此操作不自动退款。\n\n发药使用独立dispensing ETag，提交处方不预占库存；按近效期优先分配有效批次。缺货整笔拒绝。退药需原发药明细ID及实际验收克数，不自动退款。","operationId":"accept_return_api_v1_records__identifier__returns_post","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"X-Clinic-Id","in":"header","required":true,"schema":{"type":"string","minLength":36,"maxLength":36,"title":"X-Clinic-Id"},"description":"从GET /api/v1/clinics/me取得的租户UUID，仅作选择器，服务端仍校验成员和资源权限。"},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Idempotency-Key"},"description":"每个新业务操作生成新UUID；超时重试复用原键和原请求，不要另生成键。"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"},"description":"填入对应GET响应的完整ETag，包含双引号。财务ETag与病历ETag不同。缺失428，旧版本412。"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReturnInput"},"examples":{"synthetic":{"summary":"合成示例（请替换资源ID和个人凭据）","value":{"lines":[{"dispensingLineId":"00000000-0000-4000-8000-000000000006","quantity":"1.0000"}],"reason":"填写实际验收退药原因"}}}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispensingView"}}},"headers":{"ETag":{"description":"当前资源版本。后续修改原样传入If-Match，不可与其他资源版本混用。","schema":{"type":"string"}}}},"422":{"description":"字段、金额或业务输入不合法","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"VALIDATION_ERROR","message":"字段、金额或业务输入不合法","details":{},"requestId":"demo-request-id"}}}},"401":{"description":"未提供有效会话，或令牌已过期/撤销","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"AUTH_REQUIRED","message":"未提供有效会话，或令牌已过期/撤销","details":{},"requestId":"demo-request-id"}}}},"403":{"description":"当前身份没有权限；申请人不得自审退费","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PERMISSION_DENIED","message":"当前身份没有权限；申请人不得自审退费","details":{},"requestId":"demo-request-id"}}}},"404":{"description":"资源不存在或不属于可访问范围","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RESOURCE_NOT_FOUND","message":"资源不存在或不属于可访问范围","details":{},"requestId":"demo-request-id"}}}},"429":{"description":"请求过多，按Retry-After稍后重试","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RATE_LIMITED","message":"请求过多，按Retry-After稍后重试","details":{},"requestId":"demo-request-id"}}}},"409":{"description":"状态冲突、重复流水、同键不同请求或报价变化","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"BUSINESS_STATE_CONFLICT","message":"状态冲突、重复流水、同键不同请求或报价变化","details":{},"requestId":"demo-request-id"}}}},"413":{"description":"请求体超过该接口允许的大小","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PAYLOAD_TOO_LARGE","message":"请求体超过该接口允许的大小","details":{},"requestId":"demo-request-id"}}}},"412":{"description":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"RECORD_VERSION_CONFLICT","message":"If-Match已过期，重新GET后由用户确认，不能静默覆盖","details":{},"requestId":"demo-request-id"}}}},"428":{"description":"缺少If-Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClinicErrorView"},"example":{"code":"PRECONDITION_REQUIRED","message":"缺少If-Match","details":{},"requestId":"demo-request-id"}}}}},"security":[{"DoctorBearer":[]}]}},"/health":{"get":{"tags":["09 健康检查"],"summary":"检查HTTP进程存活","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Health Health Get"}}}}},"description":"返回服务、版本和环境信息。当前不检测数据库，不能据此判断业务事务可成功。"}},"/health/live":{"get":{"tags":["09 健康检查"],"summary":"检查HTTP进程存活","operationId":"liveness_health_live_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Liveness Health Live Get"}}}}},"description":"返回服务、版本和环境信息。当前不检测数据库，不能据此判断业务事务可成功。"}},"/health/ready":{"get":{"tags":["09 健康检查"],"summary":"检查HTTP进程存活","operationId":"readiness_health_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"description":"返回服务、版本和环境信息。当前不检测数据库，不能据此判断业务事务可成功。"}}},"components":{"schemas":{"AnalysisReport":{"properties":{"schema_version":{"type":"string","title":"Schema Version"},"algorithm_version":{"type":"string","title":"Algorithm Version"},"birth":{"type":"string","title":"Birth"},"as_of":{"type":"string","title":"As Of"},"yunqi":{"additionalProperties":true,"type":"object","title":"Yunqi"},"constitution":{"items":{},"type":"array","title":"Constitution"},"imbalance":{"additionalProperties":true,"type":"object","title":"Imbalance"}},"type":"object","required":["schema_version","algorithm_version","birth","as_of","yunqi","constitution","imbalance"],"title":"AnalysisReport"},"AnalysisRequest":{"properties":{"birth":{"type":"string","format":"date","title":"Birth"},"as_of":{"type":"string","format":"date","title":"As Of"}},"additionalProperties":false,"type":"object","required":["birth","as_of"],"title":"AnalysisRequest"},"ApplyInput":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"avatarUrl":{"type":"string","maxLength":512,"minLength":1,"title":"Avatarurl"},"introduction":{"type":"string","maxLength":1000,"title":"Introduction","default":""},"idCardNo":{"type":"string","maxLength":18,"minLength":18,"format":"password","title":"Idcardno","writeOnly":true},"agreementVersion":{"type":"string","maxLength":16,"minLength":1,"title":"Agreementversion"},"storeId":{"type":"integer","exclusiveMinimum":0.0,"title":"Storeid"},"username":{"type":"string","maxLength":64,"minLength":3,"pattern":"^[a-z0-9][a-z0-9_.@+-]*$","title":"Username"},"password":{"type":"string","maxLength":128,"minLength":8,"format":"password","title":"Password","writeOnly":true}},"additionalProperties":false,"type":"object","required":["name","avatarUrl","idCardNo","agreementVersion","storeId","username","password"],"title":"ApplyInput"},"Body_upload_api_v1_consultations__identifier__attachments_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"purpose":{"type":"string","enum":["IMAGE","TONGUE"],"title":"Purpose","default":"IMAGE"}},"type":"object","required":["file"],"title":"Body_upload_api_v1_consultations__identifier__attachments_post"},"Body_upload_api_v1_consultations__identifier__room_attachments_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_api_v1_consultations__identifier__room_attachments_post"},"Body_upload_api_v1_patients__patient__photos_post":{"properties":{"slot":{"type":"integer","maximum":4.0,"minimum":1.0,"title":"Slot"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["slot","file"],"title":"Body_upload_api_v1_patients__patient__photos_post"},"CertificateInput":{"properties":{"certType":{"type":"integer","title":"Certtype"},"fileUrl":{"type":"string","maxLength":512,"minLength":1,"title":"Fileurl"},"certNo":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Certno"}},"additionalProperties":false,"type":"object","required":["certType","fileUrl"],"title":"CertificateInput"},"ChargeInput":{"properties":{"recordId":{"type":"string","format":"uuid","title":"Recordid"},"recordVersion":{"type":"integer","exclusiveMinimum":0.0,"title":"Recordversion"},"expectedOutstanding":{"anyOf":[{"type":"number","maximum":99999999.99,"minimum":0.0},{"type":"string"}],"title":"Expectedoutstanding"},"amount":{"anyOf":[{"type":"number","maximum":99999999.99,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Amount"},"method":{"type":"string","enum":["cash","wechatOffline","alipayOffline"],"title":"Method"},"cashTendered":{"anyOf":[{"type":"number","maximum":99999999.99,"minimum":0.0},{"type":"string"},{"type":"null"}],"title":"Cashtendered"},"externalReference":{"anyOf":[{"type":"string","maxLength":128,"minLength":1},{"type":"null"}],"title":"Externalreference"}},"additionalProperties":false,"type":"object","required":["recordId","recordVersion","expectedOutstanding","amount","method"],"title":"ChargeInput"},"CompleteRefundInput":{"properties":{"confirmation":{"type":"string","const":"paid","title":"Confirmation"},"method":{"type":"string","enum":["cash","wechatOffline","alipayOffline"],"title":"Method"},"externalReference":{"anyOf":[{"type":"string","maxLength":128,"minLength":1},{"type":"null"}],"title":"Externalreference"},"note":{"type":"string","maxLength":1000,"minLength":1,"title":"Note"}},"additionalProperties":false,"type":"object","required":["confirmation","method","note"],"title":"CompleteRefundInput"},"ContextRequest":{"properties":{"birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Birth"},"birth_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Birth Time"},"as_of":{"type":"string","format":"date-time","title":"As Of"}},"additionalProperties":false,"type":"object","required":["as_of"],"title":"ContextRequest"},"DispenseInput":{"properties":{"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["reason"],"title":"DispenseInput"},"DispensingLineView":{"properties":{"id":{"type":"string","title":"Id","description":"验收退药时提交为dispensingLineId"},"herbId":{"type":"string","title":"Herbid"},"batchId":{"type":"string","title":"Batchid"},"lot":{"type":"string","title":"Lot"},"expiresOn":{"type":"string","format":"date","title":"Expireson"},"quantity":{"type":"string","title":"Quantity"},"returnedQuantity":{"type":"string","title":"Returnedquantity"}},"additionalProperties":false,"type":"object","required":["id","herbId","batchId","lot","expiresOn","quantity","returnedQuantity"],"title":"DispensingLineView"},"DispensingView":{"properties":{"resourceType":{"type":"string","title":"Resourcetype","default":"dispensing"},"id":{"type":"string","title":"Id"},"recordId":{"type":"string","title":"Recordid"},"version":{"type":"integer","title":"Version"},"dispensed":{"type":"boolean","title":"Dispensed"},"lines":{"items":{"$ref":"#/components/schemas/DispensingLineView"},"type":"array","title":"Lines"}},"additionalProperties":false,"type":"object","required":["id","recordId","version","dispensed","lines"],"title":"DispensingView"},"DoctorProfile":{"properties":{"id":{"type":"integer","title":"Id"},"username":{"type":"string","title":"Username"},"displayName":{"type":"string","title":"Displayname"},"clinicName":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clinicname"},"role":{"type":"string","title":"Role"}},"type":"object","required":["id","username","displayName","role"],"title":"DoctorProfile"},"DoctorProfileResponse":{"properties":{"doctor":{"$ref":"#/components/schemas/DoctorProfile"},"expiresTime":{"type":"integer","title":"Expirestime"}},"type":"object","required":["doctor","expiresTime"],"title":"DoctorProfileResponse"},"DrugUsageInput":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"用法名称，对应旧版用法字段"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"decoction":{"type":"string","maxLength":8000,"title":"Decoction","description":"煎法说明","default":""}},"additionalProperties":false,"type":"object","required":["name"],"title":"DrugUsageInput"},"DrugUsagePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DrugUsageView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"DrugUsagePage"},"DrugUsageView":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"用法名称，对应旧版用法字段"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"decoction":{"type":"string","maxLength":8000,"title":"Decoction","description":"煎法说明","default":""},"resourceType":{"type":"string","const":"reference","title":"Resourcetype","default":"reference"},"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","const":"usages","title":"Kind"},"active":{"type":"boolean","title":"Active"},"version":{"type":"integer","title":"Version"}},"additionalProperties":false,"type":"object","required":["name","id","kind","active","version"],"title":"DrugUsageView"},"FormulaInput":{"properties":{"type":{"type":"string","enum":["experience","disease","classic"],"title":"Type"},"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"description":{"type":"string","maxLength":8000,"title":"Description","default":""},"lines":{"items":{"$ref":"#/components/schemas/FormulaLine-Input"},"type":"array","maxItems":100,"title":"Lines"}},"additionalProperties":false,"type":"object","required":["type","name"],"title":"FormulaInput"},"FormulaLine-Input":{"properties":{"herbId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Herbid","description":"可选本诊所药品ID；名称知识条目可暂不绑定"},"herbName":{"type":"string","maxLength":100,"minLength":1,"title":"Herbname"},"dose":{"anyOf":[{"type":"number","maximum":100000.0,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Dose"},"unit":{"type":"string","const":"g","title":"Unit","default":"g"},"usage":{"type":"string","maxLength":100,"title":"Usage","default":""}},"additionalProperties":false,"type":"object","required":["herbName","dose"],"title":"FormulaLine"},"FormulaLine-Output":{"properties":{"herbId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Herbid","description":"可选本诊所药品ID；名称知识条目可暂不绑定"},"herbName":{"type":"string","maxLength":100,"minLength":1,"title":"Herbname"},"dose":{"type":"string","title":"Dose"},"unit":{"type":"string","const":"g","title":"Unit","default":"g"},"usage":{"type":"string","maxLength":100,"title":"Usage","default":""}},"additionalProperties":false,"type":"object","required":["herbName","dose"],"title":"FormulaLine"},"FormulaPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FormulaView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"FormulaPage"},"FormulaView":{"properties":{"type":{"type":"string","enum":["experience","disease","classic"],"title":"Type"},"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"description":{"type":"string","maxLength":8000,"title":"Description","default":""},"lines":{"items":{"$ref":"#/components/schemas/FormulaLine-Output"},"type":"array","maxItems":100,"title":"Lines"},"resourceType":{"type":"string","const":"reference","title":"Resourcetype","default":"reference"},"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","enum":["formula-experience","formula-disease","formula-classic"],"title":"Kind"},"active":{"type":"boolean","title":"Active"},"version":{"type":"integer","title":"Version"}},"additionalProperties":false,"type":"object","required":["type","name","id","kind","active","version"],"title":"FormulaView"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HerbInput":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"unit":{"type":"string","const":"g","title":"Unit","default":"g"},"unitPrice":{"anyOf":[{"type":"number","maximum":99999999.9999,"minimum":0.0},{"type":"string"}],"title":"Unitprice"},"toxicity":{"type":"string","enum":["无毒","小毒","有毒","大毒","未标注"],"title":"Toxicity"},"taboo":{"type":"string","maxLength":2000,"title":"Taboo","default":""},"reviewed":{"type":"boolean","title":"Reviewed","default":false},"reviewNote":{"type":"string","maxLength":1000,"title":"Reviewnote","default":""},"active":{"type":"boolean","title":"Active","default":true}},"additionalProperties":false,"type":"object","required":["name","unitPrice","toxicity"],"title":"HerbInput"},"IdentityInput":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"avatarUrl":{"type":"string","maxLength":512,"minLength":1,"title":"Avatarurl"},"introduction":{"type":"string","maxLength":1000,"title":"Introduction","default":""},"idCardNo":{"type":"string","maxLength":18,"minLength":18,"format":"password","title":"Idcardno","writeOnly":true},"agreementVersion":{"type":"string","maxLength":16,"minLength":1,"title":"Agreementversion"}},"additionalProperties":false,"type":"object","required":["name","avatarUrl","idCardNo","agreementVersion"],"title":"IdentityInput"},"InviteInput":{"properties":{"doctorId":{"type":"integer","maximum":9.223372036854776e+18,"exclusiveMinimum":0.0,"title":"Doctorid"}},"additionalProperties":false,"type":"object","required":["doctorId"],"title":"InviteInput"},"LoginRequest":{"properties":{"username":{"type":"string","maxLength":64,"minLength":1,"title":"Username"},"password":{"type":"string","maxLength":128,"minLength":1,"title":"Password"}},"type":"object","required":["username","password"],"title":"LoginRequest"},"LoginResponse":{"properties":{"accessToken":{"type":"string","title":"Accesstoken"},"refreshToken":{"type":"string","title":"Refreshtoken"},"tokenType":{"type":"string","title":"Tokentype","default":"Bearer"},"expiresTime":{"type":"integer","title":"Expirestime"},"refreshExpiresTime":{"type":"integer","title":"Refreshexpirestime"},"doctor":{"$ref":"#/components/schemas/DoctorProfile"}},"type":"object","required":["accessToken","refreshToken","expiresTime","refreshExpiresTime","doctor"],"title":"LoginResponse"},"MessageInput":{"properties":{"clientMessageId":{"type":"string","pattern":"^[A-Za-z0-9_.-]{8,80}$","title":"Clientmessageid"},"text":{"type":"string","maxLength":4000,"title":"Text","default":""},"attachmentId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Attachmentid"}},"additionalProperties":false,"type":"object","required":["clientMessageId"],"title":"MessageInput"},"PasswordInput":{"properties":{"oldPassword":{"type":"string","maxLength":128,"minLength":1,"format":"password","title":"Oldpassword","writeOnly":true},"newPassword":{"type":"string","maxLength":128,"minLength":8,"format":"password","title":"Newpassword","writeOnly":true}},"additionalProperties":false,"type":"object","required":["oldPassword","newPassword"],"title":"PasswordInput"},"PasswordResult":{"properties":{"changed":{"type":"boolean","title":"Changed"},"reLoginRequired":{"type":"boolean","title":"Reloginrequired"},"operationKey":{"type":"string","title":"Operationkey"}},"type":"object","required":["changed","reLoginRequired","operationKey"],"title":"PasswordResult"},"PatientInput":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"sex":{"type":"string","enum":["male","female","unknown"],"title":"Sex","default":"unknown"},"birthday":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Birthday"},"phone":{"type":"string","maxLength":32,"title":"Phone","default":""},"address":{"type":"string","maxLength":255,"title":"Address","default":""}},"additionalProperties":false,"type":"object","required":["name"],"title":"PatientInput"},"PermissionView":{"properties":{"clinicId":{"type":"string","title":"Clinicid"},"role":{"type":"string","title":"Role"},"permissions":{"items":{"type":"string"},"type":"array","title":"Permissions"},"patientScope":{"type":"string","title":"Patientscope"},"canSelfApproveRefund":{"type":"boolean","title":"Canselfapproverefund","default":false}},"type":"object","required":["clinicId","role","permissions","patientScope"],"title":"PermissionView"},"PrescriptionDraftLine":{"properties":{"herbId":{"type":"string","format":"uuid","title":"Herbid"},"dose":{"anyOf":[{"type":"number","maximum":100000.0,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Dose"},"unit":{"type":"string","const":"g","title":"Unit","default":"g"},"usage":{"type":"string","maxLength":100,"title":"Usage","default":""}},"additionalProperties":false,"type":"object","required":["herbId","dose"],"title":"PrescriptionDraftLine"},"PricingInput":{"properties":{"consultationFee":{"anyOf":[{"type":"number","maximum":99999999.99,"minimum":0.0},{"type":"string"}],"title":"Consultationfee"}},"additionalProperties":false,"type":"object","required":["consultationFee"],"title":"PricingInput"},"ProfileInput":{"properties":{"birthDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Birthdate","description":"出生日期；省略保留，显式 null 清空"},"introduction":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Introduction"},"avatarUrl":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Avatarurl"},"displayName":{"type":"string","maxLength":64,"minLength":1,"title":"Displayname"},"prescriptionHeader":{"type":"string","maxLength":100,"title":"Prescriptionheader","default":""},"dispenser":{"type":"string","maxLength":64,"title":"Dispenser","default":""},"phone":{"type":"string","maxLength":32,"title":"Phone","default":""},"address":{"type":"string","maxLength":255,"title":"Address","default":""},"pinyin":{"type":"string","maxLength":128,"title":"Pinyin","default":""},"department":{"type":"string","maxLength":64,"title":"Department","default":""}},"additionalProperties":false,"type":"object","required":["displayName"],"title":"ProfileInput"},"ProfileView":{"properties":{"birthDate":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Birthdate","description":"出生日期；省略保留，显式 null 清空"},"introduction":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Introduction"},"avatarUrl":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Avatarurl"},"displayName":{"type":"string","maxLength":64,"minLength":1,"title":"Displayname"},"prescriptionHeader":{"type":"string","maxLength":100,"title":"Prescriptionheader","default":""},"dispenser":{"type":"string","maxLength":64,"title":"Dispenser","default":""},"phone":{"type":"string","maxLength":32,"title":"Phone","default":""},"address":{"type":"string","maxLength":255,"title":"Address","default":""},"pinyin":{"type":"string","maxLength":128,"title":"Pinyin","default":""},"department":{"type":"string","maxLength":64,"title":"Department","default":""},"age":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Age"},"id":{"type":"integer","title":"Id"},"username":{"type":"string","title":"Username"},"clinicId":{"type":"string","title":"Clinicid"},"clinicName":{"type":"string","title":"Clinicname"},"consultationFee":{"type":"string","title":"Consultationfee"},"version":{"type":"integer","title":"Version"}},"additionalProperties":false,"type":"object","required":["displayName","id","username","clinicId","clinicName","consultationFee","version"],"title":"ProfileView"},"PurchaseInput":{"properties":{"herbId":{"type":"string","format":"uuid","title":"Herbid"},"quantity":{"anyOf":[{"type":"number","maximum":9999999999.0,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Quantity"},"unitCost":{"anyOf":[{"type":"number","maximum":99999999.0,"minimum":0.0},{"type":"string"}],"title":"Unitcost"},"supplierId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Supplierid"},"lot":{"type":"string","maxLength":100,"minLength":1,"title":"Lot"},"expiresOn":{"type":"string","format":"date","title":"Expireson"},"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["herbId","quantity","unitCost","lot","expiresOn","reason"],"title":"PurchaseInput"},"ReadInput":{"properties":{"sequence":{"type":"integer","minimum":0.0,"title":"Sequence"}},"additionalProperties":false,"type":"object","required":["sequence"],"title":"ReadInput"},"RecordDraft":{"properties":{"chiefComplaint":{"type":"string","maxLength":8000,"title":"Chiefcomplaint","default":""},"history":{"type":"string","maxLength":8000,"title":"History","default":""},"symptoms":{"type":"string","maxLength":8000,"title":"Symptoms","default":""},"syndrome":{"type":"string","maxLength":8000,"title":"Syndrome","default":""},"diagnosis":{"type":"string","maxLength":8000,"title":"Diagnosis","default":""},"treatment":{"type":"string","maxLength":8000,"title":"Treatment","default":""},"notes":{"type":"string","maxLength":8000,"title":"Notes","default":""},"pregnancy":{"type":"string","enum":["unknown","yes","no"],"title":"Pregnancy","default":"unknown"},"doses":{"type":"integer","maximum":365.0,"minimum":1.0,"title":"Doses","default":1},"lines":{"items":{"$ref":"#/components/schemas/PrescriptionDraftLine"},"type":"array","maxItems":100,"title":"Lines"}},"additionalProperties":false,"type":"object","title":"RecordDraft"},"RecordReference":{"properties":{"recordId":{"type":"string","format":"uuid","title":"Recordid"}},"additionalProperties":false,"type":"object","required":["recordId"],"title":"RecordReference"},"ReferenceInput":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"description":{"type":"string","maxLength":8000,"title":"Description","default":""},"content":{"type":"string","maxLength":8000,"title":"Content","default":""},"treatment":{"type":"string","maxLength":8000,"title":"Treatment","default":""},"meridian":{"type":"string","maxLength":200,"title":"Meridian","default":""},"indications":{"type":"string","maxLength":8000,"title":"Indications","default":""},"needleDepth":{"type":"string","maxLength":200,"title":"Needledepth","default":""},"taboo":{"type":"string","maxLength":8000,"title":"Taboo","default":""},"combinations":{"type":"string","maxLength":8000,"title":"Combinations","default":""},"fiveShuCategory":{"type":"string","maxLength":200,"title":"Fiveshucategory","default":""},"fiveElement":{"type":"string","maxLength":200,"title":"Fiveelement","default":""},"specialCategory":{"type":"string","maxLength":200,"title":"Specialcategory","default":""},"flowOrder":{"type":"integer","maximum":1000.0,"minimum":0.0,"title":"Floworder","default":0},"reinforcement":{"type":"string","maxLength":200,"title":"Reinforcement","default":""},"bodyRegion":{"type":"string","maxLength":200,"title":"Bodyregion","default":""},"tripleBurner":{"type":"string","maxLength":200,"title":"Tripleburner","default":""},"recommendationOrder":{"type":"integer","maximum":100000.0,"minimum":0.0,"title":"Recommendationorder","default":0}},"additionalProperties":false,"type":"object","required":["name"],"title":"ReferenceInput"},"ReferencePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ReferenceView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"ReferencePage"},"ReferenceView":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"pinyin":{"type":"string","maxLength":200,"title":"Pinyin","default":""},"description":{"type":"string","maxLength":8000,"title":"Description","default":""},"content":{"type":"string","maxLength":8000,"title":"Content","default":""},"treatment":{"type":"string","maxLength":8000,"title":"Treatment","default":""},"meridian":{"type":"string","maxLength":200,"title":"Meridian","default":""},"indications":{"type":"string","maxLength":8000,"title":"Indications","default":""},"needleDepth":{"type":"string","maxLength":200,"title":"Needledepth","default":""},"taboo":{"type":"string","maxLength":8000,"title":"Taboo","default":""},"combinations":{"type":"string","maxLength":8000,"title":"Combinations","default":""},"fiveShuCategory":{"type":"string","maxLength":200,"title":"Fiveshucategory","default":""},"fiveElement":{"type":"string","maxLength":200,"title":"Fiveelement","default":""},"specialCategory":{"type":"string","maxLength":200,"title":"Specialcategory","default":""},"flowOrder":{"type":"integer","maximum":1000.0,"minimum":0.0,"title":"Floworder","default":0},"reinforcement":{"type":"string","maxLength":200,"title":"Reinforcement","default":""},"bodyRegion":{"type":"string","maxLength":200,"title":"Bodyregion","default":""},"tripleBurner":{"type":"string","maxLength":200,"title":"Tripleburner","default":""},"recommendationOrder":{"type":"integer","maximum":100000.0,"minimum":0.0,"title":"Recommendationorder","default":0},"resourceType":{"type":"string","const":"reference","title":"Resourcetype","default":"reference"},"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","enum":["diseases","syndromes","diagnoses","acupoints","cases"],"title":"Kind"},"active":{"type":"boolean","title":"Active"},"version":{"type":"integer","title":"Version"}},"additionalProperties":false,"type":"object","required":["name","id","kind","active","version"],"title":"ReferenceView"},"RefreshRequest":{"properties":{"refreshToken":{"type":"string","title":"Refreshtoken"}},"type":"object","required":["refreshToken"],"title":"RefreshRequest"},"RefundInput":{"properties":{"chargeId":{"type":"string","format":"uuid","title":"Chargeid"},"amount":{"anyOf":[{"type":"number","maximum":99999999.99,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Amount"},"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["chargeId","amount","reason"],"title":"RefundInput"},"RegisterRequest":{"properties":{"username":{"type":"string","maxLength":64,"minLength":3,"pattern":"^[a-zA-Z0-9_.-]+$","title":"Username"},"password":{"type":"string","maxLength":128,"minLength":8,"title":"Password"},"displayName":{"type":"string","maxLength":64,"minLength":1,"title":"Displayname"},"clinicName":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Clinicname"}},"additionalProperties":false,"type":"object","required":["username","password","displayName"],"title":"RegisterRequest"},"ReturnInput":{"properties":{"lines":{"items":{"$ref":"#/components/schemas/ReturnLine"},"type":"array","maxItems":1000,"minItems":1,"title":"Lines"},"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["lines","reason"],"title":"ReturnInput"},"ReturnLine":{"properties":{"dispensingLineId":{"type":"string","format":"uuid","title":"Dispensinglineid"},"quantity":{"anyOf":[{"type":"number","maximum":9999999999.0,"exclusiveMinimum":0.0},{"type":"string"}],"title":"Quantity"}},"additionalProperties":false,"type":"object","required":["dispensingLineId","quantity"],"title":"ReturnLine"},"ReviewInput":{"properties":{"remark":{"type":"string","maxLength":1000,"minLength":1,"title":"Remark"}},"additionalProperties":false,"type":"object","required":["remark"],"title":"ReviewInput"},"SettingsOperationView":{"properties":{"status":{"type":"string","title":"Status"},"result":{"additionalProperties":true,"type":"object","title":"Result"}},"type":"object","required":["status","result"],"title":"SettingsOperationView"},"SlotInput":{"properties":{"doctorRef":{"type":"string","format":"uuid","title":"Doctorref"},"startTime":{"type":"string","format":"date-time","title":"Starttime"},"endTime":{"type":"string","format":"date-time","title":"Endtime"},"capacity":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Capacity"}},"additionalProperties":false,"type":"object","required":["doctorRef","startTime","endTime","capacity"],"title":"SlotInput"},"StateInput":{"properties":{"action":{"type":"string","enum":["accept","reject","complete","cancel"],"title":"Action"},"version":{"type":"integer","exclusiveMinimum":0.0,"title":"Version"}},"additionalProperties":false,"type":"object","required":["action","version"],"title":"StateInput"},"StockBatchView":{"properties":{"id":{"type":"string","title":"Id"},"lot":{"type":"string","title":"Lot"},"expiresOn":{"type":"string","format":"date","title":"Expireson"},"quantity":{"type":"string","title":"Quantity"},"unitCost":{"type":"string","title":"Unitcost"}},"additionalProperties":false,"type":"object","required":["id","lot","expiresOn","quantity","unitCost"],"title":"StockBatchView"},"StockLedgerPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/StockLedgerView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"StockLedgerPage"},"StockLedgerView":{"properties":{"id":{"type":"string","title":"Id"},"herbId":{"type":"string","title":"Herbid"},"batchId":{"type":"string","title":"Batchid"},"kind":{"type":"string","title":"Kind"},"quantity":{"type":"string","title":"Quantity"},"balance":{"type":"string","title":"Balance"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recordid"},"supplierId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supplierid"},"reason":{"type":"string","title":"Reason"},"unitCost":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unitcost"},"createdAt":{"type":"string","title":"Createdat"}},"additionalProperties":false,"type":"object","required":["id","herbId","batchId","kind","quantity","balance","recordId","supplierId","reason","unitCost","createdAt"],"title":"StockLedgerView"},"StockPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/StockView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"StockPage"},"StockView":{"properties":{"resourceType":{"type":"string","title":"Resourcetype","default":"inventory"},"id":{"type":"string","title":"Id"},"herbId":{"type":"string","title":"Herbid"},"name":{"type":"string","title":"Name"},"unit":{"type":"string","title":"Unit","default":"g"},"quantity":{"type":"string","title":"Quantity","description":"物理总库存，含过期批次"},"availableQuantity":{"type":"string","title":"Availablequantity","description":"未过期批次总量，FEFO可用"},"expiredQuantity":{"type":"string","title":"Expiredquantity"},"version":{"type":"integer","title":"Version"},"batchId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batchid"},"batches":{"anyOf":[{"items":{"$ref":"#/components/schemas/StockBatchView"},"type":"array"},{"type":"null"}],"title":"Batches"}},"additionalProperties":false,"type":"object","required":["id","herbId","name","quantity","availableQuantity","expiredQuantity","version"],"title":"StockView"},"StocktakeInput":{"properties":{"herbId":{"type":"string","format":"uuid","title":"Herbid"},"batchId":{"type":"string","format":"uuid","title":"Batchid"},"actual":{"anyOf":[{"type":"number","maximum":9999999999.0,"minimum":0.0},{"type":"string"}],"title":"Actual"},"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["herbId","batchId","actual","reason"],"title":"StocktakeInput"},"SubmitInput":{"properties":{"quoteId":{"type":"string","format":"uuid","title":"Quoteid"},"acknowledgedWarnings":{"items":{"type":"string","pattern":"^[a-z0-9-]{1,80}$"},"type":"array","maxItems":200,"title":"Acknowledgedwarnings"},"reviewNote":{"type":"string","maxLength":1000,"title":"Reviewnote","default":""}},"additionalProperties":false,"type":"object","required":["quoteId"],"title":"SubmitInput"},"SupplierInput":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"phone":{"type":"string","maxLength":40,"title":"Phone","default":""},"address":{"type":"string","maxLength":500,"title":"Address","default":""},"active":{"type":"boolean","title":"Active","default":true}},"additionalProperties":false,"type":"object","required":["name"],"title":"SupplierInput"},"SupplierPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SupplierView"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"}},"additionalProperties":false,"type":"object","required":["items","total","page","size"],"title":"SupplierPage"},"SupplierView":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"phone":{"type":"string","maxLength":40,"title":"Phone","default":""},"address":{"type":"string","maxLength":500,"title":"Address","default":""},"active":{"type":"boolean","title":"Active","default":true},"resourceType":{"type":"string","title":"Resourcetype","default":"supplier"},"id":{"type":"string","title":"Id"},"version":{"type":"integer","title":"Version"}},"additionalProperties":false,"type":"object","required":["name","id","version"],"title":"SupplierView"},"TongueInput":{"properties":{"version":{"type":"integer","exclusiveMinimum":0.0,"title":"Version","description":"会话当前 version，防止覆盖其他修改"},"attachmentIds":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":10,"minItems":1,"title":"Attachmentids"},"tongueBody":{"type":"string","maxLength":8000,"title":"Tonguebody","default":""},"tongueCoating":{"type":"string","maxLength":8000,"title":"Tonguecoating","default":""},"observation":{"type":"string","maxLength":8000,"title":"Observation","default":""},"diagnosis":{"type":"string","maxLength":8000,"minLength":1,"title":"Diagnosis"},"advice":{"type":"string","maxLength":8000,"title":"Advice","default":""}},"additionalProperties":false,"type":"object","required":["version","attachmentIds","diagnosis"],"title":"TongueInput"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VisitInput":{"properties":{"patientId":{"type":"string","format":"uuid","title":"Patientid"},"type":{"type":"string","enum":["first","followup"],"title":"Type"},"doctorId":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Doctorid"}},"additionalProperties":false,"type":"object","required":["patientId","type"],"title":"VisitInput"},"ClinicErrorView":{"properties":{"code":{"title":"Code","type":"string"},"message":{"title":"Message","type":"string"},"details":{"additionalProperties":true,"title":"Details","type":"object"},"requestId":{"title":"Requestid","type":"string"}},"required":["code","message","details","requestId"],"title":"ClinicErrorView","type":"object"},"Membership":{"properties":{"id":{"title":"Id","type":"string"},"name":{"title":"Name","type":"string"},"role":{"enum":["ADMIN","DOCTOR"],"title":"Role","type":"string"}},"required":["id","name","role"],"title":"Membership","type":"object"},"MembershipList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Membership"},"title":"Items","type":"array"}},"required":["items"],"title":"MembershipList","type":"object"},"PatientSummary":{"properties":{"id":{"title":"Id","type":"string"},"caseNumber":{"title":"Casenumber","type":"string"},"name":{"title":"Name","type":"string"},"sex":{"enum":["male","female","unknown"],"title":"Sex","type":"string"},"birthday":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Birthday"},"version":{"title":"Version","type":"integer"}},"required":["id","caseNumber","name","sex","birthday","version"],"title":"PatientSummary","type":"object"},"PatientPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PatientSummary"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["items","total","page","size"],"title":"PatientPage","type":"object"},"PatientDetail":{"properties":{"id":{"title":"Id","type":"string"},"caseNumber":{"title":"Casenumber","type":"string"},"name":{"title":"Name","type":"string"},"sex":{"enum":["male","female","unknown"],"title":"Sex","type":"string"},"birthday":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Birthday"},"version":{"title":"Version","type":"integer"},"phone":{"title":"Phone","type":"string"},"address":{"title":"Address","type":"string"}},"required":["id","caseNumber","name","sex","birthday","version","phone","address"],"title":"PatientDetail","type":"object"},"OperationView":{"properties":{"status":{"const":"succeeded","title":"Status","type":"string"},"resourceId":{"title":"Resourceid","type":"string"},"httpStatus":{"title":"Httpstatus","type":"integer"}},"required":["status","resourceId","httpStatus"],"title":"OperationView","type":"object"},"VisitView":{"properties":{"resourceType":{"const":"visit","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"visitId":{"title":"Visitid","type":"string"},"recordId":{"title":"Recordid","type":"string"},"patientId":{"title":"Patientid","type":"string"},"doctorId":{"title":"Doctorid","type":"integer"},"type":{"enum":["first","followup"],"title":"Type","type":"string"},"status":{"const":"draft","title":"Status","type":"string"},"version":{"title":"Version","type":"integer"}},"required":["resourceType","id","visitId","recordId","patientId","doctorId","type","status","version"],"title":"VisitView","type":"object"},"RecordSummary":{"properties":{"id":{"title":"Id","type":"string"},"version":{"title":"Version","type":"integer"},"status":{"enum":["draft","submitted","voided"],"title":"Status","type":"string"},"doctorId":{"title":"Doctorid","type":"integer"},"visitType":{"enum":["first","followup"],"title":"Visittype","type":"string"},"createdAt":{"title":"Createdat","type":"string"}},"required":["id","version","status","doctorId","visitType","createdAt"],"title":"RecordSummary","type":"object"},"RecordPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RecordSummary"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["items","total","page","size"],"title":"RecordPage","type":"object"},"CheckItem":{"properties":{"id":{"title":"Id","type":"string"},"rule":{"title":"Rule","type":"string"},"herbs":{"items":{"type":"string"},"title":"Herbs","type":"array"},"advice":{"title":"Advice","type":"string"},"severity":{"title":"Severity","type":"string"}},"required":["id","rule","herbs","advice","severity"],"title":"CheckItem","type":"object"},"PrescriptionChecks":{"properties":{"blockedPairs":{"items":{"$ref":"#/components/schemas/CheckItem"},"title":"Blockedpairs","type":"array"},"warnings":{"items":{"$ref":"#/components/schemas/CheckItem"},"title":"Warnings","type":"array"},"passed":{"title":"Passed","type":"boolean"},"doseLimitsValidated":{"const":false,"title":"Doselimitsvalidated","type":"boolean"}},"required":["blockedPairs","warnings","passed","doseLimitsValidated"],"title":"PrescriptionChecks","type":"object"},"PricedLine":{"properties":{"herbId":{"title":"Herbid","type":"string"},"name":{"title":"Name","type":"string"},"unit":{"const":"g","title":"Unit","type":"string"},"dose":{"title":"Dose","type":"string"},"unitPrice":{"title":"Unitprice","type":"string"},"herbVersion":{"title":"Herbversion","type":"integer"},"amountPerDose":{"title":"Amountperdose","type":"string"}},"required":["herbId","name","unit","dose","unitPrice","herbVersion","amountPerDose"],"title":"PricedLine","type":"object"},"PricingSnapshot":{"properties":{"pricingAlgorithm":{"title":"Pricingalgorithm","type":"string"},"pricingVersion":{"title":"Pricingversion","type":"integer"},"ruleVersion":{"title":"Ruleversion","type":"string"},"lines":{"items":{"$ref":"#/components/schemas/PricedLine"},"title":"Lines","type":"array"},"doses":{"title":"Doses","type":"integer"},"drugFee":{"title":"Drugfee","type":"string"},"consultationFee":{"title":"Consultationfee","type":"string"},"total":{"title":"Total","type":"string"},"checks":{"$ref":"#/components/schemas/PrescriptionChecks"},"recordId":{"title":"Recordid","type":"string"},"recordVersion":{"title":"Recordversion","type":"integer"},"draftHash":{"title":"Drafthash","type":"string"}},"required":["pricingAlgorithm","pricingVersion","ruleVersion","lines","doses","drugFee","consultationFee","total","checks","recordId","recordVersion","draftHash"],"title":"PricingSnapshot","type":"object"},"RecordView":{"properties":{"resourceType":{"const":"record","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"recordId":{"title":"Recordid","type":"string"},"visitId":{"title":"Visitid","type":"string"},"patientId":{"title":"Patientid","type":"string"},"doctorId":{"title":"Doctorid","type":"integer"},"visitType":{"enum":["first","followup"],"title":"Visittype","type":"string"},"status":{"enum":["draft","submitted","voided"],"title":"Status","type":"string"},"version":{"title":"Version","type":"integer"},"draft":{"$ref":"#/components/schemas/RecordDraft"},"pricingStatus":{"enum":["notPriced","locked","unavailable"],"title":"Pricingstatus","type":"string"},"pricing":{"anyOf":[{"$ref":"#/components/schemas/PricingSnapshot"},{"type":"null"}],"default":null},"createdAt":{"title":"Createdat","type":"string"},"updatedAt":{"title":"Updatedat","type":"string"}},"required":["resourceType","id","recordId","visitId","patientId","doctorId","visitType","status","version","draft","pricingStatus","createdAt","updatedAt"],"title":"RecordView","type":"object"},"HerbView":{"properties":{"resourceType":{"const":"herb","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"name":{"title":"Name","type":"string"},"unit":{"const":"g","title":"Unit","type":"string"},"unitPrice":{"title":"Unitprice","type":"string"},"toxicity":{"title":"Toxicity","type":"string"},"taboo":{"title":"Taboo","type":"string"},"reviewed":{"title":"Reviewed","type":"boolean"},"reviewNote":{"title":"Reviewnote","type":"string"},"active":{"title":"Active","type":"boolean"},"version":{"title":"Version","type":"integer"}},"required":["resourceType","id","name","unit","unitPrice","toxicity","taboo","reviewed","reviewNote","active","version"],"title":"HerbView","type":"object"},"HerbPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/HerbView"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["items","total","page","size"],"title":"HerbPage","type":"object"},"PricingView":{"properties":{"resourceType":{"const":"pricing","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"configured":{"title":"Configured","type":"boolean"},"consultationFee":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consultationfee"},"version":{"title":"Version","type":"integer"}},"required":["resourceType","id","configured","consultationFee","version"],"title":"PricingView","type":"object"},"CheckedPrescription":{"properties":{"blockedPairs":{"items":{"$ref":"#/components/schemas/CheckItem"},"title":"Blockedpairs","type":"array"},"warnings":{"items":{"$ref":"#/components/schemas/CheckItem"},"title":"Warnings","type":"array"},"passed":{"title":"Passed","type":"boolean"},"doseLimitsValidated":{"const":false,"title":"Doselimitsvalidated","type":"boolean"},"recordId":{"title":"Recordid","type":"string"},"recordVersion":{"title":"Recordversion","type":"integer"},"ruleVersion":{"title":"Ruleversion","type":"string"}},"required":["blockedPairs","warnings","passed","doseLimitsValidated","recordId","recordVersion","ruleVersion"],"title":"CheckedPrescription","type":"object"},"QuoteView":{"properties":{"pricingAlgorithm":{"title":"Pricingalgorithm","type":"string"},"pricingVersion":{"title":"Pricingversion","type":"integer"},"ruleVersion":{"title":"Ruleversion","type":"string"},"lines":{"items":{"$ref":"#/components/schemas/PricedLine"},"title":"Lines","type":"array"},"doses":{"title":"Doses","type":"integer"},"drugFee":{"title":"Drugfee","type":"string"},"consultationFee":{"title":"Consultationfee","type":"string"},"total":{"title":"Total","type":"string"},"checks":{"$ref":"#/components/schemas/PrescriptionChecks"},"recordId":{"title":"Recordid","type":"string"},"recordVersion":{"title":"Recordversion","type":"integer"},"draftHash":{"title":"Drafthash","type":"string"},"resourceType":{"const":"quote","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"quoteId":{"title":"Quoteid","type":"string"},"expiresAt":{"title":"Expiresat","type":"string"}},"required":["pricingAlgorithm","pricingVersion","ruleVersion","lines","doses","drugFee","consultationFee","total","checks","recordId","recordVersion","draftHash","resourceType","id","quoteId","expiresAt"],"title":"QuoteView","type":"object"},"ChargeRow":{"properties":{"resourceType":{"const":"charge","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"recordId":{"title":"Recordid","type":"string"},"amount":{"title":"Amount","type":"string"},"tendered":{"title":"Tendered","type":"string"},"change":{"title":"Change","type":"string"},"method":{"enum":["cash","wechatOffline","alipayOffline"],"title":"Method","type":"string"},"externalReference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Externalreference"},"actorId":{"title":"Actorid","type":"integer"},"createdAt":{"title":"Createdat","type":"string"}},"required":["resourceType","id","recordId","amount","tendered","change","method","externalReference","actorId","createdAt"],"title":"ChargeRow","type":"object"},"RecordCharges":{"properties":{"recordId":{"title":"Recordid","type":"string"},"originalReceivable":{"title":"Originalreceivable","type":"string"},"credited":{"title":"Credited","type":"string"},"adjustedReceivable":{"title":"Adjustedreceivable","type":"string"},"receivedGross":{"title":"Receivedgross","type":"string"},"chargeCount":{"title":"Chargecount","type":"integer"},"refunded":{"title":"Refunded","type":"string"},"receivedNet":{"title":"Receivednet","type":"string"},"refundReserved":{"title":"Refundreserved","type":"string"},"availableRefund":{"title":"Availablerefund","type":"string"},"outstanding":{"title":"Outstanding","type":"string"},"collectionStatus":{"enum":["unpaid","partiallyPaid","paid"],"title":"Collectionstatus","type":"string"},"version":{"title":"Version","type":"integer"},"recordVersion":{"title":"Recordversion","type":"integer"},"charges":{"items":{"$ref":"#/components/schemas/ChargeRow"},"title":"Charges","type":"array"},"chargesTruncated":{"title":"Chargestruncated","type":"boolean"}},"required":["recordId","originalReceivable","credited","adjustedReceivable","receivedGross","chargeCount","refunded","receivedNet","refundReserved","availableRefund","outstanding","collectionStatus","version","recordVersion","charges","chargesTruncated"],"title":"RecordCharges","type":"object"},"FinanceSummary":{"properties":{"recordId":{"title":"Recordid","type":"string"},"originalReceivable":{"title":"Originalreceivable","type":"string"},"credited":{"title":"Credited","type":"string"},"adjustedReceivable":{"title":"Adjustedreceivable","type":"string"},"receivedGross":{"title":"Receivedgross","type":"string"},"chargeCount":{"title":"Chargecount","type":"integer"},"refunded":{"title":"Refunded","type":"string"},"receivedNet":{"title":"Receivednet","type":"string"},"refundReserved":{"title":"Refundreserved","type":"string"},"availableRefund":{"title":"Availablerefund","type":"string"},"outstanding":{"title":"Outstanding","type":"string"},"collectionStatus":{"enum":["unpaid","partiallyPaid","paid"],"title":"Collectionstatus","type":"string"},"version":{"title":"Version","type":"integer"}},"required":["recordId","originalReceivable","credited","adjustedReceivable","receivedGross","chargeCount","refunded","receivedNet","refundReserved","availableRefund","outstanding","collectionStatus","version"],"title":"FinanceSummary","type":"object"},"ChargeView":{"properties":{"resourceType":{"const":"charge","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"recordId":{"title":"Recordid","type":"string"},"amount":{"title":"Amount","type":"string"},"tendered":{"title":"Tendered","type":"string"},"change":{"title":"Change","type":"string"},"method":{"enum":["cash","wechatOffline","alipayOffline"],"title":"Method","type":"string"},"externalReference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Externalreference"},"actorId":{"title":"Actorid","type":"integer"},"createdAt":{"title":"Createdat","type":"string"},"finance":{"$ref":"#/components/schemas/FinanceSummary"},"availableRefund":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Availablerefund"}},"required":["resourceType","id","recordId","amount","tendered","change","method","externalReference","actorId","createdAt","finance"],"title":"ChargeView","type":"object"},"DebtPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FinanceSummary"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["items","total","page","size"],"title":"DebtPage","type":"object"},"RefundView":{"properties":{"resourceType":{"const":"refund","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"recordId":{"title":"Recordid","type":"string"},"chargeId":{"title":"Chargeid","type":"string"},"amount":{"title":"Amount","type":"string"},"reason":{"title":"Reason","type":"string"},"status":{"enum":["pending","approved","rejected","completed"],"title":"Status","type":"string"},"version":{"title":"Version","type":"integer"},"requestedBy":{"title":"Requestedby","type":"integer"},"reviewedBy":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reviewedby"},"reviewNote":{"title":"Reviewnote","type":"string"},"completedBy":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completedby"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"},"externalReference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Externalreference"},"completionNote":{"title":"Completionnote","type":"string"},"createdAt":{"title":"Createdat","type":"string"},"reviewedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewedat"},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completedat"},"finance":{"$ref":"#/components/schemas/FinanceSummary"}},"required":["resourceType","id","recordId","chargeId","amount","reason","status","version","requestedBy","reviewedBy","reviewNote","completedBy","method","externalReference","completionNote","createdAt","reviewedAt","completedAt","finance"],"title":"RefundView","type":"object"},"RefundRow":{"properties":{"resourceType":{"const":"refund","title":"Resourcetype","type":"string"},"id":{"title":"Id","type":"string"},"recordId":{"title":"Recordid","type":"string"},"chargeId":{"title":"Chargeid","type":"string"},"amount":{"title":"Amount","type":"string"},"reason":{"title":"Reason","type":"string"},"status":{"enum":["pending","approved","rejected","completed"],"title":"Status","type":"string"},"version":{"title":"Version","type":"integer"},"requestedBy":{"title":"Requestedby","type":"integer"},"reviewedBy":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reviewedby"},"reviewNote":{"title":"Reviewnote","type":"string"},"completedBy":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completedby"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"},"externalReference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Externalreference"},"completionNote":{"title":"Completionnote","type":"string"},"createdAt":{"title":"Createdat","type":"string"},"reviewedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewedat"},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completedat"}},"required":["resourceType","id","recordId","chargeId","amount","reason","status","version","requestedBy","reviewedBy","reviewNote","completedBy","method","externalReference","completionNote","createdAt","reviewedAt","completedAt"],"title":"RefundRow","type":"object"},"RefundPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RefundRow"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["items","total","page","size"],"title":"RefundPage","type":"object"},"PhotoSlot":{"properties":{"slot":{"title":"Slot","type":"integer"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha256"}},"required":["slot","url","sha256"],"title":"PhotoSlot","type":"object"},"PhotoSlots":{"properties":{"id":{"title":"Id","type":"string"},"patientId":{"title":"Patientid","type":"string"},"resourceType":{"title":"Resourcetype","type":"string"},"version":{"title":"Version","type":"integer"},"photos":{"items":{"$ref":"#/components/schemas/PhotoSlot"},"title":"Photos","type":"array"}},"required":["id","patientId","resourceType","version","photos"],"title":"PhotoSlots","type":"object"},"ReportView":{"properties":{"kind":{"title":"Kind","type":"string"},"start":{"title":"Start","type":"string"},"end":{"title":"End","type":"string"},"timezone":{"title":"Timezone","type":"string"},"basis":{"title":"Basis","type":"string"},"items":{"items":{"additionalProperties":true,"type":"object"},"title":"Items","type":"array"},"total":{"title":"Total","type":"integer"},"page":{"title":"Page","type":"integer"},"size":{"title":"Size","type":"integer"}},"required":["kind","start","end","timezone","basis","items","total","page","size"],"title":"ReportView","type":"object"}},"securitySchemes":{"DoctorBearer":{"type":"http","scheme":"bearer","bearerFormat":"Opaque access token","description":"仅填写登录返回的accessToken，Swagger自动添加Bearer前缀。不会保存在浏览器持久存储。"},"TcmServiceKey":{"type":"apiKey","in":"header","name":"X-Tcm-Api-Key","description":"独立服务间密钥，不使用医生密码，不分发给桌面客户端。"}}},"tags":[{"name":"01 账号认证","description":"注册和登录不会自动加入诊所。令牌为随机不透明字符串，不是JWT。"},{"name":"02 租户与患者","description":"一个租户对应一家诊所。平台指定管理员；医生仅可访问本人登记或接诊患者。"},{"name":"03 就诊与病历","description":"临床记录与财务状态独立。草稿不计价、不扣库存；正式提交锁定报价和校验快照。"},{"name":"04 药品与处方","description":"目录和诊金仅管理员维护。计价使用Decimal；配伍规则来自固定桌面源码，剂量上限需医生复核。"},{"name":"05 收款与欠费","description":"登记实际发生的线下收款，不发起支付。财务ETag与病历ETag不同。"},{"name":"06 退费审批","description":"申请人不得自审。批准不等于退款；实际退款完成才等额核减应收，不操作库存。"},{"name":"07 运气服务","description":"新版三层上下文仅供服务间调用，使用独立密钥；不能将密钥写入桌面客户端。"},{"name":"08 旧版兼容","description":"保留已有调用格式；兼容认证可能以HTTP200和业务code表示错误。"},{"name":"09 健康检查","description":"当前健康检查仅证明HTTP进程可响应，不探测数据库读写。"},{"name":"10 临床字典","description":"诊所共享病证、辨证、诊断、穴位、医案；普通医生查询，管理员维护。不会自动导入未经核验的医学资料。"},{"name":"11 方剂模板","description":"经验、辨病、经典三类模板。选用模板后仍需保存病历、服务端校验和报价；模板本身不计价、不扣库存。"},{"name":"12 药物用法","description":"诊所共享的用法、煎法选项；管理员维护，医生读取。"},{"name":"13 医生资料","description":"本人资料与当前诊所权限。诊所名称来自平台租户、诊金来自计价设置，不能通过个人资料修改。"},{"name":"14 患者照片","description":"每位患者最多4个槽位；所有上传、查看和删除均校验患者权限。使用受保护接口，不提供公开图片地址。"},{"name":"15 业务报表","description":"基于已落库业务聚合，仅诊所管理员可查看全诊所报表。利润和PDF/XLSX导出暂未接入。"},{"name":"16 库存与发药","description":"提交处方不预占库存，实际发药时扣减；单纯退费不回库，实际退药验收才回库。"},{"name":"17 供应商","description":"诊所供应商目录，管理员维护。"}],"servers":[{"url":"/","description":"当前访问的服务入口"}]}