You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.1 KiB
68 lines
2.1 KiB
<?php
|
|
declare(strict_types = 1);
|
|
|
|
namespace App\Http\Controllers\Report;
|
|
|
|
use App\Exceptions\GeneralException;
|
|
use App\Http\Logics\Registration\RecordLogic;
|
|
use App\Http\Logics\Report\InspectLogic;
|
|
use App\Http\Resources\Report\Inspect\DetailsResource;
|
|
use App\Http\Resources\Report\Inspect\ListsResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
class InspectController
|
|
{
|
|
protected InspectLogic $inspect_logic;
|
|
|
|
/**
|
|
* InspectController Construct.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->inspect_logic = new InspectLogic();
|
|
}
|
|
|
|
/**
|
|
* 获取检查报告列表
|
|
* @param Request $request
|
|
* @param string $patient_id
|
|
* @return JsonResponse
|
|
* @throws GeneralException
|
|
*/
|
|
public function lists(Request $request, string $patient_id): JsonResponse
|
|
{
|
|
$validated = $request->validate([
|
|
'start_date' => 'required|date_format:Y-m-d',
|
|
'end_date' => 'required|date_format:Y-m-d|after:start_date',
|
|
], [
|
|
'start_date.required' => '请选择查询开始日期',
|
|
'end_date.required' => '请选择查询结束日期',
|
|
'start_date.date_format' => '日期格式错误',
|
|
'end_date.date_format' => '日期格式错误',
|
|
'end_date.after' => '查询日期错误',
|
|
]);
|
|
|
|
// 日期必须在3个月之内
|
|
|
|
$response = $this->inspect_logic->lists($patient_id, $validated['start_date'], $validated['end_date']);
|
|
|
|
return jsonResponse(Response::HTTP_OK, 'success', ListsResource::make($response)->toArray());
|
|
}
|
|
|
|
/**
|
|
* 获取缴费记录详情
|
|
* @param Request $request
|
|
* @param string $patient_id
|
|
* @param string $serial_no
|
|
* @return JsonResponse
|
|
* @throws GeneralException
|
|
*/
|
|
public function details(Request $request, string $patient_id, string $serial_no): JsonResponse
|
|
{
|
|
$response = $this->inspect_logic->details($patient_id, $serial_no);
|
|
|
|
return jsonResponse(Response::HTTP_OK, 'success.', DetailsResource::make($response)->toArray());
|
|
}
|
|
}
|
|
|