新增 获取检测疾病分类列表 接口
This commit is contained in:
parent
822756c39c
commit
174770cdb3
@ -204,4 +204,20 @@ class BasicDataController extends AbstractController
|
||||
$data = $BasicDataService->getHotSearchKeyword();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测疾病分类列表
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDetectionDiseaseList(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(BasicDataRequest::class);
|
||||
$request->scene('getDetectionDiseaseList')->validateResolved();
|
||||
|
||||
$BasicDataService = new BasicDataService();
|
||||
$data = $BasicDataService->getDetectionDiseaseList();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -27,10 +27,8 @@ class DetectionController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合作公司检测项目
|
||||
* 获取合作公司检测项目详情
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDetectionProject(): ResponseInterface
|
||||
{
|
||||
|
||||
77
app/Model/DiseaseClassDetection.php
Normal file
77
app/Model/DiseaseClassDetection.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
|
||||
/**
|
||||
* @property int $id 主键id
|
||||
* @property int $detection_project_id 检测项目id
|
||||
* @property string $name 疾病分类名称
|
||||
* @property int $status 状态(1:正常 2:删除)
|
||||
* @property int $enable 是否启用(1:是 2:否)
|
||||
* @property int $sort 排序值(越小排序越往前)
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DiseaseClassDetection extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'disease_class_detection';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['id', 'detection_project_id', 'name', 'status', 'enable', 'sort', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "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|DiseaseClassDetection
|
||||
*/
|
||||
public static function addDiseaseClassDetection(array $data): \Hyperf\Database\Model\Model|DiseaseClassDetection
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改-批量
|
||||
* @param array $params
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public static function editDiseaseClassDetection(array $params = [], array $data = []): int
|
||||
{
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
}
|
||||
@ -28,6 +28,9 @@ class BasicDataRequest extends FormRequest
|
||||
'client_type',
|
||||
'keyword_place',
|
||||
],
|
||||
'getDetectionDiseaseList' => [ // 获取检测疾病分类列表
|
||||
'detection_project_id',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -49,6 +52,7 @@ class BasicDataRequest extends FormRequest
|
||||
'disease_class_name' => 'required',
|
||||
'client_type' => 'required|integer|min:1|max:1',
|
||||
'keyword_place' => 'required|integer|min:1|max:1',
|
||||
'detection_project_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@ -69,6 +73,7 @@ class BasicDataRequest extends FormRequest
|
||||
'keyword_place.integer' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'keyword_place.min' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'keyword_place.max' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
'detection_project_id.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ use App\Model\BasicDoctorTitle;
|
||||
use App\Model\BasicJob;
|
||||
use App\Model\BasicNation;
|
||||
use App\Model\DiseaseClass;
|
||||
use App\Model\DiseaseClassDetection;
|
||||
use App\Model\DiseaseClassExpertise;
|
||||
use App\Model\DiseaseClassIcd;
|
||||
use App\Model\Hospital;
|
||||
@ -394,4 +395,24 @@ class BasicDataService extends BaseService
|
||||
|
||||
return success($hot_search_keyword->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测疾病分类列表
|
||||
* @return array
|
||||
*/
|
||||
public function getDetectionDiseaseList(): array
|
||||
{
|
||||
$detection_project_id = $this->request->route('detection_project_id',1);
|
||||
|
||||
$params = array();
|
||||
$params['detection_project_id'] = $detection_project_id;
|
||||
$params['status'] = 1;
|
||||
$params['enable'] = 1;
|
||||
$disease_class_detections = DiseaseClassDetection::getList($params);
|
||||
if (empty($disease_class_detections)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($disease_class_detections->toArray());
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ class DetectionService extends BaseService
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合作公司检测项目
|
||||
* 获取合作公司检测项目详情
|
||||
* @return array
|
||||
*/
|
||||
public function getDetectionProject(): array
|
||||
|
||||
@ -277,7 +277,7 @@ Router::addGroup('/patient', function () {
|
||||
// 获取合作公司检测项目列表
|
||||
Router::get('/project', [DetectionController::class, 'getDetectionProjectList']);
|
||||
|
||||
// 获取合作公司检测项目列表
|
||||
// 获取合作公司检测项目详情
|
||||
Router::get('/project/{detection_project_id:\d+}', [DetectionController::class, 'getDetectionProject']);
|
||||
});
|
||||
|
||||
@ -588,7 +588,7 @@ Router::addGroup('/basic', function () {
|
||||
Router::get('/keyword/search', [BasicDataController::class, 'getHotSearchKeyword']);
|
||||
|
||||
// 获取检测疾病分类列表
|
||||
Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDisease']);
|
||||
Router::get('/detection/disease', [BasicDataController::class, 'getDetectionDiseaseList']);
|
||||
});
|
||||
|
||||
// 获取医生评价
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user