130 lines
4.4 KiB
PHP
130 lines
4.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Model\DoctorInquiryConfig;
|
|
use App\Model\SystemInquiryConfig;
|
|
use App\Model\UserDoctor;
|
|
use Hyperf\Command\Command as HyperfCommand;
|
|
use Hyperf\Command\Annotation\Command;
|
|
use Hyperf\DbConnection\Db;
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
/**
|
|
* 废弃
|
|
*/
|
|
#[Command]
|
|
class editDoctorInquiryConfigCommand extends HyperfCommand
|
|
{
|
|
public function __construct(protected ContainerInterface $container)
|
|
{
|
|
parent::__construct('editDoctorInquiryConfig:command');
|
|
}
|
|
|
|
public function configure()
|
|
{
|
|
parent::configure();
|
|
$this->setDescription('修改医生问诊配置');
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$this->line('开始');
|
|
|
|
// 获取医生信息
|
|
$params = array();
|
|
$user_doctors = UserDoctor::getList($params);
|
|
if (empty($user_doctors)) {
|
|
$this->line('结束,无医生需处理');
|
|
return;
|
|
}
|
|
|
|
// 获取系统问诊配置
|
|
$params = array();
|
|
$params['inquiry_type'] = 4;
|
|
$params['inquiry_mode'] = 1;
|
|
$system_inquiry_config = SystemInquiryConfig::getOne($params);
|
|
if (empty($system_inquiry_config)) {
|
|
$this->line('结束,系统问诊配置获取失败');
|
|
return;
|
|
}
|
|
|
|
foreach ($user_doctors as $user_doctor){
|
|
Db::beginTransaction();
|
|
|
|
try {
|
|
// 是否参加专家图文接诊
|
|
if ($user_doctor['is_img_expert_reception'] == 1){
|
|
$params = array();
|
|
$params['doctor_id'] = $user_doctor['doctor_id'];
|
|
$params['inquiry_type'] = 1;
|
|
$params['inquiry_mode'] = 1;
|
|
|
|
$data = array();
|
|
$data['is_enable'] = 1;
|
|
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
|
}
|
|
|
|
// 是否参加快速图文接诊
|
|
if ($user_doctor['is_img_quick_reception'] == 1){
|
|
$params = array();
|
|
$params['doctor_id'] = $user_doctor['doctor_id'];
|
|
$params['inquiry_type'] = 2;
|
|
$params['inquiry_mode'] = 1;
|
|
|
|
$data = array();
|
|
$data['is_enable'] = 1;
|
|
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
|
}
|
|
|
|
// 是否参加公益图文问诊
|
|
if ($user_doctor['is_img_welfare_reception'] == 1){
|
|
$params = array();
|
|
$params['doctor_id'] = $user_doctor['doctor_id'];
|
|
$params['inquiry_type'] = 3;
|
|
$params['inquiry_mode'] = 1;
|
|
|
|
$data = array();
|
|
$data['is_enable'] = 1;
|
|
DoctorInquiryConfig::editInquiryConfig($params,$data);
|
|
}
|
|
|
|
// 医生多点执业认证状态
|
|
if ($user_doctor['multi_point_status'] == 1){
|
|
// 查询是否已设置多点执业认证状态
|
|
$params = array();
|
|
$params['doctor_id'] = $user_doctor['doctor_id'];
|
|
$params['inquiry_type'] = 4;
|
|
$params['inquiry_mode'] = 1;
|
|
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
|
if (empty($doctor_inquiry_config)) {
|
|
$data = array();
|
|
$data['doctor_id'] = $user_doctor['doctor_id'];
|
|
$data['inquiry_type'] = 4;
|
|
$data['inquiry_mode'] = 1;
|
|
$data['is_enable'] = 1;
|
|
$data['work_num_day'] = $system_inquiry_config["max_work_num_day"];
|
|
$data['inquiry_price'] = $system_inquiry_config["inquiry_price"];
|
|
|
|
$doctorInquiryConfig = DoctorInquiryConfig::addInquiryConfig($data);
|
|
if (empty($doctorInquiryConfig)){
|
|
Db::rollBack();
|
|
$this->line('失败:问诊购药处理失败');
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
Db::commit();
|
|
}catch (\Throwable $e){
|
|
Db::rollBack();
|
|
// 记录失败次数
|
|
$this->line("失败:" . $e->getMessage());
|
|
}
|
|
}
|
|
$this->line('结束');
|
|
}
|
|
}
|