This commit is contained in:
Your Name
2026-10-17 16:51:48 +08:00
parent 56f85f7d89
commit ba2e2e4087
41 changed files with 2851 additions and 96 deletions
@@ -100,7 +100,7 @@ class PrescriptionOrderValidate extends BaseValidate
'uploadToPharmacy' => ['id'],
'previewGancaoRecipel' => ['id'],
'patchPrescriptionPatient' => ['id', 'patient_name', 'phone'],
'patchPrescriptionUsage' => ['id', 'times_per_day', 'usage_days', 'medication_days', 'aux_times_per_day', 'aux_usage_days'],
'patchPrescriptionUsage' => ['id', 'times_per_day', 'usage_days', 'medication_days', 'dosage_bag_count', 'aux_times_per_day', 'aux_usage_days', 'aux_dosage_bag_count'],
'updateAmount' => ['id', 'amount'],
'setShipMode' => ['id', 'ship_mode'],
'confirmGancaoSubmission' => ['id', 'resolution', 'remote_order_no', 'note'],
@@ -133,14 +133,28 @@ class PrescriptionOrderValidate extends BaseValidate
->append('express_company', 'max:20');
}
public function patchPrescriptionUsage(): PrescriptionOrderValidate
public function scenePatchPrescriptionUsage(): PrescriptionOrderValidate
{
return $this->only(['id', 'times_per_day', 'usage_days', 'medication_days', 'aux_times_per_day', 'aux_usage_days'])
$this->only(['id', 'times_per_day', 'usage_days', 'medication_days', 'dosage_bag_count', 'aux_times_per_day', 'aux_usage_days', 'aux_dosage_bag_count'])
->append('id', 'require|integer|gt:0')
->append('times_per_day', 'require|integer|between:1,6')
->append('usage_days', 'require|integer|between:1,999')
->append('medication_days', 'require|integer|between:1,999')
->append('aux_times_per_day', 'integer|between:1,6')
->append('aux_usage_days', 'integer|between:1,999');
foreach (['dosage_bag_count' => '主方', 'aux_dosage_bag_count' => '辅方'] as $field => $label) {
$this->append($field, [static function ($value, array $data) use ($field, $label) {
if (!array_key_exists($field, $data)) {
return true;
}
return (is_int($value) || is_string($value)) && preg_match('/^[1-5]$/D', (string) $value) === 1
? true
: $label . '袋数须为 1~5 的整数';
}]);
}
return $this;
}
}