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.
66 lines
2.0 KiB
66 lines
2.0 KiB
4 weeks ago
|
<?php
|
||
|
declare(strict_types = 1);
|
||
|
|
||
|
namespace App\Http\Controllers\Registration;
|
||
|
|
||
|
use App\Exceptions\GeneralException;
|
||
|
use App\Http\Logics\Registration\RecordLogic;
|
||
|
use App\Http\Logics\Registration\ScheduleLogic;
|
||
|
use App\Http\Resources\Registration\Record\RecordListsResource;
|
||
|
use App\Http\Resources\Registration\Schedule\DeptListsResource;
|
||
|
use App\Http\Resources\Registration\Schedule\DoctorListsResource;
|
||
|
use Illuminate\Http\JsonResponse;
|
||
|
use Illuminate\Http\Request;
|
||
|
use Symfony\Component\HttpFoundation\Response;
|
||
|
|
||
|
class RecordController
|
||
|
{
|
||
|
protected RecordLogic $record_logic;
|
||
|
|
||
|
/**
|
||
|
* Patient Construct.
|
||
|
*/
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->record_logic = new RecordLogic();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取挂号记录列表
|
||
|
* @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' => 'date_format:Y-m-d',
|
||
|
'end_date' => 'date_format:Y-m-d|after:start_date',
|
||
|
],['messages' => [
|
||
|
'start_date.date_format' => '日期格式错误',
|
||
|
'end_date.date_format' => '日期格式错误',
|
||
|
'end_date.after' => '查询日期错误',
|
||
|
]]);
|
||
|
|
||
|
$response = $this->record_logic->getRecordLists($patient_id, $validated['start_date'], $validated['end_date']);
|
||
|
|
||
|
return jsonResponse(Response::HTTP_OK, 'success', RecordListsResource::make($response)->toArray());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 退号
|
||
|
* @param Request $request
|
||
|
* @param string $patient_id
|
||
|
* @param string $serial_no
|
||
|
* @return JsonResponse
|
||
|
* @throws GeneralException
|
||
|
*/
|
||
|
public function refund(Request $request, string $patient_id, string $serial_no): JsonResponse
|
||
|
{
|
||
|
$this->record_logic->refundRegisterRecord($patient_id, $serial_no);
|
||
|
|
||
|
return jsonResponse(Response::HTTP_OK, 'refund success.');
|
||
|
}
|
||
|
}
|