新增 获取家庭成员病情记录列表-分页
This commit is contained in:
parent
65a5f6bc4d
commit
7df80196c2
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Constants\HttpEnumCode;
|
|
||||||
use App\Request\PatientPathographyRequest;
|
use App\Request\PatientPathographyRequest;
|
||||||
use App\Services\PatientPathographyService;
|
use App\Services\PatientPathographyService;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -29,4 +28,25 @@ class PatientPathographyController extends AbstractController
|
|||||||
return $this->response->json(fail());
|
return $this->response->json(fail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取家庭成员病情记录列表-分页
|
||||||
|
* @return ResponseInterface
|
||||||
|
*/
|
||||||
|
public function getFamilyPathographyList(): ResponseInterface
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$request = $this->container->get(PatientPathographyRequest::class);
|
||||||
|
}catch (\Throwable $e){
|
||||||
|
return $this->response->json(fail());
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->scene('getFamilyPathographyList')->validateResolved();
|
||||||
|
|
||||||
|
$PatientPathographyService = new PatientPathographyService();
|
||||||
|
$data = $PatientPathographyService->getFamilyPathographyList();
|
||||||
|
return $this->response->json($data);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -34,6 +34,7 @@ use App\Services\OrderProductService;
|
|||||||
use App\Services\PatientOrderService;
|
use App\Services\PatientOrderService;
|
||||||
use App\Services\UserDoctorService;
|
use App\Services\UserDoctorService;
|
||||||
use App\Utils\Data;
|
use App\Utils\Data;
|
||||||
|
use App\Utils\Jwt;
|
||||||
use App\Utils\Log;
|
use App\Utils\Log;
|
||||||
use App\Utils\Mask;
|
use App\Utils\Mask;
|
||||||
use Extend\Alibaba\Oss;
|
use Extend\Alibaba\Oss;
|
||||||
@ -463,39 +464,5 @@ class TestController extends AbstractController
|
|||||||
|
|
||||||
public function test_17(){
|
public function test_17(){
|
||||||
|
|
||||||
$re = \Hyperf\Context\ApplicationContext::getContainer()->get(CacheInterface::class);
|
|
||||||
$a = $re->set("wucongxing","1",100);
|
|
||||||
dump($a);
|
|
||||||
$b = $re->get("wucongxing");
|
|
||||||
dump($b);
|
|
||||||
|
|
||||||
$redis = \Hyperf\Context\ApplicationContext::getContainer()->get(Redis::class);
|
|
||||||
$c = $redis->get("wucongxing");
|
|
||||||
dump($c);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// $weChat = new Wechat(1);
|
|
||||||
//
|
|
||||||
// $env_version = "release";
|
|
||||||
// $app_env = \Hyperf\Support\env("APP_ENV",'dev');
|
|
||||||
// if ($app_env == "dev"){
|
|
||||||
// $env_version = "trial";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// $options = [
|
|
||||||
// "scene" => "?doctor_id=516900370252341248",// query 参数
|
|
||||||
// "page" => "pages/expertDetail/expertDetail",
|
|
||||||
// "check_path" => false,
|
|
||||||
// "env_version" => $env_version,
|
|
||||||
// ];
|
|
||||||
//
|
|
||||||
// $img_buffer = $weChat->getUnlimitedQRCode($options);
|
|
||||||
//
|
|
||||||
// $oss = new Oss();
|
|
||||||
//
|
|
||||||
// $filename = "applet/doctor/card/516900370252341248.jpg";
|
|
||||||
//
|
|
||||||
// $oss->putObject($filename, $img_buffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,4 +120,28 @@ class PatientPathography extends Model
|
|||||||
{
|
{
|
||||||
return self::where($params)->update($data);
|
return self::where($params)->update($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取家庭成员病情记录列表-分页
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @param int|null $page
|
||||||
|
* @param int|null $per_page
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getPatientPathographyPage(array $params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||||
|
{
|
||||||
|
$result = self::where($params)
|
||||||
|
->orderBy("created_at",'desc')
|
||||||
|
->paginate($per_page, $fields, "page", $page);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['current_page'] = $result->currentPage();// 当前页码
|
||||||
|
$data['total'] = $result->total();// 数据总数
|
||||||
|
$data['data'] = $result->items();// 数据
|
||||||
|
$data['per_page'] = $result->perPage();// 每页个数
|
||||||
|
$data['last_page'] = $result->lastPage();// 最后一页
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,10 @@ use Hyperf\Validation\Request\FormRequest;
|
|||||||
class PatientPathographyRequest extends FormRequest
|
class PatientPathographyRequest extends FormRequest
|
||||||
{
|
{
|
||||||
protected array $scenes = [
|
protected array $scenes = [
|
||||||
'existFamilyPathography' => [ // 获取患者优惠卷列表
|
'existFamilyPathography' => [ // 检测家庭成员是否存在病情记录
|
||||||
|
'family_id',
|
||||||
|
],
|
||||||
|
'getFamilyPathographyList' => [ // 获取家庭成员病情记录列表-分页
|
||||||
'family_id',
|
'family_id',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Constants\HttpEnumCode;
|
||||||
|
use App\Model\OrderProduct;
|
||||||
use App\Model\PatientPathography;
|
use App\Model\PatientPathography;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,4 +35,32 @@ class PatientPathographyService extends BaseService
|
|||||||
|
|
||||||
return success($result);
|
return success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取家庭成员病情记录列表-分页
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFamilyPathographyList(): array
|
||||||
|
{
|
||||||
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
$family_id = $this->request->input('family_id');
|
||||||
|
$page = $this->request->input('page', 1);
|
||||||
|
$per_page = $this->request->input('per_page', 10);
|
||||||
|
|
||||||
|
// 获取病情记录列表
|
||||||
|
$fields = [
|
||||||
|
"pathography_id",
|
||||||
|
"created_at",
|
||||||
|
"disease_class_name",
|
||||||
|
"disease_desc"
|
||||||
|
];
|
||||||
|
|
||||||
|
$params = array();
|
||||||
|
$params['user_id'] = $user_info['user_id'];
|
||||||
|
$params['patient_id'] = $user_info['client_user_id'];
|
||||||
|
$params['family_id'] = $family_id;
|
||||||
|
$patient_pathographys = PatientPathography::getPatientPathographyPage($params, $fields, $page, $per_page);
|
||||||
|
|
||||||
|
return success($patient_pathographys);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ Router::addGroup('/patient', function () {
|
|||||||
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
|
Router::get('/exist', [PatientPathographyController::class, 'existFamilyPathography']);
|
||||||
|
|
||||||
// 获取家庭成员病情记录列表-分页
|
// 获取家庭成员病情记录列表-分页
|
||||||
Router::get('/{family_id:\d+}', [PatientPathographyController::class, 'existFamilyPathography']);
|
Router::get('', [PatientPathographyController::class, 'getFamilyPathographyList']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user