修改医生问诊配置

This commit is contained in:
wucongxing8150 2024-04-10 08:55:44 +08:00
parent ccd5817faf
commit 6ff6ba2851
5 changed files with 100 additions and 18 deletions

View File

@ -13,7 +13,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $health_package_id 主键id
* @property int $doctor_id 医生id
* @property int $config_health_package_id 健康包配置id
* @property int $package_id 健康包配置id
* @property string $service_price 服务价格(根据图文问诊价格计算)
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 修改时间
@ -30,7 +30,7 @@ class DoctorConfigHealthPackage extends Model
/**
* 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 array $fillable = ['health_package_id', 'doctor_id', 'package_id', 'service_price', 'created_at', 'updated_at'];
protected string $primaryKey = "health_package_id";

View File

@ -11,7 +11,7 @@ use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $config_health_package_id 主键id
* @property int $package_id 主键id
* @property int $service_count 总服务次数
* @property int $monthly_frequency 每月次数
* @property string $effective_days 服务有效天数
@ -19,21 +19,21 @@ use Hyperf\Snowflake\Concern\Snowflake;
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 修改时间
*/
class ConfigHealthPackage extends Model
class HealthPackage extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'config_health_package';
protected ?string $table = 'health_package';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['config_health_package_id', 'service_count', 'monthly_frequency', 'effective_days', 'service_rate', 'created_at', 'updated_at'];
protected array $fillable = ['package_id', 'service_count', 'monthly_frequency', 'effective_days', 'service_rate', 'created_at', 'updated_at'];
protected string $primaryKey = "config_health_package_id";
protected string $primaryKey = "package_id";
/**
* 获取信息-单条
@ -60,9 +60,9 @@ class ConfigHealthPackage extends Model
/**
* 新增
* @param array $data
* @return ConfigHealthPackage|\Hyperf\Database\Model\Model
* @return HealthPackage|\Hyperf\Database\Model\Model
*/
public static function addConfigHealthPackage(array $data): \Hyperf\Database\Model\Model|ConfigHealthPackage
public static function addHealthPackage(array $data): \Hyperf\Database\Model\Model|HealthPackage
{
return self::create($data);
}

View 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 $package_product_id 主键id
* @property int $package_id 健康包id
* @property int $product_id 商品id
* @property int $quantity 数量
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 修改时间
*/
class HealthPackageProduct extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'health_package_product';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['package_product_id', 'package_id', 'product_id', 'quantity', 'created_at', 'updated_at'];
protected string $primaryKey = "package_product_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 HealthPackageProduct|\Hyperf\Database\Model\Model
*/
public static function addHealthPackageProduct(array $data): \Hyperf\Database\Model\Model|HealthPackageProduct
{
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);
}
}

View File

@ -4,7 +4,6 @@ namespace App\Services;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\ConfigHealthPackage;
use App\Model\DoctorConfigDifficultConsultation;
use App\Model\DoctorConfigFollowPackage;
use App\Model\DoctorConfigFollowPackageItem;
@ -12,6 +11,7 @@ use App\Model\DoctorConfigHealthPackage;
use App\Model\DoctorInquiryConfig;
use App\Model\DoctorInquiryConfigService;
use App\Model\DoctorInquiryPriceRecord;
use App\Model\HealthPackage;
use App\Model\SystemInquiryConfig;
use App\Model\UserDoctor;
use Hyperf\DbConnection\Db;
@ -374,8 +374,8 @@ class DoctorInquiryService extends BaseService
if ($inquiry_type == 1 || $inquiry_mode == 8){
// 获取健康包配置
$params = array();
$config_health_package = ConfigHealthPackage::getOne($params);
if (empty($config_health_package)){
$health_package = HealthPackage::getOne($params);
if (empty($health_package)){
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR);
}
@ -392,12 +392,12 @@ class DoctorInquiryService extends BaseService
}
// 价格计算(专家图文问诊价格*费率+30盒35元的干爽颗粒)
$service_price = $doctor_inquiry_config['inquiry_price'] * $config_health_package['service_rate'] / 100 * 6 + 35 * 30;
$service_price = $doctor_inquiry_config['inquiry_price'] * $health_package['service_rate'] / 100 * 6 + 35 * 30;
// 创建医生健康包
$data = array();
$data['doctor_id'] = $user_info['client_user_id'];
$data['config_health_package_id'] = $config_health_package['config_health_package_id'];
$data['package_id'] = $health_package['package_id'];
$data['service_price'] = $service_price;
$doctor_config_health_package = DoctorConfigHealthPackage::addDoctorConfigHealthPackage($data);
if (empty($doctor_config_health_package)){
@ -1136,14 +1136,14 @@ class DoctorInquiryService extends BaseService
// 获取健康包配置
$params = array();
$config_health_package = ConfigHealthPackage::getOne($params);
if (empty($config_health_package)){
$health_package = HealthPackage::getOne($params);
if (empty($health_package)){
return fail(HttpEnumCode::SERVER_ERROR);
}
$result = array();
$result['service_count'] = $config_health_package['service_count']; // 总服务次数
$result['service_rate'] = $config_health_package['service_rate']; // 服务费率。100为满值表示1正常费率。
$result['service_count'] = $health_package['service_count']; // 总服务次数
$result['service_rate'] = $health_package['service_rate']; // 服务费率。100为满值表示1正常费率。
$result['inquiry_price'] = $doctor_inquiry_config['inquiry_price']; // 专家问诊-图文接诊价格
return success($result);

View File

@ -578,6 +578,9 @@ Router::addGroup('/patient', function () {
// 删除家庭成员病情记录
Router::delete('/{pathography_id:\d+}', [PatientPathographyController::class, 'deleteFamilyPathography']);
});
// 获取用户购买的服务包
});
// 药师端api