香洲二院小程序
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/Logics/Registration/ScheduleLogic.php

61 lines
1.6 KiB

<?php
declare(strict_types = 1);
namespace App\Http\Logics\Registration;
use App\Exceptions\GeneralException;
use App\Services\HisHttp\Client;
use App\Utils\Traits\Logger;
use Symfony\Component\HttpFoundation\Response;
class ScheduleLogic
{
use Logger;
private Client $his_client;
/**
* PatientLogic Construct
*/
public function __construct()
{
$this->his_client = app('HisHttpService');
}
/**
* 获取科室列表
* @param string $date
* @return array
* @throws GeneralException
*/
public function getDeptLists(string $date): array
{
$response = $this->his_client->getDepType('', '','01', $date);
if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') {
throw new GeneralException($response['ERRORMSG'] ?? '暂无科室排班!', Response::HTTP_SERVICE_UNAVAILABLE);
}
return $response;
}
/**
* 获取医生列表
* @param string $date 日期
* @param string $dept_id 科室ID
* @return array
* @throws GeneralException
*/
public function getDoctorLists(string $date, string $dept_id): array
{
$type = $date === date('Y-m-d') ? '3' : '1';
$response = $this->his_client->getDoctorLists($dept_id, $type, '', $date);
if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') {
throw new GeneralException($response['ERRORMSG'] ?? '该科室暂无医生排班!', Response::HTTP_SERVICE_UNAVAILABLE);
}
return $response;
}
}