修改 医生问诊开关 接口,增加信息验证。以及每日接诊数量、接诊价格赋值内容
This commit is contained in:
parent
8784a93898
commit
547d4ded88
81
app/Model/DoctorConfigDifficultConsultation.php
Normal file
81
app/Model/DoctorConfigDifficultConsultation.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $difficult_consultation_id 主键id
|
||||||
|
* @property int $doctor_id 医生id
|
||||||
|
* @property string $service_content 服务内容
|
||||||
|
* @property string $service_process 服务流程
|
||||||
|
* @property int $service_period 服务周期
|
||||||
|
* @property int $service_rounds 服务回合数(0表示不限次)
|
||||||
|
* @property Carbon $created_at 创建时间
|
||||||
|
* @property Carbon $updated_at 修改时间
|
||||||
|
*/
|
||||||
|
class DoctorConfigDifficultConsultation extends Model
|
||||||
|
{
|
||||||
|
use Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*/
|
||||||
|
protected ?string $table = 'doctor_config_difficult_consultation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected array $fillable = ['difficult_consultation_id', 'doctor_id', 'service_content', 'service_process', 'service_period', 'service_rounds', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
protected string $primaryKey = "difficult_consultation_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 DoctorConfigDifficultConsultation|\Hyperf\Database\Model\Model
|
||||||
|
*/
|
||||||
|
public static function addDoctorConfigDifficultConsultation(array $data): \Hyperf\Database\Model\Model|DoctorConfigDifficultConsultation
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param array $params
|
||||||
|
* @param array $data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function edit(array $params = [], array $data = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->update($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
79
app/Model/DoctorConfigHealthPackage.php
Normal file
79
app/Model/DoctorConfigHealthPackage.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $health_package_id 主键id
|
||||||
|
* @property int $doctor_id 医生id
|
||||||
|
* @property int $config_health_package_id 健康包配置id
|
||||||
|
* @property string $service_price 服务价格(根据图文问诊价格计算)
|
||||||
|
* @property Carbon $created_at 创建时间
|
||||||
|
* @property Carbon $updated_at 修改时间
|
||||||
|
*/
|
||||||
|
class DoctorConfigHealthPackage extends Model
|
||||||
|
{
|
||||||
|
use Snowflake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*/
|
||||||
|
protected ?string $table = 'doctor_config_health_package';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected array $fillable = ['health_package_id', 'doctor_id', 'config_health_package_id', 'service_price', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
protected string $primaryKey = "health_package_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 DoctorConfigHealthPackage|\Hyperf\Database\Model\Model
|
||||||
|
*/
|
||||||
|
public static function addDoctorConfigHealthPackage(array $data): \Hyperf\Database\Model\Model|DoctorConfigHealthPackage
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param array $params
|
||||||
|
* @param array $data
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function edit(array $params = [], array $data = []): int
|
||||||
|
{
|
||||||
|
return self::where($params)->update($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,8 +4,10 @@ namespace App\Services;
|
|||||||
|
|
||||||
use App\Constants\HttpEnumCode;
|
use App\Constants\HttpEnumCode;
|
||||||
use App\Exception\BusinessException;
|
use App\Exception\BusinessException;
|
||||||
|
use App\Model\DoctorConfigDifficultConsultation;
|
||||||
use App\Model\DoctorConfigFollowPackage;
|
use App\Model\DoctorConfigFollowPackage;
|
||||||
use App\Model\DoctorConfigFollowPackageItem;
|
use App\Model\DoctorConfigFollowPackageItem;
|
||||||
|
use App\Model\DoctorConfigHealthPackage;
|
||||||
use App\Model\DoctorInquiryConfig;
|
use App\Model\DoctorInquiryConfig;
|
||||||
use App\Model\DoctorInquiryConfigService;
|
use App\Model\DoctorInquiryConfigService;
|
||||||
use App\Model\DoctorInquiryPriceRecord;
|
use App\Model\DoctorInquiryPriceRecord;
|
||||||
@ -293,6 +295,37 @@ class DoctorInquiryService extends BaseService
|
|||||||
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
return fail(HttpEnumCode::HTTP_ERROR, "请先进行绑定结算银行卡");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断对应信息是否存在
|
||||||
|
if ($inquiry_type == 1 && $inquiry_mode == 6) {
|
||||||
|
// 疑难会诊
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
$doctor_config_difficult_consultation = DoctorConfigDifficultConsultation::getOne($params);
|
||||||
|
if (empty($doctor_config_difficult_consultation)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请设置服务价格后开启");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 随访包
|
||||||
|
if ($inquiry_type == 1 && $inquiry_mode == 9) {
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
$doctor_config_follow_package = DoctorConfigFollowPackage::getOne($params);
|
||||||
|
if (empty($doctor_config_follow_package)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请添加服务内容后开启");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 健康包
|
||||||
|
if ($inquiry_type == 1 && $inquiry_mode == 8) {
|
||||||
|
$params = array();
|
||||||
|
$params['doctor_id'] = $user_info['client_user_id'];
|
||||||
|
$doctor_config_health_package = DoctorConfigHealthPackage::getOne($params);
|
||||||
|
if (empty($doctor_config_health_package)){
|
||||||
|
return fail(HttpEnumCode::HTTP_ERROR, "请设置服务价格后开启");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -303,6 +336,10 @@ class DoctorInquiryService extends BaseService
|
|||||||
$params['inquiry_mode'] = $inquiry_mode;
|
$params['inquiry_mode'] = $inquiry_mode;
|
||||||
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
$doctor_inquiry_config = DoctorInquiryConfig::getOne($params);
|
||||||
if (empty($doctor_inquiry_config)) {
|
if (empty($doctor_inquiry_config)) {
|
||||||
|
// 此处两个参数都默认设置为0,随访包以及健康包使用不到
|
||||||
|
$work_num_day = 0; // 每日接诊数量
|
||||||
|
$inquiry_price = 0; // 接诊价格(专家问诊-公益问诊)
|
||||||
|
|
||||||
// 获取系统问诊配置表
|
// 获取系统问诊配置表
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['inquiry_type'] = $inquiry_type;
|
$params['inquiry_type'] = $inquiry_type;
|
||||||
@ -313,6 +350,12 @@ class DoctorInquiryService extends BaseService
|
|||||||
return fail(HttpEnumCode::SERVER_ERROR);
|
return fail(HttpEnumCode::SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取系统问诊配置表
|
||||||
|
if ($inquiry_mode != 8 && $inquiry_mode != 9){
|
||||||
|
$work_num_day = $system_inquiry_config['default_work_num_day'] ?: 0;
|
||||||
|
$inquiry_price = $system_inquiry_config['inquiry_price'];
|
||||||
|
}
|
||||||
|
|
||||||
// 快速问诊,需创建
|
// 快速问诊,需创建
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['doctor_id'] = $user_info['client_user_id'];
|
$data['doctor_id'] = $user_info['client_user_id'];
|
||||||
@ -321,9 +364,8 @@ class DoctorInquiryService extends BaseService
|
|||||||
$data['inquiry_mode'] = $inquiry_mode;
|
$data['inquiry_mode'] = $inquiry_mode;
|
||||||
$data['is_enable'] = 1; // 是否启用(0:否 1:是)
|
$data['is_enable'] = 1; // 是否启用(0:否 1:是)
|
||||||
$data['last_enable_method'] = 1; // 最后开启方式(1:自己 2:后台)
|
$data['last_enable_method'] = 1; // 最后开启方式(1:自己 2:后台)
|
||||||
$data['work_num_day'] = $system_inquiry_config['default_work_num_day'] ?: 0;
|
$data['work_num_day'] = $work_num_day;
|
||||||
$data['inquiry_price'] = $system_inquiry_config['inquiry_price'];
|
$data['inquiry_price'] = $inquiry_price;
|
||||||
|
|
||||||
$doctor_inquiry_config = DoctorInquiryConfig::addInquiryConfig($data);
|
$doctor_inquiry_config = DoctorInquiryConfig::addInquiryConfig($data);
|
||||||
if (empty($doctor_inquiry_config)) {
|
if (empty($doctor_inquiry_config)) {
|
||||||
Db::rollBack();
|
Db::rollBack();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user