新增 获取检测项目用途列表 接口
This commit is contained in:
parent
33c7cb98c5
commit
b3d0576013
@ -13,14 +13,9 @@ class DetectionController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* 获取合作公司检测项目列表
|
* 获取合作公司检测项目列表
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function getDetectionProjectList(): ResponseInterface
|
public function getDetectionProjectList(): ResponseInterface
|
||||||
{
|
{
|
||||||
$request = $this->container->get(DetectionRequest::class);
|
|
||||||
$request->scene('getDetectionProjectList')->validateResolved();
|
|
||||||
|
|
||||||
$detectionService = new DetectionService();
|
$detectionService = new DetectionService();
|
||||||
$data = $detectionService->getDetectionProjectList();
|
$data = $detectionService->getDetectionProjectList();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
@ -40,13 +35,29 @@ class DetectionController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* 获取检测机构合作医生列表
|
* 获取检测机构合作医生列表
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
*/
|
||||||
public function getDetectionDoctorList(): ResponseInterface
|
public function getDetectionDoctorList(): ResponseInterface
|
||||||
{
|
{
|
||||||
|
$detectionService = new DetectionService();
|
||||||
|
$data = $detectionService->getDetectionDoctorList();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取检测项目用途列表
|
||||||
|
* @return ResponseInterface
|
||||||
|
*/
|
||||||
|
public function getDetectionProjectPurposeList(): ResponseInterface
|
||||||
|
{
|
||||||
|
$detectionService = new DetectionService();
|
||||||
|
$data = $detectionService->getDetectionProjectPurposeList();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建检测订单
|
||||||
|
public function addDetectionOrder(){
|
||||||
$request = $this->container->get(DetectionRequest::class);
|
$request = $this->container->get(DetectionRequest::class);
|
||||||
$request->scene('getDetectionDoctorList')->validateResolved();
|
$request->scene('addDetectionOrder')->validateResolved();
|
||||||
|
|
||||||
$detectionService = new DetectionService();
|
$detectionService = new DetectionService();
|
||||||
$data = $detectionService->getDetectionDoctorList();
|
$data = $detectionService->getDetectionDoctorList();
|
||||||
|
|||||||
74
app/Model/DetectionProjectPurpose.php
Normal file
74
app/Model/DetectionProjectPurpose.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $purpose_id 主键id
|
||||||
|
* @property int $detection_project_id 检测项目id
|
||||||
|
* @property string $purpose_name 用途名称
|
||||||
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
|
*/
|
||||||
|
class DetectionProjectPurpose extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*/
|
||||||
|
protected ?string $table = 'detection_project_purpose';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected array $fillable = ['purpose_id', 'detection_project_id', 'purpose_name', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
protected string $primaryKey = "purpose_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取信息-单条
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return object|null
|
||||||
|
*/
|
||||||
|
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||||
|
{
|
||||||
|
return self::where($params)->first($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据-多
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||||
|
{
|
||||||
|
return self::where($params)->get($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增-批量
|
||||||
|
* @param array $data 新增数据
|
||||||
|
* @return \Hyperf\Database\Model\Model|DetectionProjectPurpose
|
||||||
|
*/
|
||||||
|
public static function addDetectionProjectPurpose(array $data): \Hyperf\Database\Model\Model|DetectionProjectPurpose
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改-批量
|
||||||
|
* @param array $params
|
||||||
|
* @param array $data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function editDetectionProjectPurpose(array $params = [], array $data = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->update($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,11 +10,12 @@ use Hyperf\Validation\Request\FormRequest;
|
|||||||
class DetectionRequest extends FormRequest
|
class DetectionRequest extends FormRequest
|
||||||
{
|
{
|
||||||
protected array $scenes = [
|
protected array $scenes = [
|
||||||
'getDetectionProjectList' => [ // 获取合作公司检测项目列表
|
'addDetectionOrder' => [ // 创建检测订单
|
||||||
'company_id',
|
|
||||||
],
|
|
||||||
'getDetectionDoctorList' => [ // 获取检测机构合作医生列表
|
|
||||||
'company_id',
|
'company_id',
|
||||||
|
'patient_id',
|
||||||
|
'family_id',
|
||||||
|
'nation_id',
|
||||||
|
'detection_disease_class_ids',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -32,7 +33,6 @@ class DetectionRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'company_id' => 'required',
|
|
||||||
'detection_project_id' => 'required',
|
'detection_project_id' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ namespace App\Services;
|
|||||||
use App\Model\Area;
|
use App\Model\Area;
|
||||||
use App\Model\BasicCompany;
|
use App\Model\BasicCompany;
|
||||||
use App\Model\DetectionProject;
|
use App\Model\DetectionProject;
|
||||||
|
use App\Model\DetectionProjectPurpose;
|
||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
use App\Model\UserLocation;
|
use App\Model\UserLocation;
|
||||||
|
|
||||||
@ -237,4 +238,23 @@ class DetectionService extends BaseService
|
|||||||
|
|
||||||
return success($response_data);
|
return success($response_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取检测项目用途列表
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDetectionProjectPurposeList(): array
|
||||||
|
{
|
||||||
|
$detection_project_id = $this->request->input("detection_project_id",1);
|
||||||
|
|
||||||
|
// 获取项目数据
|
||||||
|
$params = array();
|
||||||
|
$params['detection_project_id'] = $detection_project_id;
|
||||||
|
$detection_project_purpose = DetectionProjectPurpose::getList($params);
|
||||||
|
if (empty($detection_project_purpose)){
|
||||||
|
return fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
return success($detection_project_purpose->toArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -269,16 +269,22 @@ Router::addGroup('/patient', function () {
|
|||||||
// 检测
|
// 检测
|
||||||
Router::addGroup('/detection', function () {
|
Router::addGroup('/detection', function () {
|
||||||
// 创建检测订单
|
// 创建检测订单
|
||||||
Router::post('', [InquiryController::class, 'addDetectionOrder']);
|
Router::post('', [DetectionController::class, 'addDetectionOrder']);
|
||||||
|
|
||||||
// 获取检测机构合作医生列表
|
// 获取检测机构合作医生列表
|
||||||
Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']);
|
Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']);
|
||||||
|
|
||||||
// 获取合作公司检测项目列表
|
// 检测项目
|
||||||
Router::get('/project', [DetectionController::class, 'getDetectionProjectList']);
|
Router::addGroup('/project', function () {
|
||||||
|
// 获取合作公司检测项目列表
|
||||||
|
Router::get('', [DetectionController::class, 'getDetectionProjectList']);
|
||||||
|
|
||||||
// 获取合作公司检测项目详情
|
// 获取合作公司检测项目详情
|
||||||
Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']);
|
Router::get('/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']);
|
||||||
|
|
||||||
|
// 获取检测项目用途列表
|
||||||
|
Router::get('/purpose', [DetectionController::class, 'getDetectionProjectPurposeList']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 医生数据
|
// 医生数据
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user