package com.ynxbd.common.action.healthcard; import com.alibaba.fastjson.JSONObject; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.config.healthcard.HCAIGuidanceConfig; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.service.AIGuidanceService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 智能导诊 * * @Author wsq * @Date 2021/2/26 12:50 * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved. */ @Slf4j @Namespace("/aiGuidance") public class AIGuidanceAction extends BaseAction { /** * 4.1.1 查询平台所有医院列表信息(必选) */ @Action("getAllHospInfo") public Result getAllHospInfo() { if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } List> resultList = new ArrayList<>(); Map resultMap = new HashMap<>(); resultMap.put("hosId", HCAIGuidanceConfig.HOSP_ID); resultMap.put("hosName", HCAIGuidanceConfig.HOSP_NAME); resultList.add(resultMap); return Result.success(ResultEnum.AI_SUCCESS, resultList); } /** * 4.1.2 查询医院详细信息(必选) */ @Action("getHospDetail") public Result getHospDetail(String hosId) { JSONObject body = getBody(); if (ObjectUtils.isEmpty(hosId)) { hosId = body.getString("hosId"); } if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getHospDetail(hosId); } /** * 4.1.3 查询科室信息(必选) */ @Action("getDeptList") public Result getDeptList(String hosId, String branchId) { JSONObject body = getBody(); if (ObjectUtils.isEmpty(hosId)) { hosId = body.getString("hosId"); } if (ObjectUtils.isEmpty(branchId)) { branchId = body.getString("branchId"); } if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getDeptList(hosId, branchId); } /** * 4.1.4 查询医生信息(必选) */ @Action("getDoctorList") public Result getDoctorList(String hosId, String branchId, String deptId) { JSONObject body = getBody(); if (ObjectUtils.isEmpty(hosId)) { hosId = body.getString("hosId"); } if (ObjectUtils.isEmpty(branchId)) { branchId = body.getString("branchId"); } if (ObjectUtils.isEmpty(deptId)) { deptId = body.getString("deptId"); } if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getDoctorList(hosId, branchId, deptId); } /** * 4.1.5 查询就诊人列表(必选) */ @Action("getPatientCardList") public Result getPatientCardList(String hosId, String branchId, String deptId) { JSONObject body = getBody(); if (ObjectUtils.isEmpty(hosId)) { hosId = body.getString("hosId"); } if (ObjectUtils.isEmpty(branchId)) { branchId = body.getString("branchId"); } if (ObjectUtils.isEmpty(deptId)) { deptId = body.getString("deptId"); } if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getPatientCardList(hosId, branchId, deptId); } /** * 4.1.9 获取医生号源排班信息(必选) */ @Action("getDoctorSchedule") public Result getDoctorSchedule() { JSONObject body = getBody(); String hosId = body.getString("hosId"); String branchId = body.getString("branchId"); String doctors = body.getString("doctors"); log.info("[获取医生号源排班信息]hosId={}, branchId={}, doctors={}", hosId, branchId, doctors); if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getDoctorSchedule(hosId, branchId, doctors); } /** * 4.2.1.1 查询医院的首页服务列表(必选) */ @Action("getHospitalHomeService") public Result getHospitalHomeService() { JSONObject body = getBody(); String hosId = body.getString("hosId"); log.info("[查询医院的首页服务列表]hosId={}", hosId); if (!HCAIGuidanceConfig.IS_DEBUG && !HCAIGuidanceConfig.isVerifySign(request)) { return Result.error(ResultEnum.SIGN_ERROR); // 签名异常 } return new AIGuidanceService().getHospitalHomeService(hosId); } /** * 跳转重定向 */ @Action("getSchedule") public Result getSchedule(String id) { if (ObjectUtils.isEmpty(id)) { return Result.redirect("test02/test02"); } return Result.redirect("https://www.baidu.com"); } }