diff --git a/app/Http/Controllers/Hospital/IntroduceController.php b/app/Http/Controllers/Hospital/IntroduceController.php index 3ded115..d945b0d 100644 --- a/app/Http/Controllers/Hospital/IntroduceController.php +++ b/app/Http/Controllers/Hospital/IntroduceController.php @@ -6,10 +6,14 @@ namespace App\Http\Controllers\Hospital; use App\Exceptions\GeneralException; use App\Http\Controllers\Controller; -use App\Models\Department; -use App\Models\DepartmentCategory; -use App\Models\Doctor; -use App\Models\Navigation; +use App\Models\Admin\BuildingDistribution; +use App\Models\Admin\Department; +use App\Models\Admin\DepartmentCategory; +use App\Models\Admin\Doctor; +use App\Models\Admin\HealthLecture; +use App\Models\Admin\Info; +use App\Models\Admin\Navigation; +use App\Models\Admin\News; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Symfony\Component\HttpFoundation\Response; @@ -80,30 +84,19 @@ class IntroduceController extends Controller */ public function doctorLists(): JsonResponse { - $doctor_lists = Doctor::select( - 'doctors.dept_id', - 'departments.dept_name', - 'doctors.doctor_id', - 'doctors.doctor_name', - 'doctors.doctor_title', - 'doctors.doctor_specialty', - 'doctors.avatar as doctor_avatar', - 'doctors.is_expert', - 'doctors.sort', - ) - ->join('departments', 'doctors.dept_id', '=', 'departments.dept_id') - ->where('doctors.is_enable', 1) - ->orderBy('doctors.sort', 'DESC') - ->orderBy('doctors.is_expert', 'DESC') - ->orderBy('doctors.id', 'ASC') - ->get() - ->toArray(); + $doctor_lists = Doctor::select('dept_id', 'doctor_id', 'doctor_name', 'doctor_title', 'doctor_specialty', 'avatar as doctor_avatar', 'is_expert', 'sort',) + ->where('is_enable', 1) + ->orderBy('is_expert', 'DESC') + ->orderBy('sort', 'DESC') + ->orderBy('id', 'ASC') + ->get(); foreach ($doctor_lists as $k => $v) { - $doctor_lists[$k]['doctor_avatar'] = $v['doctor_avatar'] ?: ''; + $doctor_lists[$k]['dept_name'] = $v->department->dept_name ?? ''; + $doctor_lists[$k]['doctor_avatar'] = getAdminUploadImageUrl($v['doctor_avatar']); } - return jsonResponse(Response::HTTP_OK, 'success.', $doctor_lists); + return jsonResponse(Response::HTTP_OK, 'success.', $doctor_lists->toArray()); } /** @@ -130,7 +123,7 @@ class IntroduceController extends Controller 'doctor_name' => $doctor_details->doctor_name, 'doctor_title' => $doctor_details->doctor_title, 'doctor_specialty' => $doctor_details->doctor_specialty, - 'avatar' => $doctor_details->avatar ?: '', + 'avatar' => getAdminUploadImageUrl($doctor_details->avatar), 'introduction' => $doctor_details->introduction ?: '', 'is_expert' => $doctor_details->is_expert, ]; @@ -138,6 +131,33 @@ class IntroduceController extends Controller return jsonResponse(Response::HTTP_OK, 'success.', $details); } + /** + * 医院简介 + * @return JsonResponse + * @throws GeneralException + */ + public function info(): JsonResponse + { + $info = Info::find(1); + + if (empty($info)) { + throw new GeneralException('找不到医院信息'); + } + + $info = [ + 'name' => $info->name, + 'level' => $info->level ?: '', + 'address' => $info->address ?: '', + 'telephone' => $info->telephone ?: '', + 'email' => $info->email ?: '', + 'logo' => getAdminUploadImageUrl($info->logo), + 'website' => $info->website ?: '', + 'description' => !empty($info['description']) ? html_entity_decode($info['description']) : '' + ]; + + return jsonResponse(Response::HTTP_OK, 'success.', $info); + } + /** * 获取医院导航信息 * @throws GeneralException @@ -145,7 +165,7 @@ class IntroduceController extends Controller public function navigationDetails(Request $request): JsonResponse { $navigation_details = Navigation::select('area_id', 'area_name', 'longitude', 'latitude', 'address', 'telephone', 'traffic', 'guide') - ->where('area_id', 1) + ->where('area_id', '01') ->where('is_enable', 1) ->first(); @@ -157,7 +177,124 @@ class IntroduceController extends Controller $details['traffic'] = !empty($details['traffic']) ? html_entity_decode($details['traffic']) : ''; $details['guide'] = !empty($details['guide']) ? html_entity_decode($details['guide']) : ''; + return jsonResponse(Response::HTTP_OK, 'success.', $details); + } + + /** + * 获取新闻动态列表 + * @throws GeneralException + */ + public function newLists(Request $request): JsonResponse + { + $new_lists = News::select('title', 'image', 'sort', 'published_at') + ->where('is_display', 1) + ->where('published_at', '<=', date('Y-m-d H:i:s')) + ->orderBy('sort', 'DESC') + ->orderBy('id', 'DESC') + ->get() + ->toArray(); + + if (empty($new_lists)) { + throw new GeneralException('找不到新闻动态'); + } + + foreach ($new_lists as $v) { + $v['image'] = getAdminUploadImageUrl($v['image']); + } + + return jsonResponse(Response::HTTP_OK, 'success.', $new_lists); + } + + /** + * 获取新闻动态详情 + * @param Request $request + * @param int $new_id + * @return JsonResponse + * @throws GeneralException + */ + public function newDetails(Request $request, int $new_id): JsonResponse + { + $details = News::select('title', 'image', 'sort', 'published_at', 'content') + ->where('id', $new_id) + ->where('is_display', 1) + ->where('published_at', '<=', date('Y-m-d H:i:s')) + ->first() + ->toArray(); + + if (empty($details)) { + throw new GeneralException('找不到该新闻动态信息'); + } + + $details['image'] = getAdminUploadImageUrl($details['image']); + $details['content'] = !empty($details['content']) ? html_entity_decode($details['content']) : ''; + + return jsonResponse(Response::HTTP_OK, 'success.', $details); + } + + /** + * 获取宣讲列表 + * @throws GeneralException + */ + public function healthLectureLists(Request $request): JsonResponse + { + $lecture_lists = HealthLecture::select('title', 'speaker', 'lecture_date', 'sort') + ->where('is_display', 1) + ->orderBy('sort', 'DESC') + ->orderBy('lecture_date', 'DESC') + ->orderBy('id', 'DESC') + ->get() + ->toArray(); + + if (empty($lecture_lists)) { + throw new GeneralException('找不到健康宣讲内容'); + } + + return jsonResponse(Response::HTTP_OK, 'success.', $lecture_lists); + } + + /** + * 获取宣讲详情 + * @param Request $request + * @param int $lecture_id + * @return JsonResponse + * @throws GeneralException + */ + public function healthLectureDetails(Request $request, int $lecture_id): JsonResponse + { + $details = HealthLecture::select('title', 'speaker', 'lecture_date', 'sort', 'content') + ->where('id', $lecture_id) + ->where('is_display', 1) + ->first() + ->toArray(); + + if (empty($details)) { + throw new GeneralException('找不到该新闻动态信息'); + } + + $details['content'] = !empty($details['content']) ? html_entity_decode($details['content']) : ''; return jsonResponse(Response::HTTP_OK, 'success.', $details); } + + /** + * 获取医院楼群信息 + * @throws GeneralException + */ + public function buildingDetails(Request $request): JsonResponse + { + $building_lists = BuildingDistribution::select('name', 'description', 'image', 'sort') + ->where('is_display', 1) + ->get() + ->toArray(); + + if (empty($building_lists)) { + throw new GeneralException('找不到医院楼群信息'); + } + + foreach ($building_lists as $k => $v) { + $building_lists[$k]['image'] = getAdminUploadImageUrl($v['image']); + } + + return jsonResponse(Response::HTTP_OK, 'success.', $building_lists); + } } diff --git a/app/Http/Logics/Outpatient/RecordLogic.php b/app/Http/Logics/Outpatient/RecordLogic.php index 64f50c0..610ae2e 100644 --- a/app/Http/Logics/Outpatient/RecordLogic.php +++ b/app/Http/Logics/Outpatient/RecordLogic.php @@ -43,7 +43,7 @@ class RecordLogic $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); + throw new GeneralException($response['ERRORMSG'] ?? '暂无相关缴费记录!', Response::HTTP_SERVICE_UNAVAILABLE); } // 缓存2小时 diff --git a/app/Http/Logics/Patient/PatientLogic.php b/app/Http/Logics/Patient/PatientLogic.php index cced0d8..4bbea78 100644 --- a/app/Http/Logics/Patient/PatientLogic.php +++ b/app/Http/Logics/Patient/PatientLogic.php @@ -5,12 +5,8 @@ namespace App\Http\Logics\Patient; use App\Dictionary\Patient\CardType; use App\Dictionary\Patient\Sex; -use App\Dictionary\SendMessage\Type; -use App\Dictionary\WeChat\MiniProgram\SubscribeId; use App\Exceptions\GeneralException; -use App\Jobs\SendWeChatMessageJob; use App\Models\Patient; -use App\Models\SendMessageJob; use App\Services\HisHttp\Client; use App\Utils\Traits\Logger; use App\Utils\Traits\MiniProgramAuth; @@ -141,7 +137,7 @@ class PatientLogic $sex, $birthday, $data['card_no'], - $data['mobile_phone'], + $data['phone'], $data['address'] ); $this->info('建档患者:'. $data['name']. '建档结果', $response); @@ -167,7 +163,7 @@ class PatientLogic throw new GeneralException('数据保存失败,请重试!', Response::HTTP_INTERNAL_SERVER_ERROR); } - $this->sendBindPatientSubscribeMessage($result->id, $result->id, $data['name']); + $this->sendBindPatientSubscribeMessage($this->open_id, $result->id, $data['name']); return $patient_id; } @@ -198,11 +194,11 @@ class PatientLogic } $patient_info = &$response['response']; - $patient_id = &$patient_info['response']['patientId']; - $patient_number = &$patient_info['response']['patientNumber']; - $sex = Sex::from((int) $patient_info['SEX']); + $patient_id = &$patient_info['patientId']; + $patient_number = &$patient_info['patientNumber']; + $sex = Sex::from((int) $patient_info['sex']); - if ($patient_info['patientNumber'] != $data['patient_number']) { + if ($patient_info['patientNumber'] != $data['patient_id']) { throw new GeneralException('该证件号已建档,但就诊卡号不匹配!'); } diff --git a/app/Http/Logics/Registration/RecordLogic.php b/app/Http/Logics/Registration/RecordLogic.php index bc0e1e6..7c201f3 100644 --- a/app/Http/Logics/Registration/RecordLogic.php +++ b/app/Http/Logics/Registration/RecordLogic.php @@ -62,8 +62,15 @@ class RecordLogic $response = $this->his_client->getRegisterRecordLists($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小时 @@ -87,14 +94,14 @@ class RecordLogic $record_info = Cache::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, 'ITEM'); - foreach ($record_info['ITEM'] as $v) { - if ($v['VISITNO'] === $reg_serial_no) { + foreach ($record_info['response'] as $v) { + if ($v['visitNo'] === $reg_serial_no) { $info = $v; break; } @@ -122,22 +129,23 @@ class RecordLogic $response = $this->his_client->checkRefundRegisterStatus($reg_serial_no); $this->info('检查是否可进行退号', $response); - if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') { - throw new GeneralException($response['ERRORMSG'] ?? '当前挂号记录不可退号!', Response::HTTP_BAD_REQUEST); + if (!isset($response['success']) || !$response['success']) { + throw new GeneralException($response['msg'] ?? '当前挂号记录不可退号!', Response::HTTP_BAD_REQUEST); } // 开始退号 $response = $this->his_client->refundRegister($reg_serial_no, $order_id, date('Y-m-d'), date('H:i:s'), (string) ($fee / 100)); $this->info('退号结果', $response); - if (!isset($response['RESULTCODE']) || $response['RESULTCODE'] !== '0') { - throw new GeneralException($response['ERRORMSG'] ?? '退号失败,请重新再试!', Response::HTTP_BAD_REQUEST); + if (!isset($response['success']) || !$response['success']) { + throw new GeneralException($response['msg'] ?? '退号失败,请重新再试!', Response::HTTP_BAD_REQUEST); } // 创建退款单 $refund_order_id = $this->order_model->getRefundOrderId($order_id); $refund_order_info = $this->order_model->createRefundOReverseOrder( $order_info->id, + $patient_info->id, $refund_order_id, PayType::from($order_info->pay_type), $fee, @@ -150,7 +158,7 @@ class RecordLogic $this->info('创建退款订单', ['id' => $refund_order_info->id]); if (empty($refund_order_info)) { - throw new GeneralException($response['ERRORMSG'] ?? '退号成功,退费失败,请重新再试!', Response::HTTP_BAD_REQUEST); + throw new GeneralException($response['msg'] ?? '退号成功,退费失败,请重新再试!', Response::HTTP_BAD_REQUEST); } // 退款 diff --git a/app/Http/Requests/Patient/CreatePatientRequest.php b/app/Http/Requests/Patient/CreatePatientRequest.php index c0df7d8..5d91779 100644 --- a/app/Http/Requests/Patient/CreatePatientRequest.php +++ b/app/Http/Requests/Patient/CreatePatientRequest.php @@ -60,8 +60,8 @@ class CreatePatientRequest extends FormRequest $fail('联系号码格式错误'); } }], - 'birthday' => 'required|date_format:Y-m-d', - 'sex' => 'required|in:1,2', + 'birthday' => 'date_format:Y-m-d', + 'sex' => 'in:1,2', // 'nation' => 'max:50', 'address' => 'required|max:100' ]; diff --git a/app/Http/Resources/Dictionary/ItemListsResource.php b/app/Http/Resources/Dictionary/ItemListsResource.php index 89ba78d..cee1297 100644 --- a/app/Http/Resources/Dictionary/ItemListsResource.php +++ b/app/Http/Resources/Dictionary/ItemListsResource.php @@ -15,10 +15,10 @@ class ItemListsResource extends JsonResource public function toArray(Request $request = null): array { $lists = []; - foreach ($this->resource['ITEM'] as $v) { + foreach ($this->resource['response'] as $v) { $lists[] = [ - 'type_id' => (int) $v['TYPEID'], - 'type_name' => $v['TYPENAME'], + 'type_id' => (int) $v['typeId'], + 'type_name' => $v['typeName'], ]; } diff --git a/app/Http/Resources/Registration/Record/RecordListsResource.php b/app/Http/Resources/Registration/Record/RecordListsResource.php index 9d66f29..3ca756e 100644 --- a/app/Http/Resources/Registration/Record/RecordListsResource.php +++ b/app/Http/Resources/Registration/Record/RecordListsResource.php @@ -14,28 +14,27 @@ class RecordListsResource extends JsonResource */ public function toArray(Request $request = null): array { - $this->resource = xmlArrayToListByKey($this->resource, 'ITEM'); - $lists = []; - foreach ($this->resource['ITEM'] as $v) { + foreach ($this->resource['response'] as $v) { $lists[] = [ - 'reg_serial_no' => $v['VISITNO'], - 'reg_type' => $v['FTYPE'], - 'reg_date' => $v['GHDATE'], - 'patient_id' => $v['PATIENTID'], - 'patient_name' => $v['PATIENTNAME'], - 'dept_id' => $v['DEPID'], - 'dept_name' => $v['DEPNAME'], - 'rank_id' => $v['RANKID'], - 'rank_name' => $v['RANKNAME'] ?? '', - 'start_time' => $v['STARTTIME'] ?? '', - 'end_time' => $v['ENDTIME'] ?? '', - 'dept_location' => $v['DEPLOCATION'], - 'reg_fee' => $v['PAYFEE'], - 'trea_id' => $v['TREAID'], - 'tran_snum' => $v['TRANSNUM'], - 'wait_no' => $v['WAITNUM'], - 'reg_status' => $v['STATUS'], + 'reg_serial_no' => $v['visitNo'], + 'reg_type' => $v['registrationType'], + 'reg_date' => $v['registrationDate'], + 'patient_id' => $v['patientId'], + 'patient_name' => $v['patientName'], + 'dept_id' => $v['depId'], + 'dept_name' => $v['depName'], + 'rank_id' => $v['rankId'], + 'rank_name' => $v['rankName'] ?? '', + 'start_time' => $v['startTime'] ?? '', + 'end_time' => $v['endTime'] ?? '', + 'dept_location' => $v['depLocation'], + 'reg_fee' => $v['payFee'], + 'trea_id' => $v['treaId'], + 'tran_snum' => $v['transNum'] ?: '', + 'wait_no' => $v['waitNum'] ?: '', + 'oppat_no' => $v['oppatNo'] ?: '', + 'reg_status' => $v['status'], ]; } diff --git a/app/Http/Resources/Registration/Schedule/DeptListsResource.php b/app/Http/Resources/Registration/Schedule/DeptListsResource.php index 203e4d4..2595ba2 100644 --- a/app/Http/Resources/Registration/Schedule/DeptListsResource.php +++ b/app/Http/Resources/Registration/Schedule/DeptListsResource.php @@ -2,13 +2,11 @@ namespace App\Http\Resources\Registration\Schedule; -use App\Models\Department; -use App\Models\DepartmentCategory; +use App\Models\Admin\Department; +use App\Models\Admin\DepartmentCategory; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Redis; -use mysql_xdevapi\Collection; class DeptListsResource extends JsonResource { @@ -21,10 +19,10 @@ class DeptListsResource extends JsonResource { // 科室分类 $categories = $this->getDepartmentCategoryLists(); - // 科室及排序 $departments = $this->getDepartmentLists(); $sorts = collect($departments)->pluck('sort', 'dept_id')->toArray(); + // 根据科室的 sort 字段对 科室列表 进行排序 usort($this->resource['response'], function ($a, $b) use ($sorts) { $sort_a = $sorts[$a['typeId']] ?? 0; @@ -62,7 +60,7 @@ class DeptListsResource extends JsonResource ->orderBy('id', 'ASC') ->get(); - $category_lists = $category_lists->keyBy('category_id')->map(function ($value) { return (array)$value; })->toArray(); + $category_lists = $category_lists->keyBy('category_id')->map(function ($value) { return $value->toArray(); })->toArray(); Redis::setex('department.category', 4 * 3600, json_encode($category_lists, JSON_UNESCAPED_UNICODE)); } @@ -84,7 +82,7 @@ class DeptListsResource extends JsonResource ->orderBy('id', 'ASC') ->get(); - $department_lists = $department_lists->keyBy('dept_id')->map(function ($value) { return (array)$value; })->toArray(); + $department_lists = $department_lists->keyBy('dept_id')->map(function ($value) { return $value->toArray(); })->toArray(); Redis::setex('department.lists', 4 * 3600, json_encode($department_lists, JSON_UNESCAPED_UNICODE)); } diff --git a/app/Http/Resources/Registration/Schedule/DoctorListsResource.php b/app/Http/Resources/Registration/Schedule/DoctorListsResource.php index 369ca37..850f2b9 100644 --- a/app/Http/Resources/Registration/Schedule/DoctorListsResource.php +++ b/app/Http/Resources/Registration/Schedule/DoctorListsResource.php @@ -2,10 +2,9 @@ namespace App\Http\Resources\Registration\Schedule; -use App\Models\Doctor; +use App\Models\Admin\Doctor; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Redis; class DoctorListsResource extends JsonResource diff --git a/app/Models/Admin/BuildingDistribution.php b/app/Models/Admin/BuildingDistribution.php new file mode 100644 index 0000000..dd356cb --- /dev/null +++ b/app/Models/Admin/BuildingDistribution.php @@ -0,0 +1,48 @@ + + */ + protected $fillable = [ + 'area_id', + 'name', + 'description', + 'image', + 'sort', + 'is_display', + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'area_id' => 'integer', + 'sort' => 'integer', + 'is_display' => 'integer', + ]; +} diff --git a/app/Models/Department.php b/app/Models/Admin/Department.php similarity index 97% rename from app/Models/Department.php rename to app/Models/Admin/Department.php index 77cd355..ddc0bc0 100644 --- a/app/Models/Department.php +++ b/app/Models/Admin/Department.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace App\Models\Admin; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; diff --git a/app/Models/DepartmentCategory.php b/app/Models/Admin/DepartmentCategory.php similarity index 97% rename from app/Models/DepartmentCategory.php rename to app/Models/Admin/DepartmentCategory.php index 9fdc168..7138e9a 100644 --- a/app/Models/DepartmentCategory.php +++ b/app/Models/Admin/DepartmentCategory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace App\Models\Admin; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; diff --git a/app/Models/DepartmentTip.php b/app/Models/Admin/DepartmentTip.php similarity index 97% rename from app/Models/DepartmentTip.php rename to app/Models/Admin/DepartmentTip.php index 65b90c2..3248e6f 100644 --- a/app/Models/DepartmentTip.php +++ b/app/Models/Admin/DepartmentTip.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace App\Models\Admin; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; diff --git a/app/Models/Doctor.php b/app/Models/Admin/Doctor.php similarity index 97% rename from app/Models/Doctor.php rename to app/Models/Admin/Doctor.php index e0214db..2b020ee 100644 --- a/app/Models/Doctor.php +++ b/app/Models/Admin/Doctor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Models; +namespace App\Models\Admin; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; diff --git a/app/Models/Admin/HealthLecture.php b/app/Models/Admin/HealthLecture.php new file mode 100644 index 0000000..82101cf --- /dev/null +++ b/app/Models/Admin/HealthLecture.php @@ -0,0 +1,49 @@ + + */ + protected $fillable = [ + 'title', + 'speaker', + 'lecture_date', + 'content', + 'sort', + 'is_display', + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'id' => 'integer', + 'sort' => 'integer', + 'is_display' => 'integer', + ]; + +} diff --git a/app/Models/Admin/Info.php b/app/Models/Admin/Info.php new file mode 100644 index 0000000..4165916 --- /dev/null +++ b/app/Models/Admin/Info.php @@ -0,0 +1,49 @@ + + */ + protected $fillable = [ + 'name', + 'level', + 'address', + 'telephone', + 'email', + 'logo', + 'website', + 'description' + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'id' => 'integer', + ]; + +} diff --git a/app/Models/Navigation.php b/app/Models/Admin/Navigation.php similarity index 92% rename from app/Models/Navigation.php rename to app/Models/Admin/Navigation.php index 3f090fd..d5ec65a 100644 --- a/app/Models/Navigation.php +++ b/app/Models/Admin/Navigation.php @@ -2,11 +2,10 @@ declare(strict_types=1); -namespace App\Models; +namespace App\Models\Admin; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; class Navigation extends Model { diff --git a/app/Models/Admin/News.php b/app/Models/Admin/News.php new file mode 100644 index 0000000..90f17c3 --- /dev/null +++ b/app/Models/Admin/News.php @@ -0,0 +1,49 @@ + + */ + protected $fillable = [ + 'title', + 'image', + 'sort', + 'is_display', + 'content', + 'published_at', + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'id' => 'integer', + 'sort' => 'integer', + 'is_display' => 'integer', + ]; + +} diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php index 9cbc52d..ffd994b 100644 --- a/app/Utils/Helpers.php +++ b/app/Utils/Helpers.php @@ -260,7 +260,6 @@ if (!function_exists('getBirthdayByIdCard')) } } - if (!function_exists('getBirthdayBy2017ForeignersIDCard')) { /** @@ -792,3 +791,19 @@ if (!function_exists('replaceSpecialChar')) { return preg_replace($regex, '', $string); } } + +if (!function_exists('getAdminUploadImageUrl')) { + /** + * 获取admin后台image地址 + * @param string $image + * @return string + */ + function getAdminUploadImageUrl(string $image): string + { + if (empty($image)) { + return ''; + } + + return (string) url('/images/uploads/'. $image); + } +} diff --git a/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php b/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php index ee57f62..0270dd8 100644 --- a/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php +++ b/app/Utils/Transfer/HisHttpClient/ClientMockHttpTransfer.php @@ -110,7 +110,7 @@ class ClientMockHttpTransfer extends HttpTransferAbstract */ private function mockGetPatientInfo(array $params): self { - $this->transfer_response = '{"status":200,"success":true,"msg":"成功","msgDev":null,"response":{"patientId":"2235574","cardNo":"230403199903245493","name":"谭玉山","sex":"0","birthday":"1999-03-24","cardStatus":"0","naturePatients":"123","patientNumber":"288712335574"}}'; + $this->transfer_response = '{"status":200,"success":true,"msg":"成功","msgDev":null,"response":{"patientId":"2235574","cardNo":"230403199903245493","name":"谭玉山","sex":"1","birthday":"1999-03-24","cardStatus":"0","naturePatients":"123","patientNumber":"288712335574"}}'; return $this; } @@ -155,7 +155,7 @@ class ClientMockHttpTransfer extends HttpTransferAbstract */ private function mockGetRegisterRecordLists(array $params): self { - $this->transfer_response = '0成功3405227当天挂号01436002400029682021-07-171103903杨尧2下午600005001000门诊一楼0线上预约1716急诊科3405228预约挂号1586002400029692021-07-181103904李梅1上午600005001001门诊二楼1现场挂号2520内科3405229当天挂号0236002400029702021-07-191103905张强3夜间600005001002急诊大厅2电话预约3018儿科3405230预约挂号1786002400029712021-07-201103906王丽1上午600005001003门诊三楼0线上预约4522眼科'; + $this->transfer_response = '{"status":200,"success":true,"msg":"成功","msgDev":null,"response":[{"visitNo":"5348615","registrationType":"当天挂号","status":"0","waitNum":null,"treaId":"1-3","registrationDate":"2025-01-17","patientId":"2235574","patientName":"谭玉山","rankId":"2","rankName":"下午","startTime":"16:30","endTime":"17:00","oppatNo":"288712335574","depLocation":"请到一楼儿童保健门诊","transNum":null,"orderType":"","payFee":"0","payId":null,"depId":"12","depName":"儿保门诊","doctorId":"10977","doctorName":"杜丽丽","regSource":"自助机","timeSpam":"下午:16:30-17:00","serialNumber":null}]}'; return $this; } diff --git a/routes/api.php b/routes/api.php index cfb4c5e..c925b34 100644 --- a/routes/api.php +++ b/routes/api.php @@ -58,19 +58,32 @@ Route::middleware(['apiLog'])->group(function() { Route::get('/', [ItemController::class, 'lists']); Route::get('/{type_id}', [ItemController::class, 'details'])->where('type_id', '[0-9]+'); }); + }); - // 医院详情相关项目 - Route::prefix('Hospital')->group(function () { - // 科室介绍 - Route::get('/dept', [IntroduceController::class, 'deptLists']); - Route::get('/dept/{dept_id}', [IntroduceController::class, 'deptDetails'])->where('dept_id', '[0-9]+'); + // 医院详情相关项目 + Route::middleware([])->prefix('Hospital')->group(function () { + // 科室介绍 + Route::get('/dept', [IntroduceController::class, 'deptLists']); + Route::get('/dept/{dept_id}', [IntroduceController::class, 'deptDetails'])->where('dept_id', '[0-9]+'); - // 医生介绍 - Route::get('/doctor', [IntroduceController::class, 'doctorLists']); - Route::get('/doctor/{doctor_id}', [IntroduceController::class, 'doctorDetails'])->where('doctor_id', '[0-9]+'); + // 医生介绍 + Route::get('/doctor', [IntroduceController::class, 'doctorLists']); + Route::get('/doctor/{doctor_id}', [IntroduceController::class, 'doctorDetails'])->where('doctor_id', '[0-9]+'); - // 医院导航 - Route::get('/navigation', [IntroduceController::class, 'navigationDetails']); - }); + // 医院导航 + Route::get('/navigation', [IntroduceController::class, 'navigationDetails']); + Route::get('/info', [IntroduceController::class, 'info']); + + // 新闻动态 + Route::get('/news', [IntroduceController::class, 'newLists']); + Route::get('/news/{new_id}', [IntroduceController::class, 'newDetails'])->where('new_id', '[0-9]+'); + + // 健康宣讲 + Route::get('/lectures', [IntroduceController::class, 'healthLectureLists']); + Route::get('/lectures/{lecture_id}', [IntroduceController::class, 'healthLectureDetails'])->where('lecture_id', '[0-9]+'); + + // 楼群分布 + Route::get('/building', [IntroduceController::class, 'buildingDetails']); }); + });