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.
48 lines
1.3 KiB
48 lines
1.3 KiB
2 weeks ago
|
<?php
|
||
|
declare(strict_types = 1);
|
||
|
|
||
|
namespace App\Http\Controllers\Outpatient;
|
||
|
|
||
|
use App\Exceptions\GeneralException;
|
||
|
use App\Http\Logics\Outpatient\PaymentLogic;
|
||
|
use App\Http\Resources\Outpatient\Pending\PendingListsResource;
|
||
|
use Illuminate\Http\JsonResponse;
|
||
|
use Illuminate\Http\Request;
|
||
|
use Symfony\Component\HttpFoundation\Response;
|
||
|
|
||
|
class PaymentController
|
||
|
{
|
||
|
protected PaymentLogic $payment_logic;
|
||
|
|
||
|
/**
|
||
|
* PaymentController Construct.
|
||
|
*/
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->payment_logic = new PaymentLogic();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 缴费
|
||
|
* @param Request $request
|
||
|
* @param string $patient_id
|
||
|
* @param string $serial_no
|
||
|
* @return JsonResponse
|
||
|
* @throws GeneralException
|
||
|
*/
|
||
|
public function payment(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->payment_logic->payment($patient_id, $serial_no, $validated['prescription_ids'], $validated['reg_id']);
|
||
|
|
||
|
return jsonResponse(Response::HTTP_OK, 'success', PendingListsResource::make($response)->toArray());
|
||
|
}
|
||
|
}
|