Compare commits

..

3 Commits

Author SHA1 Message Date
liuyun
4e481dad5f fix(c4): 异常处理 handle_status 统一 handling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-15 01:51:36 +08:00
liuyun
07f528428c feat(c4): 异常处理台处理/关闭接线
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-15 01:50:44 +08:00
liuyun
44386e90ae feat(c4): 质控中心页
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-15 01:46:16 +08:00
2 changed files with 1089 additions and 55 deletions

166
src/api/qc.ts Normal file
View File

@ -0,0 +1,166 @@
import { http } from '@/api/http'
import type { RecordAbnormal } from '@/api/abnormal'
import type { Elder } from '@/api/elder'
import type { Order } from '@/api/order'
import type { ChangePlanData, Plan } from '@/api/plan'
import type { ServiceRecordDetail } from '@/api/record'
/**
* 质控闸门(qc / ho_record_correction)API。
* 字段锚点见 shared/data-model spec(qc / ho_record_correction)。
* - 时间字段(qcTime/passTime/correctedAt/createdAt/updatedAt)后端经 TransformInterceptor 序列化为毫秒时间戳;
* - 待放行队列项含 record 摘要 + correctionCount + focus(补正≥3)+ waitMinutes(已等待分钟数)。
*/
/** 质控结果(qc_result)。 */
export const QC_RESULTS = ['pending', 'passed', 'returned'] as const
/** 质控类型(qc_type)。 */
export const QC_TYPES = ['normal', 'recheck'] as const
export const QC_RESULT_TAG_MAP: Record<string, { label: string; type: 'success' | 'info' | 'warning' | 'danger' | 'primary' }> = {
pending: { label: '待质控', type: 'warning' },
passed: { label: '已放行', type: 'success' },
returned: { label: '已退回', type: 'danger' },
}
/** 质控记录(qc)。 */
export interface QcRecord {
id: string
tenantCode: string
recordId: string
qcType: string
qcResult: string
qcNote: string | null
qcStaffId: string | null
qcTime: number | null
passTime: number | null
firstQcId: string | null
createdAt: number
createdBy: string | null
updatedAt: number
deletedAt: number | null
}
/** 待放行队列项的留痕摘要。 */
export interface PendingQcRecordSummary {
id: string
elderId: string
assigneeId: string
checkinTime: number | null
recordStatus: string
}
/** 待放行队列项:qc + 留痕摘要 + 补正计数/质控重点/已等待。 */
export interface PendingQcItem extends QcRecord {
record: PendingQcRecordSummary | null
correctionCount: number
focus: boolean
waitMinutes: number
}
/** 单类待办计数 + 消除条件。 */
export interface CountWithCondition {
count: number
clearCondition: string
}
/** 住院仍有派单:老人 + 活跃工单。 */
export interface HospActiveItem {
elder: Elder
order: Order
}
/** 五类主动推送聚合结果。 */
export interface PendingListResult {
abnormalOpen: CountWithCondition
overdue: CountWithCondition & { list: Order[] }
hospActive: CountWithCondition & { list: HospActiveItem[] }
missingPlan: CountWithCondition & { list: Elder[] }
pendingQc: CountWithCondition & { list: PendingQcItem[] }
}
/** 补正说明(ho_record_correction)。 */
export interface QcCorrection {
id: string
tenantCode: string
recordId: string
qcId: string | null
correctionNote: string
correctedBy: string
correctedAt: number
}
/** 质控详情:qc + 关联留痕全文 + 补正历史。 */
export interface QcDetail extends QcRecord {
record: ServiceRecordDetail
corrections: QcCorrection[]
}
/** 退回入参(qc_note 必填)。 */
export interface ReturnQcData {
qcNote: string
}
/** 补正入参。 */
export interface CorrectData {
recordId: string
correctionNote: string
}
/** 批量放行入参。 */
export interface BatchPassData {
recordIds: string[]
}
/** 异常处理入参(处理结果 + 选填处理意见)。 */
export interface HandleAbnormalData {
/** handling(处理中)/ closed(已关闭)。 */
handleStatus: string
handleResult?: string
}
/** 异常联动改计划入参:复用 plan.change 字段 + abnormalId。 */
export interface ExceptionLinkData extends ChangePlanData {
abnormalId: string
}
/** 五类待办聚合。 */
export function pendingList(signal?: AbortSignal): Promise<PendingListResult> {
return http.get<PendingListResult>('/qc/pending/list', { signal })
}
/** 质控详情(留痕全文/项目/照片/异常/定位/补正历史)。 */
export function getQcDetail(id: string): Promise<QcDetail> {
return http.get<QcDetail>(`/qc/${id}`)
}
/** 放行(后端自检 1004/3001/4001,错误 ApiError.message 直接显示)。 */
export function passQc(id: string): Promise<QcRecord> {
return http.post<QcRecord>(`/qc/${id}/pass`)
}
/** 退回(qc_note 必填)。 */
export function returnQc(id: string, data: ReturnQcData): Promise<QcRecord> {
return http.post<QcRecord>(`/qc/${id}/return`, data)
}
/** 批量放行(后端拦不可批量项)。 */
export function batchPassQc(data: BatchPassData): Promise<{ passed: number }> {
return http.post<{ passed: number }>('/qc/batch-pass', data)
}
/** 异常联动改计划(复用 plan.change + 回填 link_plan_change)。 */
export function exceptionLink(data: ExceptionLinkData): Promise<Plan> {
return http.post<Plan>('/qc/exception/link', data)
}
/** 补正(写更正说明 + 生成 recheck qc)。 */
export function correctQc(data: CorrectData): Promise<QcRecord> {
return http.post<QcRecord>('/qc/correct', data)
}
/** 异常处理/关闭(写 handle_status + 处理意见)。 */
export function handleAbnormal(id: string, data: HandleAbnormalData): Promise<RecordAbnormal> {
return http.post<RecordAbnormal>(`/qc/abnormal/${id}/handle`, data)
}

File diff suppressed because it is too large Load Diff