修正获取处方详情接口返回数据
This commit is contained in:
parent
5a4fcaaf7f
commit
e047f4971c
@ -239,4 +239,20 @@ class UserDoctorController extends AbstractController
|
|||||||
$data = $UserDoctorService->getPrescriptionInfo();
|
$data = $UserDoctorService->getPrescriptionInfo();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改处方
|
||||||
|
* @return ResponseInterface
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function putPrescription(): ResponseInterface
|
||||||
|
{
|
||||||
|
$request = $this->container->get(UserDoctorRequest::class);
|
||||||
|
$request->scene('putPrescription')->validateResolved();
|
||||||
|
|
||||||
|
$UserDoctorService = new UserDoctorService();
|
||||||
|
$data = $UserDoctorService->putPrescription();
|
||||||
|
return $this->response->json($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ namespace App\Model;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Hyperf\Database\Model\Collection;
|
||||||
use Hyperf\Snowflake\Concern\Snowflake;
|
use Hyperf\Snowflake\Concern\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,10 +32,37 @@ class OrderPrescriptionIcd extends Model
|
|||||||
*/
|
*/
|
||||||
protected array $fillable = ['prescription_icd_id', 'order_prescription_id', 'icd_id', 'icd_name', 'icd_code', 'created_at', 'updated_at'];
|
protected array $fillable = ['prescription_icd_id', 'order_prescription_id', 'icd_id', 'icd_name', 'icd_code', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast to native types.
|
|
||||||
*/
|
|
||||||
protected array $casts = ['prescription_icd_id' => 'integer', 'order_prescription_id' => 'integer', 'icd_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
|
||||||
|
|
||||||
protected string $primaryKey = "prescription_icd_id";
|
protected string $primaryKey = "prescription_icd_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 $params
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function getExists(array $params): bool
|
||||||
|
{
|
||||||
|
return self::where($params)->exists();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,18 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
|||||||
* @property int $order_prescription_id 订单-处方id
|
* @property int $order_prescription_id 订单-处方id
|
||||||
* @property int $product_id 商品id
|
* @property int $product_id 商品id
|
||||||
* @property int $prescription_product_num 商品数量
|
* @property int $prescription_product_num 商品数量
|
||||||
|
* @property string $product_name 商品名称
|
||||||
|
* @property string $product_spec 商品规格
|
||||||
|
* @property string $license_number 批准文号
|
||||||
|
* @property string $manufacturer 生产厂家
|
||||||
|
* @property string $single_unit 单次剂量(例:1次1包)
|
||||||
|
* @property string $single_use 单次用法(例:口服)
|
||||||
|
* @property string $packaging_unit 基本包装单位(例:盒/瓶)
|
||||||
|
* @property string $frequency_use 使用频率(例:1天3次)
|
||||||
|
* @property int $available_days 可用天数(3)
|
||||||
* @property \Carbon\Carbon $created_at 创建时间
|
* @property \Carbon\Carbon $created_at 创建时间
|
||||||
* @property \Carbon\Carbon $updated_at 修改时间
|
* @property \Carbon\Carbon $updated_at 修改时间
|
||||||
|
* @property-read Product $Product
|
||||||
*/
|
*/
|
||||||
class OrderPrescriptionProduct extends Model
|
class OrderPrescriptionProduct extends Model
|
||||||
{
|
{
|
||||||
@ -30,7 +40,7 @@ class OrderPrescriptionProduct extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected array $fillable = ['prescription_product_id', 'order_prescription_id', 'product_id', 'prescription_product_num', 'created_at', 'updated_at'];
|
protected array $fillable = ['prescription_product_id', 'order_prescription_id', 'product_id', 'prescription_product_num', 'product_name', 'product_spec', 'license_number', 'manufacturer', 'single_unit', 'single_use', 'packaging_unit', 'frequency_use', 'available_days', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
protected string $primaryKey = "prescription_product_id";
|
protected string $primaryKey = "prescription_product_id";
|
||||||
/**
|
/**
|
||||||
@ -75,16 +85,32 @@ class OrderPrescriptionProduct extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据-关联商品表
|
* 获取数据-关联商品表
|
||||||
|
* 限制数量
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @return Collection|array
|
* @return Collection|array
|
||||||
*/
|
*/
|
||||||
public static function getWithProductList(array $params = [], array $fields = ['*']): Collection|array
|
public static function getWithProductLimit(array $params = [], array $fields = ['*']): Collection|array
|
||||||
{
|
{
|
||||||
return self::with([
|
return self::with([
|
||||||
"Product"
|
"Product"
|
||||||
])
|
])
|
||||||
->where($params)
|
->where($params)
|
||||||
|
->limit(10)
|
||||||
|
->get($fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据
|
||||||
|
* 限制数量
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getLimit(array $params = [], array $fields = ['*']): Collection|array
|
||||||
|
{
|
||||||
|
return self::where($params)
|
||||||
|
->limit(10)
|
||||||
->get($fields);
|
->get($fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,4 +93,24 @@ class Product extends Model
|
|||||||
{
|
{
|
||||||
return self::where($params)->get($fields);
|
return self::where($params)->get($fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取关键字搜索列表
|
||||||
|
* @param array $params
|
||||||
|
* @param string $keyword
|
||||||
|
* @param array $fields
|
||||||
|
* @return Collection|array
|
||||||
|
*/
|
||||||
|
public static function getSearchKeywordList(array $params = [],string $keyword = '',array $fields = ['*']): Collection|array
|
||||||
|
{
|
||||||
|
return self::when($keyword, function ($query, $keyword) {
|
||||||
|
$query->where(function ($query) use ($keyword) {
|
||||||
|
$query->orwhere("product_name", 'like', '%' . $keyword . '%');
|
||||||
|
$query->orwhere("common_name", 'like', '%' . $keyword . '%');
|
||||||
|
$query->orwhere("mnemonic_code", 'like', '%' . $keyword . '%');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->where($params)
|
||||||
|
->get($fields);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,10 @@ class UserDoctorRequest extends FormRequest
|
|||||||
'order_inquiry_id',
|
'order_inquiry_id',
|
||||||
'order_prescription_id', // 处方id(非必须)
|
'order_prescription_id', // 处方id(非必须)
|
||||||
],
|
],
|
||||||
|
'putPrescription' => [ // 修改处方
|
||||||
|
'order_prescription_id',
|
||||||
|
'order_prescription_id',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -212,10 +212,10 @@ class BasicDataService extends BaseService
|
|||||||
'frequency_use',
|
'frequency_use',
|
||||||
'available_days',
|
'available_days',
|
||||||
];
|
];
|
||||||
$params = array();
|
|
||||||
$params[] = ['product_name', 'like', '%' . $product_keyword . '%'];
|
|
||||||
|
|
||||||
$product = Product::getList($params, $fields);
|
$params = array();
|
||||||
|
|
||||||
|
$product = Product::getSearchKeywordList($params, $product_keyword,$fields);
|
||||||
if (empty($product)) {
|
if (empty($product)) {
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $order_inquiry_id;
|
$params['order_inquiry_id'] = $order_inquiry_id;
|
||||||
$params['order_prescription_id'] = $order_prescription_id;
|
$params['order_prescription_id'] = $order_prescription_id;
|
||||||
$order_prescription_products = OrderPrescriptionProduct::getWithProductList($params);
|
$order_prescription_products = OrderPrescriptionProduct::getLimit($params);
|
||||||
if(empty($order_prescription_products)){
|
if(empty($order_prescription_products)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -82,13 +82,12 @@ class OrderPrescriptionService extends BaseService
|
|||||||
$data['prescription_product_id'] = $order_prescription_product['prescription_product_id'];
|
$data['prescription_product_id'] = $order_prescription_product['prescription_product_id'];
|
||||||
$data['product_id'] = $order_prescription_product['product_id'];
|
$data['product_id'] = $order_prescription_product['product_id'];
|
||||||
$data['prescription_product_num'] = $order_prescription_product['prescription_product_num'];
|
$data['prescription_product_num'] = $order_prescription_product['prescription_product_num'];
|
||||||
$data['product_name'] = $order_prescription_product['Product']['product_name'];
|
$data['product_name'] = $order_prescription_product['product_name'] ?? "";
|
||||||
$data['product_cover_img'] = addAliyunOssWebsite($order_prescription_product['Product']['product_cover_img']);
|
$data['product_spec'] = $order_prescription_product['product_spec'] ?? "";
|
||||||
$data['product_spec'] = $order_prescription_product['Product']['product_spec'];
|
$data['single_unit'] = $order_prescription_product['single_unit'] ?? "";
|
||||||
$data['single_unit'] = $order_prescription_product['Product']['single_unit'];
|
$data['single_use'] = $order_prescription_product['single_use'] ?? "";
|
||||||
$data['single_use'] = $order_prescription_product['Product']['single_use'];
|
$data['packaging_unit'] = $order_prescription_product['packaging_unit'] ?? "";
|
||||||
$data['packaging_unit'] = $order_prescription_product['Product']['packaging_unit'];
|
$data['frequency_use'] = $order_prescription_product['frequency_use'] ?? "";
|
||||||
$data['frequency_use'] = $order_prescription_product['Product']['frequency_use'];
|
|
||||||
|
|
||||||
$result[] = $data;
|
$result[] = $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ use App\Model\OrderEvaluation;
|
|||||||
use App\Model\OrderInquiry;
|
use App\Model\OrderInquiry;
|
||||||
use App\Model\OrderInquiryCase;
|
use App\Model\OrderInquiryCase;
|
||||||
use App\Model\OrderPrescription;
|
use App\Model\OrderPrescription;
|
||||||
|
use App\Model\OrderPrescriptionIcd;
|
||||||
use App\Model\OrderProductItem;
|
use App\Model\OrderProductItem;
|
||||||
use App\Model\User;
|
use App\Model\User;
|
||||||
use App\Model\UserDoctor;
|
use App\Model\UserDoctor;
|
||||||
@ -851,17 +852,39 @@ class UserDoctorService extends BaseService
|
|||||||
$order_prescription_product = $OrderPrescriptionService->getproductList($order_inquiry_id,$order_prescription_id);
|
$order_prescription_product = $OrderPrescriptionService->getproductList($order_inquiry_id,$order_prescription_id);
|
||||||
|
|
||||||
// 获取处方关联疾病表
|
// 获取处方关联疾病表
|
||||||
|
$fields = [
|
||||||
|
'prescription_icd_id',
|
||||||
|
'icd_id',
|
||||||
|
'icd_name',
|
||||||
|
];
|
||||||
|
$params = array();
|
||||||
|
$params['order_prescription_id'] = $order_prescription_id;
|
||||||
|
$order_prescription_icd = OrderPrescriptionIcd::getList($params,$fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result['inquiry_case_product'] = $inquiry_case_product;// 用药意向
|
$result['inquiry_case_product'] = $inquiry_case_product;// 用药意向
|
||||||
$result['order_prescription_product'] = $order_prescription_product ?? [];// 开方药品
|
$result['prescription_product'] = $order_prescription_product ?? [];// 开方药品
|
||||||
$result['case'] = $order_inquiry_case;// 病例数据
|
$result['case'] = $order_inquiry_case;// 病例数据
|
||||||
|
$result['prescription_icd'] = $order_prescription_icd ?? [];// 处方诊断疾病
|
||||||
$result['prescription']['doctor_advice'] = $order_prescription['doctor_advice'] ?? "";// 医嘱
|
$result['prescription']['doctor_advice'] = $order_prescription['doctor_advice'] ?? "";// 医嘱
|
||||||
|
|
||||||
return success($result);
|
return success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改处方
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function putPrescription(): array
|
||||||
|
{
|
||||||
|
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||||
|
|
||||||
|
$order_inquiry_id = $this->request->input('order_inquiry_id');
|
||||||
|
$order_prescription_id = $this->request->input('order_prescription_id');
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测医生身份认证
|
* 检测医生身份认证
|
||||||
* @param object|array $user_doctor 医生表数据
|
* @param object|array $user_doctor 医生表数据
|
||||||
|
|||||||
@ -18,7 +18,6 @@ use App\Controller\IndexController;
|
|||||||
use App\Controller\InquiryController;
|
use App\Controller\InquiryController;
|
||||||
use App\Controller\LoginController;
|
use App\Controller\LoginController;
|
||||||
use App\Controller\CodeController;
|
use App\Controller\CodeController;
|
||||||
use App\Controller\OrderInquiryController;
|
|
||||||
use App\Controller\PatientCaseController;
|
use App\Controller\PatientCaseController;
|
||||||
use App\Controller\PatientCenterController;
|
use App\Controller\PatientCenterController;
|
||||||
use App\Controller\PatientDoctorController;
|
use App\Controller\PatientDoctorController;
|
||||||
@ -135,6 +134,9 @@ Router::addGroup('/doctor', function () {
|
|||||||
|
|
||||||
// 获取处方详情
|
// 获取处方详情
|
||||||
Router::get('/info', [UserDoctorController::class, 'getPrescriptionInfo']);
|
Router::get('/info', [UserDoctorController::class, 'getPrescriptionInfo']);
|
||||||
|
|
||||||
|
// 修改处方
|
||||||
|
Router::put('', [UserDoctorController::class, 'putPrescription']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 常用语
|
// 常用语
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user