初始化提交

This commit is contained in:
2023-02-17 17:10:16 +08:00
commit 4ca844f470
152 changed files with 20390 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Container\ContainerInterface;
abstract class AbstractController
{
#[Inject]
protected ContainerInterface $container;
#[Inject]
protected RequestInterface $request;
#[Inject]
protected ResponseInterface $response;
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace App\Controller;
use App\Request\AreaRequest;
use App\Services\AreaService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
class AreaController extends AbstractController
{
/**
* 获取省份信息
* @return ResponseInterface
*/
public function getProvince(): ResponseInterface
{
$areaService = new AreaService();
$data = $areaService->getProvince();
return $this->response->json($data);
}
/**
* 获取城市信息
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getCity(): ResponseInterface
{
$request = $this->container->get(AreaRequest::class);
$request->scene('getCity')->validateResolved();
$areaService = new AreaService();
$data = $areaService->getCity();
return $this->response->json($data);
}
/**
* 获取区县信息
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getCounty(): ResponseInterface
{
$request = $this->container->get(AreaRequest::class);
$request->scene('getCounty')->validateResolved();
$areaService = new AreaService();
$data = $areaService->getCounty();
return $this->response->json($data);
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Controller;
use App\Request\BasicDataRequest;
use App\Services\BasicDataService;
use App\Services\SafeService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 基础数据
*/
class BasicDataController extends AbstractController
{
/**
* 获取医院数据
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getHospital(): ResponseInterface
{
$request = $this->container->get(BasicDataRequest::class);
$request->scene('getHospital')->validateResolved();
$BasicDataService = new BasicDataService();
$data = $BasicDataService->getHospital();
return $this->response->json($data);
}
/**
* 获取自定义科室数据
* @return ResponseInterface
*/
public function getCustomDepartment(): ResponseInterface
{
$BasicDataService = new BasicDataService();
$data = $BasicDataService->getCustomDepartment();
return $this->response->json($data);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Controller;
use App\Request\CodeRequest;
use App\Services\CodeService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
class CodeController extends AbstractController
{
/**
* 获取手机号验证码
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getPhoneCode(): ResponseInterface
{
$request = $this->container->get(CodeRequest::class);
$request->scene('getPhoneCode')->validateResolved();
$CodeService = new CodeService();
$data = fail();
$scene = $this->request->input('scene');
switch ($scene) {
case 1:
// 登陆
$data = $CodeService->getLoginPhoneCode();
break;
default:
// code...
break;
}
return $this->response->json($data);
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Controller;
use App\Request\DiseaseRequest;
use App\Services\DiseaseService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
class DiseaseController extends AbstractController
{
/**
* 专长列表
* @return ResponseInterface
*/
public function getDiseaseExpertiseList(): ResponseInterface
{
$DiseaseService = new DiseaseService();
$data = $DiseaseService->getDiseaseExpertiseList();
return $this->response->json($data);
}
/**
* 搜索疾病分类
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getDiseaseSearch(): ResponseInterface
{
$request = $this->container->get(DiseaseRequest::class);
$request->scene('getDiseaseSearch')->validateResolved();
$DiseaseService = new DiseaseService();
$data = $DiseaseService->getDiseaseSearch();
return $this->response->json($data);
}
/**
* 获取常见疾病分类
* @return ResponseInterface
*/
public function getDiseaseHot(): ResponseInterface
{
$DiseaseService = new DiseaseService();
$data = $DiseaseService->getDiseaseHot();
return $this->response->json($data);
}
}
+98
View File
@@ -0,0 +1,98 @@
<?php
namespace App\Controller;
use App\Request\DoctorAuthRequest;
use App\Request\PatientFamilyRequest;
use App\Services\DoctorAuthService;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 医生认证
*/
class DoctorAuthController extends AbstractController
{
/**
* 获取实名认证信息
* @return ResponseInterface
*/
public function getAuthReal(): ResponseInterface
{
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->getAuthReal();
return $this->response->json($data);
}
/**
* 新增实名认证
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface|GuzzleException
*/
public function addAuthReal(): ResponseInterface
{
$request = $this->container->get(DoctorAuthRequest::class);
$request->scene('addAuthReal')->validateResolved();
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->addAuthReal();
return $this->response->json($data);
}
/**
* 获取身份认证信息
* @return ResponseInterface
*/
public function getAuthIden(): ResponseInterface
{
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->getAuthIden();
return $this->response->json($data);
}
/**
* 新增身份认证信息
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface|GuzzleException
*/
public function addAuthIden(): ResponseInterface
{
$request = $this->container->get(DoctorAuthRequest::class);
$request->scene('addAuthIden')->validateResolved();
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->addAuthIden();
return $this->response->json($data);
}
/**
* 获取多点执业认证信息
* @return ResponseInterface
*/
public function getAuthMulti(): ResponseInterface
{
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->getAuthMulti();
return $this->response->json($data);
}
/**
* 新增多点执业认证信息
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface|GuzzleException
*/
public function addAuthMulti(): ResponseInterface
{
$request = $this->container->get(DoctorAuthRequest::class);
$request->scene('addAuthMulti')->validateResolved();
$DoctorAuthService = new DoctorAuthService();
$data = $DoctorAuthService->addAuthMulti();
return $this->response->json($data);
}
}
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Controller;
use App\Model\Area;
use App\Model\Hospital;
use App\Model\TbHospitalMy;
use App\Services\IndexService;
use App\Utils\Prescription;
use Hyperf\DbConnection\Db;
use Hyperf\Snowflake\IdGeneratorInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 首页
*/
class IndexController extends AbstractController
{
/**
* 医生端-首页
* @return ResponseInterface
*/
public function doctorIndex(): ResponseInterface
{
$IndexService = new IndexService();
$data = $IndexService->getDoctorIndex();
return $this->response->json($data);
}
/**
* 患者端-首页
* @return ResponseInterface
*/
public function patientIndex(): ResponseInterface
{
$IndexService = new IndexService();
$data = $IndexService->getPatientIndex();
return $this->response->json($data);
}
/**
* 医师端-首页
* @return ResponseInterface
*/
public function pharmacistIndex(): ResponseInterface
{
$IndexService = new IndexService();
$data = $IndexService->getPharmacistIndex();
return $this->response->json($data);
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Controller;
use App\Request\LoginRequest;
use App\Services\LoginService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 登陆
*/
class LoginController extends AbstractController
{
/**
* 微信手机号登陆
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function wechatMobileLogin(): ResponseInterface
{
// 验证参数
$request = $this->container->get(LoginRequest::class);
$request->scene('wechatMobileLogin')->validateResolved();
$LoginService = new LoginService();
$data = $LoginService->wechatMobileLogin();
return $this->response->json($data);
}
// 手机号登陆
public function mobileLogin(): ResponseInterface
{
// 验证参数
$request = $this->container->get(LoginRequest::class);
$request->scene('mobileLogin')->validateResolved();
$LoginService = new LoginService();
$data = $LoginService->mobileLogin();
return $this->response->json($data);
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Controller;
use App\Constants\HttpEnumCode;
use App\Request\OrderInquiryRequest;
use App\Request\PublicRequest;
use App\Services\OrderInquiryService;
use App\Services\PublicService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 问诊订单
*/
class OrderInquiryController extends AbstractController
{
#[Inject]
protected ValidatorFactoryInterface $validationFactory;
/**
* 创建问诊订单
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function addInquiryOrder(): ResponseInterface
{
$request = $this->container->get(OrderInquiryRequest::class);
$request->scene('addInquiryOrder')->validateResolved();
$OrderInquiryService = new OrderInquiryService();
$data = $OrderInquiryService->addInquiryOrder();
return $this->response->json($data);
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Controller;
use App\Services\PatientCaseService;
use Psr\Http\Message\ResponseInterface;
/**
* 病例
*/
class PatientCaseController extends AbstractController
{
/**
* 获取患者最后一份问诊病例
* @return ResponseInterface
*/
public function getLastCase(): ResponseInterface
{
$PatientCaseService = new PatientCaseService();
$data = $PatientCaseService->getLastCase();
return $this->response->json($data);
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Controller;
use App\Services\MyDoctorService;
use Psr\Http\Message\ResponseInterface;
/**
* 患者端个人中心
*/
class PatientCenterController extends AbstractController
{
/**
* 删除我的医生
* 首页-个人中心
* @return ResponseInterface
*/
public function deleteMyDoctor(): ResponseInterface
{
$patientFamilyService = new MyDoctorService();
$data = $patientFamilyService->deleteMyDoctor();
return $this->response->json($data);
}
}
@@ -0,0 +1,66 @@
<?php
namespace App\Controller;
use App\Request\PatientDoctorRequest;
use App\Services\PatientDoctorService;
use App\Services\UserDoctorService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
* 患者端医生数据
*/
class PatientDoctorController extends AbstractController
{
/**
* 获取问诊医生列表
* 专家问诊-公益问诊共用
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getInquiryDoctorList(): ResponseInterface
{
$request = $this->container->get(PatientDoctorRequest::class);
$request->scene('getInquiryDoctorList')->validateResolved();
$PatientDoctorService = new PatientDoctorService();
$data = $PatientDoctorService->getInquiryDoctorList();
return $this->response->json($data);
}
/**
* 获取问诊医生详情
* @return ResponseInterface
*/
public function getInquiryDoctorInfo(): ResponseInterface
{
$PatientDoctorService = new PatientDoctorService();
$data = $PatientDoctorService->getInquiryDoctorInfo();
return $this->response->json($data);
}
/**
* 获取医生评价
* @return ResponseInterface
*/
public function getDoctorEvaluationList(): ResponseInterface
{
$PatientDoctorService = new PatientDoctorService();
$data = $PatientDoctorService->getDoctorEvaluationList();
return $this->response->json($data);
}
/**
* 医生详情简介-详情中的简介
* @return ResponseInterface
*/
public function getDoctorProfile(): ResponseInterface
{
$PatientDoctorService = new PatientDoctorService();
$data = $PatientDoctorService->getDoctorProfile();
return $this->response->json($data);
}
}
@@ -0,0 +1,82 @@
<?php
namespace App\Controller;
use App\Constants\HttpEnumCode;
use App\Request\PatientFamilyRequest;
use App\Services\PatientFamilyService;
use Hyperf\Validation\Contract\ValidatorFactoryInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
use Hyperf\Di\Annotation\Inject;
/**
* 家庭成员
*/
class PatientFamilyController extends AbstractController
{
#[Inject]
protected ValidatorFactoryInterface $validationFactory;
/**
* 获取家庭成员列表
* @return ResponseInterface
*/
public function getFamilyList(): ResponseInterface
{
$patientFamilyService = new PatientFamilyService();
$data = $patientFamilyService->getFamilyList();
return $this->response->json($data);
}
/**
* 新增家庭成员
* @return array|ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function addFamily(): array|ResponseInterface
{
$request = $this->container->get(PatientFamilyRequest::class);
$request->scene('addFamily')->validateResolved();
// 检测入参身份证号
$res = $this->checkRequestIdCard();
if (!empty($res)) {
return fail(HttpEnumCode::HTTP_ERROR, $res);
}
$patientFamilyService = new PatientFamilyService();
$data = $patientFamilyService->addFamily();
return $this->response->json($data);
}
/**
* 检测入参身份证号
* @return string
*/
private function checkRequestIdCard(): string
{
$messages = [
'id_number.regex' => '证件号错误',
];
$validator = $this->validationFactory->make($this->request->all(), [
'type' => 'required',
], $messages);
$validator->sometimes(
['id_number'],
['regex:/^(?:1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5])\d{4}(?:1[89]|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dxX]$/'],
function ($input) {
return $input->type == 1;
}
);
if ($validator->fails()) {
return $validator->errors()->first();
}
return "";
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Controller;
use App\Request\SafeRequest;
use App\Services\SafeService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
class SafeController extends AbstractController
{
/**
* 获取oss签名数据
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getOssSign(): ResponseInterface
{
$request = $this->container->get(SafeRequest::class);
$request->scene('getOssSign')->validateResolved();
$SafeService = new SafeService();
$data = $SafeService->getOssSign();
return $this->response->json($data);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Controller;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Request\UserRequest;
use App\Services\UserService;
use App\Utils\Http;
use Psr\Http\Message\ResponseInterface;
class UserController extends AbstractController
{
}
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace App\Controller;
use App\Request\DoctorAuthRequest;
use App\Request\UserDoctorRequest;
use App\Services\DoctorAuthService;
use App\Services\DoctorInquiryService;
use App\Services\UserDoctorService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseInterface;
class UserDoctorController extends AbstractController
{
/**
* 获取医生专长列表
* 身份认证
* @return ResponseInterface
*/
public function getAuthDoctorExpertise(): ResponseInterface
{
$UserDoctorService = new UserDoctorService();
$data = $UserDoctorService->getAuthDoctorExpertise();
return $this->response->json($data);
}
/**
* 获取医生问诊配置
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getInquiryConfig(): ResponseInterface
{
$request = $this->container->get(UserDoctorRequest::class);
$request->scene('getInquiryConfig')->validateResolved();
$DoctorInquiryService = new DoctorInquiryService();
$data = $DoctorInquiryService->getInquiryConfig();
return $this->response->json($data);
}
/**
* 医生问诊开关
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function putInquiryOpen(): ResponseInterface
{
$request = $this->container->get(UserDoctorRequest::class);
$request->scene('putInquiryOpen')->validateResolved();
$DoctorInquiryService = new DoctorInquiryService();
$data = $DoctorInquiryService->putInquiryOpen();
return $this->response->json($data);
}
/**
* 修改医生问诊配置
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function putInquiryConfig(): ResponseInterface
{
$request = $this->container->get(UserDoctorRequest::class);
$request->scene('putInquiryConfig')->validateResolved();
$DoctorInquiryService = new DoctorInquiryService();
$data = $DoctorInquiryService->putInquiryConfig();
return $this->response->json($data);
}
}