产品服务包的查询逻辑

This commit is contained in:
2024-12-24 14:13:16 +08:00
parent 0baa5720aa
commit 38a308dd47
2 changed files with 53 additions and 4 deletions

View File

@@ -170,7 +170,7 @@ class PrescriptionController extends BaseAdminController
$data['total_price']=$recipe[0]['total_price'];
$data['remark']=$recipe[0]['remark'];
} else {//西药
} elseif ($Prescription['prescription_type'] == 2) {//西药
$repice = json_decode($Prescription['content'], true)['repice'];
$data = [];
@@ -202,6 +202,47 @@ class PrescriptionController extends BaseAdminController
$data[] = $item;
}
} else {
$repice = json_decode($Prescription['content'], true)['repice'];
$data = [];
try {
foreach ($repice as $v) {
$item = [
'id' => $v['id'],
'content' => json_decode($v['content']),
'drug_name' => json_decode($v['content'])->drug_name,
'source' => json_decode($v['content'])->source,
'function' => json_decode($v['content'])->function,
'usage' => json_decode($v['content'])->usage,
'specification' => json_decode($v['content'])->specification,
'instruction' => json_decode($v['content'])->instruction,
'image' => json_decode($v['content'])->image,
'number' => $v['number'],
'available_days' => $v['available_days'],
'total_price' => $v['total_price'],
'created_at' => $v['created_at'],
'type_id' => json_decode($v['content'])->type_id,
'time_id' => json_decode($v['content'])->time_id,
'frequency_id' => json_decode($v['content'])->frequency_id,
'unit_id' => json_decode($v['content'])->unit_id,
'usetime' => '',
'frequency' => '',
'grain_number' => $v['grain_number'],
'westUnit' => '',
'types' => '参考说明书', //药的使用方式
];
$data[] = $item;
}
} catch (\Exception $e) {
ds([
'message' => $e->getMessage(),
'line' => $e->getLine(),
'file' => $e->getFile(),
'trace' => $e->getTraceAsString()
]);
}
}
$ProductOrder=ProductOrder::find()->where([

View File

@@ -16,6 +16,7 @@ use common\models\oldDb\Prescription;
use common\models\oldDb\ProductOrder;
use common\models\oldDb\ProductOrderItems;
use common\models\oldDb\Region;
use common\models\oldDb\ServicePackageRepice;
use common\models\oldDb\Store;
use common\models\oldDb\SystemConfig;
use common\models\oldDb\User;
@@ -180,9 +181,16 @@ class ProductOrderController extends BaseAppController
if($prescription['wr_ids']){
$wr_ids = explode(',', $prescription['wr_ids']);
if ($prescription['prescription_type'] === 5) {
$west = ServicePackageRepice::find()->select('content,number,total_price')->where([
'in', 'id', $wr_ids
])->all();
} else {
$west = WestRepice::find()->select('content,number,total_price')->where([
'in', 'id', $wr_ids
])->all();
}
foreach ($west as $value) {
$value['content']=Json::decode($value['content']);
}