|
|
|
|
@ -187,16 +187,8 @@ class StatisticsController extends CommonController
|
|
|
|
|
DB::enableQueryLog();
|
|
|
|
|
//采用指定订单号
|
|
|
|
|
$model = OrderItems::whereHas("order", function ($query) {
|
|
|
|
|
$query->whereIn("serial", [
|
|
|
|
|
"20210910000003",
|
|
|
|
|
"20210914000006",
|
|
|
|
|
"20210826000004",
|
|
|
|
|
"20210909000022",
|
|
|
|
|
"20210903000007",
|
|
|
|
|
"20210918000013",
|
|
|
|
|
"20210906000015"
|
|
|
|
|
]);
|
|
|
|
|
})->where("service_date", ">=", "2021-09-01");
|
|
|
|
|
$query->whereIn("serial", ["20240101000016", "20240103000044", "20240103000055", "20240103000068", "20240104000010", "20240104000011", "20240104000012", "20240104000035", "20240104000040", "20240105000009", "20240105000042", "20240105000049", "20240105000051", "20240105000063", "20240105000064", "20231212000051", "20240104000023", "20240104000033", "20240104000036", "20240104000049", "20240104000059", "20240104000060", "20240105000043", "20240105000045", "20240105000048", "20240105000065", "20240105000066", "20240101000024", "20240104000007", "20240104000030", "20240104000034", "20240104000044", "20240104000065"]);
|
|
|
|
|
})->where("factors", "not like", "%所在科室%");
|
|
|
|
|
//采用指定订单号结束
|
|
|
|
|
|
|
|
|
|
if ($request->last_id) {
|
|
|
|
|
@ -211,17 +203,17 @@ class StatisticsController extends CommonController
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
foreach ($orderItems as $orderItem) {
|
|
|
|
|
$factors = json_decode($orderItem->factors);
|
|
|
|
|
foreach ($factors as $factor) {
|
|
|
|
|
$current_factor = FactorItems::find(3);
|
|
|
|
|
$factor->fee = $current_factor->fee;
|
|
|
|
|
$factor->fee_percent = $current_factor->fee_percent;
|
|
|
|
|
$factor->factor_name = $current_factor->name;
|
|
|
|
|
$factors = json_decode($orderItem->factors, true);
|
|
|
|
|
$parent_factors = json_decode($orderItem->order->factors, true);
|
|
|
|
|
|
|
|
|
|
if (!in_array("所在科室", collect($factors)->pluck("factor_name")->toArray())
|
|
|
|
|
&& in_array("所在科室", collect($parent_factors)->pluck("factor_name")->toArray())) {
|
|
|
|
|
$add = collect($parent_factors)->keyBy("factor_name")["所在科室"];
|
|
|
|
|
$factors[] = $add;
|
|
|
|
|
$orderItem->update([
|
|
|
|
|
"factors" => json_encode($factors, JSON_UNESCAPED_UNICODE)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$orderItem->update([
|
|
|
|
|
"factors" => json_encode($factors)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
DB::commit();
|
|
|
|
|
return $this->success("处理成功一批,正在跳转到下一批!", url($this->urlPrefix . "/salary/sync-order-items?month={$request->month}&last_id=" . $orderItems->last()->id));
|
|
|
|
|
|