获取患者进行中的检测订单
This commit is contained in:
parent
cefe11b02b
commit
26cd0dcbe8
@ -76,13 +76,29 @@ class DetectionController extends AbstractController
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getDetectionDoctorOrderFirst(): ResponseInterface
|
||||
public function getDetectionOrderFirst(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DetectionRequest::class);
|
||||
$request->scene('getDetectionDoctorOrderFirst')->validateResolved();
|
||||
$request->scene('getDetectionOrderFirst')->validateResolved();
|
||||
|
||||
$detectionService = new DetectionService();
|
||||
$data = $detectionService->getDetectionDoctorOrderFirst();
|
||||
$data = $detectionService->getDetectionOrderFirst();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定检测管
|
||||
* @return ResponseInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function bindDetectionTube(): ResponseInterface
|
||||
{
|
||||
$request = $this->container->get(DetectionRequest::class);
|
||||
$request->scene('bindDetectionTube')->validateResolved();
|
||||
|
||||
$detectionService = new DetectionService();
|
||||
$data = $detectionService->bindDetectionTube();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -396,4 +396,32 @@ class TestController extends AbstractController
|
||||
$result = $Wechat->getUrlLink($options);
|
||||
dump($result);
|
||||
}
|
||||
|
||||
// 设置坐班医生
|
||||
public function setDoctor(){
|
||||
$timestamp = time(); // 当前时间戳
|
||||
$weekNumber = date('W', $timestamp); // 获取当前年份的周数
|
||||
|
||||
// 计算本周一的时间戳
|
||||
$weekStartTimestamp = strtotime("Monday this week", $timestamp);
|
||||
|
||||
// 计算本周一所在周的奇数或偶数周
|
||||
if ($weekNumber % 2 === 1) {
|
||||
$startOfWeek = $weekStartTimestamp; // 奇数周的本周一
|
||||
$endOfWeek = strtotime('+6 days', $startOfWeek); // 奇数周的本周日
|
||||
} else {
|
||||
$endOfWeek = $weekStartTimestamp; // 偶数周的本周一
|
||||
$startOfWeek = strtotime('-6 days', $endOfWeek); // 偶数周的本周日
|
||||
}
|
||||
|
||||
// 获取每日日期
|
||||
$dates = [];
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$dates[] = date('Y-m-d', strtotime("+$i days", $startOfWeek));
|
||||
}
|
||||
|
||||
echo "Start of the week: " . date('Y-m-d', $startOfWeek) . "\n";
|
||||
echo "End of the week: " . date('Y-m-d', $endOfWeek) . "\n";
|
||||
echo "Dates of the week: " . implode(', ', $dates);
|
||||
}
|
||||
}
|
||||
@ -21,9 +21,13 @@ class DetectionRequest extends FormRequest
|
||||
'doctor_id', // 医生id
|
||||
'client_type', // 客户端类型(1:手机 2:电脑)
|
||||
],
|
||||
'getDetectionDoctorOrderFirst' => [ // 创建检测订单
|
||||
'getDetectionOrderFirst' => [ // 获取患者进行中的检测订单
|
||||
'family_id',
|
||||
],
|
||||
'bindDetectionTube' => [ // 绑定检测管
|
||||
'detection_bar_code',
|
||||
'detection_pic',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -47,6 +51,8 @@ class DetectionRequest extends FormRequest
|
||||
'detection_project_id' => 'required',
|
||||
'doctor_id' => 'required',
|
||||
'client_type' => 'required|integer|min:1|max:2',
|
||||
'detection_bar_code' => 'required',
|
||||
'detection_pic' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ use App\Model\PatientFamily;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserLocation;
|
||||
use App\Utils\Log;
|
||||
use App\Utils\PcreMatch;
|
||||
use Extend\Wechat\WechatPay;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
@ -474,7 +475,7 @@ class DetectionService extends BaseService
|
||||
* 获取患者进行中的检测订单
|
||||
* @return array
|
||||
*/
|
||||
public function getDetectionDoctorOrderFirst(): array
|
||||
public function getDetectionOrderFirst(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
@ -493,6 +494,63 @@ class DetectionService extends BaseService
|
||||
|
||||
}
|
||||
|
||||
// 绑定检测管
|
||||
public function bindDetectionTube(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_detection_id = $this->request->route("order_detection_id");
|
||||
|
||||
$request_params = $this->request->all();
|
||||
|
||||
if (count($request_params['detection_pic']) < 1){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"请上传检测管图片");
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$params['patient_id'] = $user_info['client_user_id'];
|
||||
$params['order_detection_id'] = $order_detection_id;
|
||||
$order_detection = OrderDetection::getOne($params);
|
||||
if (empty($order_detection)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 检测订单状态
|
||||
if ($order_detection['detection_status'] != 2){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单状态错误");
|
||||
}
|
||||
|
||||
if ($order_detection['detection_pay_status'] != 2){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"订单未支付");
|
||||
}
|
||||
|
||||
if (!empty($order_detection['detection_bar_code'])){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定");
|
||||
}
|
||||
|
||||
if (!empty($order_detection['detection_pic'])){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"请勿重复绑定");
|
||||
}
|
||||
|
||||
// 处理检测管图片
|
||||
$detection_pic = implode(',', $request_params['detection_pic']);
|
||||
$detection_pic = PcreMatch::pregRemoveOssWebsite($detection_pic);
|
||||
|
||||
$data = array();
|
||||
$data['detection_pic'] = $detection_pic;
|
||||
$data['detection_bar_code'] = $request_params['detection_bar_code'];
|
||||
$data['detection_status'] = 3;
|
||||
|
||||
$params = array();
|
||||
$params['order_detection_id'] = $order_detection_id;
|
||||
$res = OrderDetection::editOrderDetection($params,$data);
|
||||
if (!$res){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"绑定失败");
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消未支付检测订单
|
||||
* @param string|int $order_no 订单编号
|
||||
|
||||
@ -276,7 +276,10 @@ Router::addGroup('/patient', function () {
|
||||
);
|
||||
|
||||
// 获取患者进行中的检测订单
|
||||
Router::get('', [DetectionController::class, 'getDetectionDoctorOrderFirst']);
|
||||
Router::get('', [DetectionController::class, 'getDetectionOrderFirst']);
|
||||
|
||||
// 绑定检测管
|
||||
Router::put('/bind/{order_detection_id:\d+}', [DetectionController::class, 'bindDetectionTube']);
|
||||
|
||||
// 获取检测机构合作医生列表
|
||||
Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']);
|
||||
@ -688,6 +691,9 @@ Router::addGroup('/test', function () {
|
||||
// 模拟退款
|
||||
// Router::get('/refund', [TestController::class, 'refund']);
|
||||
|
||||
// 设置坐班医生
|
||||
Router::get('/doctor', [TestController::class, 'setDoctor']);
|
||||
|
||||
});
|
||||
|
||||
// 地址管理
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user