diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index c6ec407..2cd235c 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -1953,7 +1953,34 @@ private function notifyHisAfterYuYue($oldMainInfos, $planInfo) ]; try { - HisController::Post('/roc/api/v1/qhd/common/yjyy/updateExecDept', $body); + $hisRes = HisController::Post('/roc/api/v1/qhd/common/yjyy/updateExecDept', $body); + if ($hisRes['code'] == 200) { + // 记录变更前的旧值 + $oldDeptCode = $mainInfo->RISRAcceptDeptCode ?? ''; + $oldDeptName = $mainInfo->implement_department ?? ''; + + DB::table('s_list') + ->where('id', $mainInfo->id) + ->update([ + 'RISRAcceptDeptCode' => $execDeptCode, + 'implement_department' => $execDeptName, + ]); + + DB::table('s_list_log')->insert([ + 'list_id' => $mainInfo->id, + 'reg_num' => $mainInfo->reg_num, + 'old_status' => $mainInfo->list_status, + 'new_status' => $mainInfo->list_status, + 'create_user' => 'sys_auto', + 'note' => 'HIS回写更新执行科室', + 'data' => json_encode([ + 'old_RISRAcceptDeptCode' => $oldDeptCode, + 'new_RISRAcceptDeptCode' => $execDeptCode, + 'old_implement_department' => $oldDeptName, + 'new_implement_department' => $execDeptName, + ], JSON_UNESCAPED_UNICODE), + ]); + } } catch (\Exception $e) { Log::error('HIS 回写接口请求异常', [ 'body' => $body,