Merge branch 'dev' of http://192.168.2.240:7070/r/kidgrow-microservices-platform into dev
Conflicts:
kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysUserServiceImpl.java
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | /** |
| | | * 根据条件查询 |
| | | * @param file |
| | | * @param imgType 文件类型:X光片/医院Logo[Xray/Logo] |
| | | */ |
| | | @PostMapping(value = "/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | FileInfo feignUpload(@RequestPart("file") MultipartFile file); |
| | | |
| | | FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam("imgType") String imgType); |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | @Override |
| | | public FileInfo feignUpload(@RequestPart("file") MultipartFile file) { |
| | | public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) { |
| | | return null; |
| | | } |
| | | }; |
| | |
| | | * 是否图片 |
| | | */ |
| | | private Boolean isImg; |
| | | |
| | | /** |
| | | * 图片类型 |
| | | * Xray还是logo |
| | | */ |
| | | @TableField(exist = false) |
| | | private String imgType; |
| | | /** |
| | | * 上传文件类型 |
| | | */ |
| | |
| | | public interface IFileService extends IService<FileInfo> { |
| | | FileInfo upload(MultipartFile file ) throws Exception; |
| | | |
| | | FileInfo upload(MultipartFile file ,String imgType) throws Exception; |
| | | |
| | | PageResult<FileInfo> findList(Map<String, Object> params); |
| | | |
| | | void delete(String id); |
| | |
| | | return fileInfo; |
| | | } |
| | | |
| | | @Override |
| | | public FileInfo upload(MultipartFile file,String imgType) throws Exception { |
| | | FileInfo fileInfo = FileUtil.getFileInfo(file); |
| | | FileInfo oldFileInfo = baseMapper.selectById(fileInfo.getId()); |
| | | if (oldFileInfo != null) { |
| | | return oldFileInfo; |
| | | } |
| | | if (!fileInfo.getName().contains(FILE_SPLIT)) { |
| | | throw new IllegalArgumentException("缺少后缀名"); |
| | | } |
| | | fileInfo.setImgType(imgType); // X光片或者Logo |
| | | uploadFile(file, fileInfo); |
| | | // 设置文件来源 |
| | | fileInfo.setSource(fileType()); |
| | | // 将文件信息保存到数据库 |
| | | baseMapper.insert(fileInfo); |
| | | |
| | | return fileInfo; |
| | | } |
| | | |
| | | /** |
| | | * 文件来源 |
| | | * |
| | |
| | | fileInfo.setId(IdUtil.fastSimpleUUID()); |
| | | fileInfo.setName(file.getOriginalFilename()); |
| | | fileInfo.setContentType(file.getContentType()); |
| | | fileInfo.setIsImg(fileInfo.getContentType().startsWith("image/")); |
| | | if (fileInfo.getContentType().startsWith("image/")) { |
| | | fileInfo.setIsImg(true); |
| | | } |
| | | else if (fileInfo.getContentType().startsWith("multipart")){ |
| | | String extendName = file.getOriginalFilename().substring(file.getOriginalFilename().indexOf(".")+1,file.getOriginalFilename().length()).toLowerCase(); |
| | | if (extendName.equals("png") || extendName.equals("bmp") || extendName.equals("jpg") || extendName.equals("jpeg") || extendName.equals("gif")) { |
| | | fileInfo.setIsImg(true); |
| | | } else { |
| | | fileInfo.setIsImg(false); |
| | | } |
| | | |
| | | } else { |
| | | fileInfo.setIsImg(false); |
| | | } |
| | | |
| | | fileInfo.setSize(file.getSize()); |
| | | fileInfo.setCreateTime(new Date()); |
| | | return fileInfo; |
| | |
| | | int last = file.getOriginalFilename().length(); |
| | | String fileType = file.getOriginalFilename().substring(begin, last); |
| | | String fileName= UUID.randomUUID().toString().replaceAll("-","")+fileType; |
| | | if(clientID.equals("hospital")){//医院端平台,根据医院ID,科室ID进行OSS存储 |
| | | String orgID=httpServletRequest.getHeader(SecurityConstants.USER_ORG_ID_HEADER); |
| | | String depID=httpServletRequest.getHeader(SecurityConstants.USER_DEP_ID_HEADER); |
| | | String fileFolder="KidgrowAI/"+orgID+"/"+depID+"/"; |
| | | String fileFolder = ""; |
| | | if(clientID.equals("hospital")){//医院端平台, |
| | | |
| | | ossClient.putObject(fileProperties.getOss().getBucketName(), fileFolder + folderByDate + "/" + fileName, file.getInputStream()); |
| | | fileInfo.setUrl(fileProperties.getOss().getDomain() + fileFolder + folderByDate + "/" + fileName); |
| | | if ((fileInfo.getImgType() != null)) { |
| | | // 光片需要按照根据医院ID,科室ID,日期进行OSS存储 |
| | | if (fileInfo.getImgType().toLowerCase().equals("xray")) { |
| | | String hospitalID = httpServletRequest.getHeader(SecurityConstants.USER_HOSPITAL_ID_HEADER); |
| | | String depID = httpServletRequest.getHeader(SecurityConstants.USER_DEP_ID_HEADER); |
| | | fileFolder = "Xray/" + hospitalID + "/" + depID + "/"+ folderByDate + "/"; |
| | | } |
| | | // 医院Logo只保存在一个目录中 |
| | | else if (fileInfo.getImgType().toLowerCase().equals("logo")) { |
| | | fileFolder = "HospitalLogo/"; |
| | | } else { |
| | | fileFolder = "OtherImage/"+ folderByDate + "/"; |
| | | } |
| | | |
| | | } else { |
| | | fileFolder = "OtherImage/"+ folderByDate + "/"; |
| | | } |
| | | |
| | | ossClient.putObject(fileProperties.getOss().getBucketName(), fileFolder + fileName, file.getInputStream()); |
| | | fileInfo.setUrl(fileProperties.getOss().getDomain() + fileFolder + fileName); |
| | | |
| | | } |
| | | else { |
| | | ossClient.putObject(fileProperties.getOss().getBucketName(), fileProperties.getOss().getFolder() + folderByDate + "/" + fileName, file.getInputStream()); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value="/files-upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo feignUpload(MultipartFile file) throws Exception { |
| | | return fileService.upload(file); |
| | | @PostMapping(value="/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception { |
| | | return fileService.upload(file,imgType); |
| | | } |
| | | |
| | | |
| | |
| | | <dependency> |
| | | <groupId>io.github.openfeign.form</groupId> |
| | | <artifactId>feign-form</artifactId> |
| | | <version>3.3.0</version> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.github.openfeign.form</groupId> |
| | | <artifactId>feign-form-spring</artifactId> |
| | | <version>3.3.0</version> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.kidgrow</groupId> |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | } |
| | | |
| | | /** |
| | | * 统计用户套餐使用情况 |
| | | * 统计用户所有套餐剩余 |
| | | * @param hospitalId |
| | | * @param departmentId |
| | | * @return |
| | |
| | | Map<String,Object> selectMap=new HashMap<>(); |
| | | selectMap.put("hospitalId",hospitalId); |
| | | List<ProductOrderJoinDetail> productOrderDetailList=productOrderDetailService.findAllList(selectMap); |
| | | Long userAICount=0l; |
| | | if (productOrderDetailList.size()>0) { |
| | | // |
| | | //包含共享的数据 |
| | | List<ProductOrderJoinDetail> productOrderJoinDetailListShare=productOrderDetailList.stream().filter(f->f.getIsShare()).collect(Collectors.toList()); |
| | | //科室私有的数据 |
| | | List<ProductOrderJoinDetail> productOrderJoinDetailsListDep=productOrderDetailList.stream().filter((f->departmentId.equals(f.getDepartmentId())&&f.getIsShare()==false)).collect(Collectors.toList()); |
| | | //本医院可共享的读片总量 |
| | | Long shareCount=productOrderJoinDetailListShare.stream().collect(Collectors.summingLong(ProductOrderJoinDetail::getAilightCount)); |
| | | //本科室私有读片总量 |
| | | Long depCount=productOrderJoinDetailsListDep.stream().collect(Collectors.summingLong(ProductOrderJoinDetail::getAilightCount)); |
| | | //可用的总量 |
| | | userAICount=shareCount+depCount; |
| | | } |
| | | return null; |
| | | return ResultBody.ok().data(userAICount); |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed("医院和科室数据有误!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | <where> |
| | | <!--查询条件自行添加--> |
| | | DE.is_del=0 and DE.ailight_count>0 and DE.pro_begintime <=now() and DE.pro_endtime >=now() and DE.enabled=1 |
| | | <if test="p.recordCount != null and p.recordCount !=''"> |
| | | and DE.record_count > #{p.recordCount} |
| | | </if> |
| | | <if test="p.hospitalId != null and p.hospitalId !=''"> |
| | | and DE.hospital_id = #{p.hospitalId} |
| | | and PRO.hospital_id = #{p.hospitalId} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | <!--查询产品的购买记录--> |
| | | <select id="findAllList" resultType="com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail"> |
| | | SELECT |
| | | DE.id, |
| | | DE.ailight_count, |
| | | DE.order_id, |
| | | DE.pro_name, |
| | | DE.record_count, |
| | | DE.is_share, |
| | | DE.pro_begintime, |
| | | DE.pro_endtime, |
| | | DE.pro_id, |
| | | DE.create_time, |
| | | DE.is_del, |
| | | DE.enabled, |
| | | PRO.hospital_Id, |
| | | PRO.hospital_name, |
| | | PRO.department_id, |
| | | PRO.department_name, |
| | | DE.pro_type |
| | | FROM |
| | | product_order_detail DE |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询用户的套餐剩余量 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/biUserNowProduct") |
| | | public ResultBody biUserNowProduct(@RequestParam long hospitalId, Long departmentId) { |
| | | return productOrderRecordService.biUserNowProduct(hospitalId,departmentId); |
| | | } |
| | | /** |
| | | * 查询 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | |
| | | * @return SysDoctor对象 |
| | | */ |
| | | SysDoctor findByObject(@Param("p") SysDoctor sysDoctor); |
| | | /** |
| | | * 查询账户名是否管理员 |
| | | * @param userName |
| | | * @return SysDoctor |
| | | */ |
| | | SysDoctor userIsAdmin(String userName); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | ResultBody setAdminDoctor(Map<String, Object> map); |
| | | /** |
| | | * H端检查用户名是否管理员 |
| | | * @param userName |
| | | * @return |
| | | */ |
| | | ResultBody userIsAdmin(String userName); |
| | | } |
| | | |
| | |
| | | import com.kidgrow.common.constant.SecurityConstants; |
| | | import com.kidgrow.common.model.*; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.redis.util.RedisConstant; |
| | | import com.kidgrow.redis.util.RedisUtils; |
| | | import com.kidgrow.usercenter.mapper.SysDoctorMapper; |
| | |
| | | return ResultBody.failed("业务参数有误!").data(false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断用户名是否管理员 |
| | | * @param userName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultBody userIsAdmin(String userName) { |
| | | if (StringUtils.isNotBlank(userName)) { |
| | | SysDoctor sysDoctor= baseMapper.userIsAdmin(userName); |
| | | if (sysDoctor != null) { |
| | | return ResultBody.ok().data(sysDoctor.getIsAdminUser()); |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().data(false); |
| | | } |
| | | }else |
| | | { |
| | | return ResultBody.failed("用户名不能为空!").data(false); |
| | | } |
| | | } |
| | | } |
| | |
| | | sysOrganizationHos.setOrgAttr(1); |
| | | sysOrganizationHos.setOrgLevel(1); |
| | | sysOrganizationHos.setOrgName(userRegVo.getHospitalName()); |
| | | sysOrganizationHos.setCreateUserId(0l); |
| | | sysOrganizationHos.setCreateUserName("自主注册"); |
| | | sysOrganizationList.add(sysOrganizationHos); |
| | | |
| | | //添加科室组织数据 |
| | |
| | | sysOrganizationDe.setOrgAttr(2); |
| | | sysOrganizationDe.setOrgLevel(2); |
| | | sysOrganizationDe.setOrgName(userRegVo.getDepartmentName()); |
| | | sysOrganizationDe.setCreateUserId(0L); |
| | | sysOrganizationDe.setCreateUserName("自主注册"); |
| | | sysOrganizationList.add(sysOrganizationDe); |
| | | //批量写入 |
| | | boolean orgRe= organizationService.saveBatch(sysOrganizationList); |
| | |
| | | sysDepartment.setSaleUserName("自主注册"); |
| | | sysDepartment.setSaleUserTel("0"); |
| | | sysDepartment.setServerUserId(0L); |
| | | sysDepartment.setServerUserTel("0");//serverUserName |
| | | sysDepartment.setServerUserName("自主注册"); |
| | | sysDepartment.setServerUserTel("0"); |
| | | boolean d=departmentService.save(sysDepartment); |
| | | if (!d) { |
| | | return ResultBody.failed("科室数据写入失败"); |
| | |
| | | sysDoctor.setServerUserName("自主注册"); |
| | | if (sysDoctorMapper.insert(sysDoctor)==1) { |
| | | sysUser.setPassword(userRegVo.getPassword()); |
| | | return ResultBody.ok().data(sysUser); |
| | | // return ResultBody.ok(200,"注册成功").data(sysUser); |
| | | return ResultBody.ok(200,"注册成功").data(sysUser); |
| | | } |
| | | else |
| | | { |
| | |
| | | <include refid="where"/> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="userIsAdmin" parameterType="string" resultType="com.kidgrow.usercenter.model.SysDoctor"> |
| | | SELECT |
| | | is_admin_user |
| | | FROM |
| | | sys_doctor |
| | | WHERE |
| | | user_id IN ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | sys_user |
| | | WHERE |
| | | username = #{userName} |
| | | OR mobile = #{userName}) |
| | | </select> |
| | | </mapper> |
| | |
| | | order by t.id desc |
| | | </select> |
| | | <select id="selectCountByMap" parameterType="map" resultType="integer"> |
| | | select count(*) from sys_user t <include refid="where_map" /> |
| | | select count(*) from sys_user t |
| | | <include refid="where_map"/> |
| | | </select> |
| | | |
| | | <select id="findAppointUsers" parameterType="integer" resultType="com.kidgrow.common.model.SysUser"> |
| | |
| | | 'opration') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="findDoctorUserAllData" resultType="com.kidgrow.common.model.DoctorUserAll"> |
| | | SELECT sysuser.id, |
| | | sysdoctor.doctor_name, |
| | |
| | | return ResultBody.ok().data(model).msg("查询成功"); |
| | | } |
| | | /** |
| | | * 判断用户名是否管理员 |
| | | */ |
| | | @ApiOperation(value = "判断用户名是否管理员") |
| | | @GetMapping("/userName") |
| | | public ResultBody findById(@RequestParam String userName) { |
| | | return sysDoctorService.userIsAdmin(userName); |
| | | } |
| | | /** |
| | | * 根据 Map 查询 |
| | | */ |
| | | @ApiOperation(value = "查询") |