香洲二院小程序
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.
mini_xzey/app/Http/Controllers/Outpatient/PendingController.php

65 lines
2.0 KiB

<?php
declare(strict_types = 1);
namespace App\Http\Controllers\Outpatient;
use App\Exceptions\GeneralException;
use App\Http\Logics\Outpatient\PendingLogic;
use App\Http\Resources\Outpatient\Pending\PendingDetailsResource;
use App\Http\Resources\Outpatient\Pending\PendingListsResource;
use App\Http\Resources\Outpatient\Record\RecordDetailsResource;
use App\Http\Resources\Outpatient\Record\RecordListsResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class PendingController
{
protected PendingLogic $pending_logic;
/**
* PendingController Construct.
*/
public function __construct()
{
$this->pending_logic = new PendingLogic();
}
/**
* 获取缴费记录列表
* @param Request $request
* @param string $patient_id
* @return JsonResponse
* @throws GeneralException
*/
public function lists(Request $request, string $patient_id): JsonResponse
{
$response = $this->pending_logic->getLists($patient_id);
return jsonResponse(Response::HTTP_OK, 'success', PendingListsResource::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
{
$validated = $request->validate([
'prescription_ids' => 'required',
'reg_id' => 'required',
], [
'prescription_ids.required' => '请选择要缴纳的处方',
'reg_id.required' => '请选择要缴纳的处方',
]);
$response = $this->pending_logic->getDetails($patient_id, $serial_no, $validated['prescription_ids'], $validated['reg_id']);
return jsonResponse(Response::HTTP_OK, 'success.', PendingDetailsResource::make($response)->toArray());
}
}