diff --git a/app/Http/Controllers/Hospital/IntroduceController.php b/app/Http/Controllers/Hospital/IntroduceController.php index 492a06d..b233fbd 100644 --- a/app/Http/Controllers/Hospital/IntroduceController.php +++ b/app/Http/Controllers/Hospital/IntroduceController.php @@ -72,6 +72,9 @@ class IntroduceController extends Controller 'dept_name' => $department_details->dept_name, 'category_id' => $department_details->category_id, 'category_name' => $department_details->departmentCategory->name, + 'building_id' => $department_details->building_id, + 'building_name' => $department_details->buildingDistribution->name, + 'dept_location' => $department_details->dept_location ?: '', 'introduction' => $department_details->introduction ?: '', ]; diff --git a/app/Http/Controllers/Message/TriggerController.php b/app/Http/Controllers/Message/TriggerController.php index 180a95e..ef69bf1 100644 --- a/app/Http/Controllers/Message/TriggerController.php +++ b/app/Http/Controllers/Message/TriggerController.php @@ -31,7 +31,7 @@ class TriggerController extends Controller */ public function registerStopRemind(Request $request): JsonResponse { - $validated = Validator::make($request->all(), [ + $validated = Validator::make($request->json()->all(), [ 'patient_id' => 'required', 'reg_date' => 'required|date_format:Y-m-d', 'begin_time' => 'required|date_format:H:i', @@ -57,7 +57,7 @@ class TriggerController extends Controller return jsonResponseToHis(Response::HTTP_OK, 1, $validated->errors()->first()); } - $validated = $request->safe()->only(['patient_id', 'reg_date', 'begin_time', 'end_time', 'dept_name', 'doctor_name', 'tips']); + $validated = $validated->safe()->only(['patient_id', 'reg_date', 'begin_time', 'end_time', 'dept_name', 'doctor_name', 'tips']); [$result, $message] = $this->trigger_logic->registerStopRemind( $validated['patient_id'], @@ -69,7 +69,7 @@ class TriggerController extends Controller $validated['tips'], ); - return jsonResponseToHis(Response::HTTP_OK, $result, $message); + return jsonResponseToHis(Response::HTTP_OK, (int) $result, $message); } /** @@ -92,24 +92,24 @@ class TriggerController extends Controller 'fee.numeric' => '待缴纳处方费用必须传入数字', 'fee_type.required' => '请传入待缴纳处方类型', 'tips_message.required' => '请传入提示信息', - 'tips.max' => '提示信息长度不得超过20', + 'tips_message.max' => '提示信息长度不得超过20', ]); if ($validated->fails()) { return jsonResponseToHis(Response::HTTP_OK, 1, $validated->errors()->first()); } - $validated = $request->safe()->only(['patient_id', 'dept_name', 'fee', 'fee_type', 'tips_message']); + $validated = $validated->safe()->only(['patient_id', 'dept_name', 'fee', 'fee_type', 'tips_message']); [$result, $message] = $this->trigger_logic->pendingPaymentRemind( $validated['patient_id'], $validated['dept_name'], $validated['fee'], $validated['fee_type'], - $validated['tips'], + $validated['tips_message'], ); - return jsonResponseToHis(Response::HTTP_OK, $result, $message); + return jsonResponseToHis(Response::HTTP_OK, (int) $result, $message); } /** @@ -143,7 +143,7 @@ class TriggerController extends Controller return jsonResponseToHis(Response::HTTP_OK, 1, $validated->errors()->first()); } - $validated = $request->safe()->only(['patient_id', 'report_type', 'item_name', 'report_time', 'report_serial_no', 'dept_name', 'remark']); + $validated = $validated->safe()->only(['patient_id', 'report_type', 'item_name', 'report_time', 'report_serial_no', 'dept_name', 'remark']); [$result, $message] = $this->trigger_logic->reportReleaseRemind( $validated['patient_id'], @@ -155,6 +155,6 @@ class TriggerController extends Controller $validated['remark'] ); - return jsonResponseToHis(Response::HTTP_OK, $result, $message); + return jsonResponseToHis(Response::HTTP_OK, (int) $result, $message); } } diff --git a/app/Http/Logics/Message/TriggerLogic.php b/app/Http/Logics/Message/TriggerLogic.php index 6554a2e..ad2d0dd 100644 --- a/app/Http/Logics/Message/TriggerLogic.php +++ b/app/Http/Logics/Message/TriggerLogic.php @@ -3,12 +3,9 @@ declare(strict_types = 1); namespace App\Http\Logics\Message; -use App\Exceptions\GeneralException; use App\Models\Patient; use App\Utils\Traits\Logger; use App\Utils\Traits\SendSubscribeMessage; -use Illuminate\Http\JsonResponse; -use Symfony\Component\HttpFoundation\Response; class TriggerLogic { @@ -24,7 +21,6 @@ class TriggerLogic $this->patient_model = new Patient(); } - /** * 挂号停诊 * @param string $patient_id diff --git a/app/Http/Logics/Outpatient/RecordLogic.php b/app/Http/Logics/Outpatient/RecordLogic.php index 35158fb..fcec4ad 100644 --- a/app/Http/Logics/Outpatient/RecordLogic.php +++ b/app/Http/Logics/Outpatient/RecordLogic.php @@ -4,13 +4,11 @@ declare(strict_types = 1); namespace App\Http\Logics\Outpatient; use App\Exceptions\GeneralException; -use App\Models\Order; -use App\Models\RegistrationRecord; +use App\Models\Patient; use App\Services\HisHttp\Client; use App\Utils\Traits\Logger; use App\Utils\Traits\MiniProgramAuth; use Illuminate\Auth\AuthenticationException; -use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Redis; use Symfony\Component\HttpFoundation\Response; @@ -19,6 +17,8 @@ class RecordLogic use Logger; use MiniProgramAuth; + private Patient $patient_model; + private Client $his_client; /** @@ -28,23 +28,34 @@ class RecordLogic public function __construct() { $this->authInitialize(); + $this->patient_model = new Patient(); $this->his_client = app('HisHttpService'); } /** - * 获取挂号记录列表 - * @param string $patient_id + * 获取缴费记录列表 + * @param string $patient_number * @param string $start_date * @param string $end_date * @return array * @throws GeneralException */ - public function getRecordLists(string $patient_id, string $start_date, string $end_date): array + public function getRecordLists(string $patient_number, string $start_date, string $end_date): array { + $patient_info = $this->getPatientInfo($this->open_id, $patient_number); + $patient_id = $patient_info->patient_id; + $response = $this->his_client->getPaidLists($patient_id, $start_date, $end_date); - if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') { - throw new GeneralException($response['ERRORMSG'] ?? '暂无相关缴费记录!', Response::HTTP_SERVICE_UNAVAILABLE); + if (!isset($response['success']) || !$response['success']) { + throw new GeneralException($response['msg'] ?? '暂无相关缴费记录!', Response::HTTP_SERVICE_UNAVAILABLE); + } + + // 重写一下patientId + if (!empty($response['response'])) { + foreach ($response['response'] as $k => $v) { + $response['response'][$k]['patientId'] = $patient_number; + } } // 缓存2小时 @@ -53,20 +64,23 @@ class RecordLogic } /** - * 获取挂号记录列表 - * @param string $patient_id + * 获取缴费记录详情 + * @param string $patient_number * @param string $serial_no * @return array * @throws GeneralException */ - public function getRecordDetails(string $patient_id, string $serial_no): array + public function getRecordDetails(string $patient_number, string $serial_no): array { + $patient_info = $this->getPatientInfo($this->open_id, $patient_number); + $patient_id = $patient_info->patient_id; + $this->getCacheRecordInfo($patient_id, $serial_no); $response = $this->his_client->getPaidDetails($serial_no); - if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') { - throw new GeneralException($response['ERRORMSG'] ?? '暂无相关缴费详情!', Response::HTTP_SERVICE_UNAVAILABLE); + if (!isset($response['success']) || !$response['success']) { + throw new GeneralException($response['msg'] ?? '暂无相关缴费详情!', Response::HTTP_SERVICE_UNAVAILABLE); } return $response; @@ -85,14 +99,13 @@ class RecordLogic $record_info = Redis::get($cache_key); if (empty($record_info)) { - throw new GeneralException($response['ERRORMSG'] ?? '查询不到缴费记录,请重新再试!', Response::HTTP_SERVICE_UNAVAILABLE); + throw new GeneralException($response['msg'] ?? '查询不到缴费记录,请重新再试!', Response::HTTP_SERVICE_UNAVAILABLE); } $record_info = json_decode($record_info, true); // 获取具体的缴费详情 - $record_info = xmlArrayToListByKey($record_info, 'RECORD'); - foreach ($record_info['RECORD'] as $v) { - if ($v['RCPTID'] === $serial_no) { + foreach ($record_info['response'] as $v) { + if ($v['payId'] === $serial_no) { $info = $v; break; } @@ -104,4 +117,21 @@ class RecordLogic return $info; } + + /** + * 获取患者信息 + * @param string $open_id + * @param string $patient_number + * @return mixed + * @throws GeneralException + */ + protected function getPatientInfo(string $open_id, string $patient_number): mixed + { + $info = $this->patient_model->getBindPatientInfoByPatientNumber($open_id, $patient_number); + if (empty($info)) { + throw new GeneralException('找不到患者信息,请重新再试!', Response::HTTP_BAD_REQUEST); + } + + return $info; + } } diff --git a/app/Http/Middleware/IntranetAccess.php b/app/Http/Middleware/IntranetAccess.php index 9dc5395..9ee8ac3 100644 --- a/app/Http/Middleware/IntranetAccess.php +++ b/app/Http/Middleware/IntranetAccess.php @@ -16,24 +16,24 @@ class IntranetAccess */ public function handle(Request $request, Closure $next): mixed { - $forwarded = request()->header("x-forwarded-for"); - if($forwarded){ - $ip = explode(',',$forwarded)[0]; - }else{ - $ip = request()->ip(); - } + $forwarded = $request->server("HTTP_X_REAL_IP"); + if(!empty($forwarded)){ + $ip = $forwarded; + }else{ + $ip = $request->ip(); + } - if( - $ip != '::1' && - $ip != '127.0.0.1' && + if( + $ip != '::1' && + $ip != '127.0.0.1' && !str_starts_with($ip, "10.") && !str_starts_with($ip, "172.") && !str_starts_with($ip, "192.") - ) { - return response('Not Found.', 404); - } + ) { + return response('Not Found.', 404); + } - return $next($request); - } + return $next($request); + } } diff --git a/app/Http/Resources/Outpatient/Record/RecordDetailsResource.php b/app/Http/Resources/Outpatient/Record/RecordDetailsResource.php index 761e7f4..4c4f337 100644 --- a/app/Http/Resources/Outpatient/Record/RecordDetailsResource.php +++ b/app/Http/Resources/Outpatient/Record/RecordDetailsResource.php @@ -15,44 +15,44 @@ class RecordDetailsResource extends JsonResource */ public function toArray(Request $request = null): array { + $this->resource = $this->resource['response']; + $info = [ - 'date' => date('Y-m-d H:i:s', strtotime($this->resource['JSRQ'])), - 'receipt_id' => $this->resource['TREAID'], - 'receipt_no' => $this->resource['HOSTRANNO'], - 'total_fee' => (float) $this->resource['COSTS'], - 'self_fee' => (float) $this->resource['GRZF'] ?? 0, - 'reduce_fee' => (float) $this->resource['JJZF'] ?? 0, - 'exec_address' => $this->resource['PHYADDRESS'] ?: '', - 'dept_name' => $this->resource['DEPNAME'], - 'doctor_name' => $this->resource['DOCTNAME'], - 'clinic_diagnosis' => $this->resource['CYZD'], - 'charge_user' => $this->resource['CZGH'], + 'date' => date('Y-m-d', strtotime($this->resource['settlementDate'])), + 'receipt_id' => $this->resource['treaId'], + 'receipt_no' => $this->resource['hostranno'], + 'total_fee' => (float) $this->resource['costs'], + 'self_fee' => (float) $this->resource['expensePay'] ?? 0, + 'reduce_fee' => (float) $this->resource['medicalPayment'] ?? 0, + 'exec_address' => $this->resource['phyAddress'] ?: '', + 'dept_name' => $this->resource['depName'], + 'doctor_name' => $this->resource['doctName'], + 'clinic_diagnosis' => $this->resource['outpatientDiagnosis'], + 'charge_user' => $this->resource['chargeStaff'], ]; - $this->resource['RECORD'] = xmlArrayToListByKey($this->resource['RECORD'], 'ITEMREC'); - - foreach ($this->resource['RECORD']['ITEMREC'] as $v) { + foreach ($this->resource['outpatientDetail']['outpatientItemreList'] as $v) { $info['item_lists'][] = [ - 'visit_date' => $v['VISITDATE'], - 'category_name' => $v['CLASSNAME'], - 'item_name' => $v['ITEMNAME'], - 'spec' => $v['ITEMSPEC'], - 'unit' => $v['UNITS'], - 'quantity' => (int) $v['AMOUNT'], - 'price' => (float) $v['PRICE'], - 'total_price' => (float) $v['COSTS'], + 'visit_date' => $v['visitdate'], + 'category_name' => $v['classname'], + 'item_name' => $v['itemname'], + 'spec' => $v['itemspec'], + 'unit' => $v['units'], + 'quantity' => (int) $v['amount'], + 'price' => (float) $v['arice'], + 'total_price' => (float) $v['costs'], // 冗余字段 - 'package_name' => $v['ZTMC'] ?: '', - 'dose_per_administration' => $v['YCJL'] ?: '', - 'dose_unit' => $v['JLDW'] ?: '', - 'days_of_use' => $v['YYTS'] ?: '', - 'frequency_per_day' => $v['MRCS'] ?: '', - 'dosage_schedule_name' => $v['PCMC'] ?: '', - 'medical_insurance_code' => $v['YPBM'] ?: '', - 'drug_registration_code' => $v['YJBM'] ?: '', - 'medical_insurance_category' => $v['YBFL'] ?: '', - 'employee_name' => $v['YGXM'] ?:'', + 'package_name' => $v['ztmc'] ?: '', + 'dose_per_administration' => $v['ycjl'] ?: '', + 'dose_unit' => $v['jldw'] ?: '', + 'days_of_use' => $v['yyts'] ?: '', + 'frequency_per_day' => $v['mrcs'] ?: '', + 'dosage_schedule_name' => $v['pcmc'] ?: '', + 'medical_insurance_code' => $v['ypbm'] ?: '', + 'drug_registration_code' => $v['yjbm'] ?: '', + 'medical_insurance_category' => $v['ybfl'] ?: '', + 'employee_name' => $v['ygxm'] ?:'', ]; } diff --git a/app/Http/Resources/Outpatient/Record/RecordListsResource.php b/app/Http/Resources/Outpatient/Record/RecordListsResource.php index 057ea60..bd19e56 100644 --- a/app/Http/Resources/Outpatient/Record/RecordListsResource.php +++ b/app/Http/Resources/Outpatient/Record/RecordListsResource.php @@ -15,21 +15,19 @@ class RecordListsResource extends JsonResource */ public function toArray(Request $request = null): array { - $this->resource = xmlArrayToListByKey($this->resource, 'RECORD'); - $lists = []; - foreach ($this->resource['RECORD'] as $v) { + foreach ($this->resource['response'] as $v) { $lists[] = [ - 'patient_id' => $v['PATIENTID'], - 'patient_name' => $v['NAME'], - 'sex' => $v['SEX'], - 'charge_type' => $v['CHARGETYPE'], - 'visit_date' => $v['VISITDATE'], - 'receipt_id' => $v['RCPTID'], - 'receipt_no' => $v['RCPTNO'], - 'total_fee' => (float) $v['COSTS'], - 'self_fee' => (float) $v['GRZF'] ?? 0, - 'reduce_fee' => (float) $v['JJZF'] ?? 0, + 'patient_id' => $v['patientId'], + 'patient_name' => $v['patientName'], + 'sex' => $v['sex'], + 'charge_type' => $v['changeType'], + 'visit_date' => $v['visitDate'], + 'receipt_id' => $v['payId'], + 'receipt_no' => $v['rcpiNo'], + 'total_fee' => (float) $v['costs'], + 'self_fee' => (float) $v['expensePay'] ?? 0, + 'reduce_fee' => (float) ($v['jjzf'] ?? (bcsub($v['costs'], $v['expensePay'], 2))), ]; } diff --git a/app/Models/Admin/Department.php b/app/Models/Admin/Department.php index ddc0bc0..0a15fa1 100644 --- a/app/Models/Admin/Department.php +++ b/app/Models/Admin/Department.php @@ -32,6 +32,8 @@ class Department extends Model 'dept_id', 'dept_name', 'category_id', + 'building_id', + 'dept_location', 'icon', 'introduction', 'sort', @@ -67,4 +69,13 @@ class Department extends Model { return $this->hasMany(Doctor::class, 'dept_id', 'dept_id'); } + + /** + * 获取楼群信息 + * @return BelongsTo + */ + public function buildingDistribution(): BelongsTo + { + return $this->belongsTo(BuildingDistribution::class, 'building_id'); + } } diff --git a/app/Utils/Traits/SendSubscribeMessage.php b/app/Utils/Traits/SendSubscribeMessage.php index 542377d..42f7e4e 100644 --- a/app/Utils/Traits/SendSubscribeMessage.php +++ b/app/Utils/Traits/SendSubscribeMessage.php @@ -216,18 +216,19 @@ trait SendSubscribeMessage public function sendOutpatientPaymentSuccessMessage(OrderModel $order): void { // 重新强关联,避免缓存 -// $order->load('outpatientPaymentRecord'); -// $record = &$order->outpatientPaymentRecord; + $order->load('outpatientPaymentRecord'); + $record = &$order->outpatientPaymentRecord; + $extra_info = json_decode($record->extra_info, true); $subscribe_id = SubscribeId::OUTPATIENT_PAYMENT_SUCCESS; $data = [ 'touser' => $order->open_id, 'template_id' => $subscribe_id->value, 'page' => 'pagesA/outpatient/outPayList', 'data' => [ - 'date5' => ['value' => date('Y-m-d')], 'amount6' => ['value' => ($order->fee / 100). '元'], 'character_string7' => ['value' => $order->order_id], - 'character_string14' => ['value' => $order->patient->patient_number], + 'thing12' => ['value' => $extra_info['confirm_response']['phyAddress']], + 'thing17' => ['value' => $order->patient->patient_number], 'thing9' => ['value' => '门诊缴费'], ], 'miniprogram_state' => config('custom.mini_program_message_state') diff --git a/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php b/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php index 2d6d5ff..237de4d 100644 --- a/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php +++ b/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php @@ -239,7 +239,7 @@ class ClientMockHttpTransfer extends HttpTransferAbstract */ private function mockGetPaidLists(array $params): self { - $this->transfer_response = '{"RESULTCODE":"0","ERRORMSG":"","RECORD":[{"PATIENTID":"D00589351","NAME":"叶子璐","SEX":"女","CHARGETYPE":"自费","VISITDATE":"2012-08-21","RCPTID":"1111","RCPTNO":"90001","COSTS":["250.59","250.59"],"GRZF":"250.59","JJZF":"0","ISPRINTED":"0"},{"PATIENTID":"D00589351","NAME":"叶子璐","SEX":"女","CHARGETYPE":"自费","VISITDATE":"2012-08-21","RCPTID":"1111","RCPTNO":"90002","COSTS":["260.59","260.59"],"GRZF":"260.59","JJZF":"0","ISPRINTED":"0"}]}'; + $this->transfer_response = '{"status":200,"success":true,"msg":"成功","msgDev":null,"response":[{"patientId":"2235574","patientName":"谭玉山","sex":"男","changeType":"自费","visitDate":"2025-02-07","payId":"6497702","rcpiNo":"ZZ00000049","costs":"1","expensePay":"1","isPrinted":"0"}]}'; return $this; } @@ -251,7 +251,7 @@ class ClientMockHttpTransfer extends HttpTransferAbstract */ private function mockGetPaidDetails(array $params): self { - $this->transfer_response = '{"RESULTCODE":"0","ERRORMSG":"","JSRQ":"2021-07-1715:22:31","TREAID":"3324497","HOSTRANNO":"0000986299","COSTS":"65.9","GRZF":"65.9","JJZF":"","PHYADDRESS":"智能药房","DEPNAME":"急诊科","DOCTNAME":"梁锦胜","CYZD":"1.慢性喘息性支气管炎急性发作","CZGH":"818","RECORD":{"ITEMREC":[{"VISITDATE":"2021-07-1715:13:32","CLASSNAME":"西药费","ITEMNAME":"0.9%氯化钠注射液","ITEMSPEC":"100ML","UNITS":"瓶","AMOUNT":"1","PRICE":"2.42","COSTS":"2.42","ZTMC":"","YCJL":"100","JLDW":"ML","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B002","YJBM":"86902763001266","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:14:45","CLASSNAME":"西药费","ITEMNAME":"复方甘草酸苷片","ITEMSPEC":"20mg","UNITS":"瓶","AMOUNT":"1","PRICE":"15.50","COSTS":"15.50","ZTMC":"","YCJL":"100","JLDW":"片","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B003","YJBM":"86902763001267","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:15:02","CLASSNAME":"西药费","ITEMNAME":"头孢克肟胶囊","ITEMSPEC":"250mg","UNITS":"盒","AMOUNT":"1","PRICE":"18.30","COSTS":"18.30","ZTMC":"","YCJL":"100","JLDW":"粒","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B004","YJBM":"86902763001268","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:16:10","CLASSNAME":"西药费","ITEMNAME":"氯氮平片","ITEMSPEC":"25mg","UNITS":"瓶","AMOUNT":"1","PRICE":"22.00","COSTS":"22.00","ZTMC":"","YCJL":"100","JLDW":"片","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B005","YJBM":"86902763001269","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:17:25","CLASSNAME":"西药费","ITEMNAME":"安定片","ITEMSPEC":"5mg","UNITS":"瓶","AMOUNT":"1","PRICE":"13.40","COSTS":"13.40","ZTMC":"","YCJL":"100","JLDW":"片","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B006","YJBM":"86902763001270","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:18:42","CLASSNAME":"西药费","ITEMNAME":"阿莫西林胶囊","ITEMSPEC":"500mg","UNITS":"瓶","AMOUNT":"1","PRICE":"8.00","COSTS":"8.00","ZTMC":"","YCJL":"100","JLDW":"粒","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B007","YJBM":"86902763001271","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:19:10","CLASSNAME":"西药费","ITEMNAME":"双氯芬酸钠胶囊","ITEMSPEC":"50mg","UNITS":"瓶","AMOUNT":"1","PRICE":"16.80","COSTS":"16.80","ZTMC":"","YCJL":"100","JLDW":"粒","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B008","YJBM":"86902763001272","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:19:45","CLASSNAME":"西药费","ITEMNAME":"利血平片","ITEMSPEC":"25mg","UNITS":"瓶","AMOUNT":"1","PRICE":"12.30","COSTS":"12.30","ZTMC":"","YCJL":"100","JLDW":"片","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B009","YJBM":"86902763001273","YBFL":"甲类","YGXM":"梁锦胜"},{"VISITDATE":"2021-07-1715:20:10","CLASSNAME":"西药费","ITEMNAME":"依普利酮片","ITEMSPEC":"25mg","UNITS":"瓶","AMOUNT":"1","PRICE":"30.00","COSTS":"30.00","ZTMC":"","YCJL":"100","JLDW":"片","YYTS":"1","MRCS":"1","PCMC":"QD","YPBM":"X-B05XA-L211-B010","YJBM":"86902763001274","YBFL":"甲类","YGXM":"梁锦胜"}]}}'; + $this->transfer_response = '{"status":200,"success":true,"msg":"成功","msgDev":null,"response":{"settlementDate":"2025-02-07","treaId":"6497702","hostranno":"ZZ00000049","costs":"1","expensePay":"1","medicalPayment":"","phyAddress":"门诊西药房","depName":"急诊内科","doctName":"管理员","outpatientDiagnosis":"1.健康查体","chargeStaff":"20","outpatientDetail":{"outpatientItemreList":[{"visitdate":"2025-02-07","classname":"西药费","itemname":"0.9%氯化钠注射液G","itemspec":"100ML:0.9G/瓶","units":"瓶","amount":"1","arice":"1","costs":"1","ztmc":"","ycjl":"100","jldw":"ML","yyts":"1","mrcs":"1","pcmc":"QD","ypbm":"XB05XAL211B002030902763","yjbm":"86902763001266","ybfl":"甲类","ygxm":"管理员"}]}}}'; return $this; } diff --git a/bootstrap/app.php b/bootstrap/app.php index 3bab3e5..b814166 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -2,6 +2,7 @@ use App\Console\Commands\SendAppointmentReminders; use App\Exceptions\GeneralException; +use App\Http\Middleware\IntranetAccess; use App\Http\Middleware\RecordApiLog; use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Application; @@ -24,7 +25,8 @@ return Application::configure(basePath: dirname(__DIR__)) ->withMiddleware(function (Middleware $middleware) { $middleware->alias([ - 'apiLog' => RecordApiLog::class + 'apiLog' => RecordApiLog::class, + 'intranetAccess' => IntranetAccess::class ]); }) ->withExceptions(function (Exceptions $exceptions) { diff --git a/composer.json b/composer.json index 19e3cad..8b2b77c 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "ext-simplexml": "*", "ext-soap": "*", "ext-http": "*", + "ext-bcmath": "*", "laravel/framework": "^11.31", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", diff --git a/routes/api.php b/routes/api.php index 073a01e..b86c1e1 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,6 +2,7 @@ use App\Http\Controllers\Auth\AuthController; use App\Http\Controllers\Hospital\IntroduceController; +use App\Http\Controllers\Message\TriggerController; use App\Http\Controllers\Notify\NotifyController; use App\Http\Controllers\Outpatient\PaymentController; use App\Http\Controllers\Outpatient\PendingController; @@ -93,4 +94,10 @@ Route::middleware(['apiLog'])->group(function() { Route::get('/building', [IntroduceController::class, 'buildingDetails']); }); + // 触发推送消息 + Route::middleware(['intranetAccess'])->prefix('Message')->group(function () { + Route::post('/reg_stop', [TriggerController::class, 'registerStopRemind']); + Route::post('/pending', [TriggerController::class, 'pendingPaymentRemind']); + Route::post('/report', [TriggerController::class, 'reportReleaseRemind']); + }); });