|
|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\API\His\HisController;
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Services\Admin\YeWu\PlanListService;
|
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
@ -191,6 +192,45 @@ public function CancelApply ($orderNo)
|
|
|
|
|
Log::info('撤销推送申请单'.$orderNo);
|
|
|
|
|
$entrust = DB::table('s_list')->where(['entrust_id' => $orderNo])->first();
|
|
|
|
|
if ($entrust) {
|
|
|
|
|
// 医嘱作废:清理预约字段并释放号源
|
|
|
|
|
if ($entrust->is_nullify == 1 && $entrust->list_status != 0 && $entrust->roster_id) {
|
|
|
|
|
$rosterId = $entrust->roster_id;
|
|
|
|
|
$nowdatetime = date('Y-m-d H:i:s');
|
|
|
|
|
$clearData = [
|
|
|
|
|
'list_status' => 0,
|
|
|
|
|
'reservation_date' => null,
|
|
|
|
|
'reservation_time' => null,
|
|
|
|
|
'reservation_sources' => null,
|
|
|
|
|
'services_group' => null,
|
|
|
|
|
'roster_id' => null,
|
|
|
|
|
'xuhao' => null,
|
|
|
|
|
'department_id' => null,
|
|
|
|
|
'appointment_type_id' => null,
|
|
|
|
|
'appointment_use_plan_detail' => null,
|
|
|
|
|
'canel_time' => $nowdatetime,
|
|
|
|
|
'is_emergency' => 0,
|
|
|
|
|
'updated_at' => $nowdatetime,
|
|
|
|
|
];
|
|
|
|
|
try {
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
DB::table('s_list')->where('id', $entrust->id)->update($clearData);
|
|
|
|
|
$planService = new PlanListService();
|
|
|
|
|
$planService->correctUsedCount($rosterId);
|
|
|
|
|
DB::table('s_list_log')->insert([
|
|
|
|
|
'list_id' => $entrust->id,
|
|
|
|
|
'reg_num' => $entrust->reg_num,
|
|
|
|
|
'old_status' => $entrust->list_status,
|
|
|
|
|
'new_status' => 0,
|
|
|
|
|
'create_user' => 'MQ',
|
|
|
|
|
'note' => '医嘱作废',
|
|
|
|
|
'data' => json_encode($clearData, JSON_UNESCAPED_UNICODE),
|
|
|
|
|
]);
|
|
|
|
|
DB::commit();
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
Log::error('医嘱作废清理失败: ' . $e->getMessage(), ['entrust_id' => $orderNo]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$guid = Str::uuid()->toString();
|
|
|
|
|
$send_data = [
|
|
|
|
|
'Request' => [
|
|
|
|
|
|