|
|
|
|
@ -59,11 +59,11 @@ class OrdersController extends CommonController
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/manager/get-product/{id}",
|
|
|
|
|
* summary="获取产品详情",
|
|
|
|
|
* path="/manager/get-care-product/{project_id}",
|
|
|
|
|
* summary="V2-获取产品详情",
|
|
|
|
|
* description="获取产品详情",
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Parameter(name="id", in="path", @OA\Schema(type="integer"), required=true, description="id"),
|
|
|
|
|
* @OA\Parameter(name="project_id", in="path", @OA\Schema(type="integer"), required=true, description="project_id"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="获取产品详情"
|
|
|
|
|
@ -71,19 +71,26 @@ class OrdersController extends CommonController
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function getProduct($id)
|
|
|
|
|
public function getCareProduct($project_id)
|
|
|
|
|
{
|
|
|
|
|
$product = (new Product())->with([
|
|
|
|
|
"defaultItem",
|
|
|
|
|
"productItems",
|
|
|
|
|
"project",
|
|
|
|
|
DB::enableQueryLog();
|
|
|
|
|
$product = (new Product())->where("project_id", $project_id)->with([
|
|
|
|
|
"productItems" => function ($query) {
|
|
|
|
|
$query->select("id", "name", "product_id", "patient_quantity", "price");
|
|
|
|
|
},
|
|
|
|
|
"productParamedicLevels" => function ($query) {
|
|
|
|
|
$query->with("paramedicLevel");
|
|
|
|
|
$query
|
|
|
|
|
->select("product_paramedic_level.id", "product_paramedic_level.product_id", "product_paramedic_level.price")
|
|
|
|
|
->leftJoin("paramedic_level", "product_paramedic_level.paramedic_level_id", "=", "paramedic_level.id")
|
|
|
|
|
->addSelect("paramedic_level.name as paramedic_level_name");
|
|
|
|
|
},
|
|
|
|
|
"factors" => function ($query) {
|
|
|
|
|
$query->with("factorItems");
|
|
|
|
|
}
|
|
|
|
|
])->find($id);
|
|
|
|
|
$query->with(["factorItems" => function ($query) {
|
|
|
|
|
$query->select("id", "name", "factor_id", "price", "myindex")->orderBy("myindex");
|
|
|
|
|
}])->select("id", "name", "product_id")->orderBy("myindex");
|
|
|
|
|
}])
|
|
|
|
|
->leftJoin("project", "project.id", "=", "product.project_id")
|
|
|
|
|
->select("product.id", "product.name", "product.project_id", "project.name as project_name")->first();
|
|
|
|
|
return response()->json($product->toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|