diff --git a/common/jobs/ProductOrderSyncJob.php b/common/jobs/ProductOrderSyncJob.php index a02371b..8e5d226 100644 --- a/common/jobs/ProductOrderSyncJob.php +++ b/common/jobs/ProductOrderSyncJob.php @@ -39,8 +39,10 @@ class ProductOrderSyncJob extends BaseJob implements JobInterface $recipe = $prescriptionContent['repice'][0]; $recipeContent = Json::decode($recipe['content']); $processContent = ''; - if($recipe['process_rule_id']){ - $processContent = $recipe['process_rule']; + if($recipe['process_rule_id'] != 0){ + $processContent = '煎服,每天'.$recipe['deployment'].'次。'.$recipe['process_rule']; + } elseif ($recipe['package_method_id'] != 0) { + $processContent = '外配,每天'.$recipe['deployment'].'次。'. $recipe['process_rule']; } $params = [ 'cht_id' => 'XK_'.$ProductOrder->user_id.'_'.$ProductOrder->up_id.'_'.$ProductOrder->prescription->register_id, @@ -50,7 +52,7 @@ class ProductOrderSyncJob extends BaseJob implements JobInterface 'age' => FuncHelper::getAgeFromIdNo($prescriptionContent['patient']['id_card']), 'tot_posts' => $recipe['dosage'], 'tisane_posts' => $recipe['dosage'], - 'usage' => '煎服,每天'.$recipe['deployment'].'次。'.$processContent,//`, 每次'.$recipe['volume'].'ml + 'usage' => $processContent,//`, 每次'.$recipe['volume'].'ml 'doctor' => $prescriptionContent['doctor']['name'], 'department' => $prescriptionContent['doctor']['depart']['name'],//科室 'post_weight' => count($recipeContent), diff --git a/common/models/oldDb/PackageMethod.php b/common/models/oldDb/PackageMethod.php new file mode 100644 index 0000000..9e4b214 --- /dev/null +++ b/common/models/oldDb/PackageMethod.php @@ -0,0 +1,27 @@ + TimestampBehavior::class, + 'attributes' => [ + ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'], + ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], + ], + ], + ]; + } +} \ No newline at end of file diff --git a/common/modelsgii/oldDb/PackageMethod.php b/common/modelsgii/oldDb/PackageMethod.php new file mode 100644 index 0000000..bd035cb --- /dev/null +++ b/common/modelsgii/oldDb/PackageMethod.php @@ -0,0 +1,60 @@ + 50], + [['name'], 'unique'], + [['calc_method'],'in','range' => [1,2,3]], + ['price','double'], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'pid' => 'Pid', + 'name' => 'Name', + 'calc_method' => 'calc_method', + 'price' => 'price', + 'unit' => 'unit', + 'created_at' => '创建时间', + ]; + } +} diff --git a/service/modules/v1/controllers/PrescriptionController.php b/service/modules/v1/controllers/PrescriptionController.php index a52eea7..b78e88f 100644 --- a/service/modules/v1/controllers/PrescriptionController.php +++ b/service/modules/v1/controllers/PrescriptionController.php @@ -24,6 +24,7 @@ use common\models\oldDb\DrugUseTime; use common\models\oldDb\DrugUseType; use common\models\oldDb\DrugUseWay; use common\models\oldDb\GranularRepice; +use common\models\oldDb\PackageMethod; use common\models\oldDb\Prescription; use common\models\oldDb\PrescriptionChinese; use common\models\oldDb\PrescriptionGranular; @@ -913,7 +914,16 @@ class PrescriptionController extends BaseAppController $processRuleContent = '加工方式:'.$parentProcessRule->name.'-'.$processRule->name.'-'.$param['process_rule_note'].",".$processRule->price."元/".$processRule->unit.',共'.$totalNum.'g'; } } - + if($param['process_rule_id1']){ + if ($param['process_rule_type'] == 0) { + $processRule = PackageMethod::find()->where(['id' => $param['process_rule_id1']])->one(); + if(empty($processRule)){ + throw new Exception("包装方式错误"); + } + $processRuleContent = '包装方式:'.$processRule->name; + $param['package_method_id'] = $param['process_rule_id1']; + } + } $encode = Json::encode($medicine); @@ -927,6 +937,7 @@ class PrescriptionController extends BaseAppController $chineseRecipe->volume = $param['volume']??0; $chineseRecipe->cm_id = $param['cm_id']; $chineseRecipe->process_rule_id = $param['process_rule_id'] ?? 0; + $chineseRecipe->package_method_id = $param['package_method_id'] ?? 0; $chineseRecipe->process_rule = $processRuleContent; $chineseRecipe->process_rule_note = $param['process_rule_note']; $chineseRecipe->process_price = $process_price;