kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java
@@ -7,6 +7,7 @@ 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; @@ -30,9 +31,9 @@ /** * 根据条件查询 * @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); } kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/fallback/FileServiceFallbackFactory.java
@@ -30,7 +30,7 @@ return null; } @Override public FileInfo feignUpload(@RequestPart("file") MultipartFile file) { public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) { return null; } }; kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/model/FileInfo.java
@@ -35,6 +35,13 @@ * 是否图片 */ private Boolean isImg; /** * 图片类型 * Xray还是logo */ @TableField(exist = false) private String imgType; /** * 上传文件类型 */ kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-biz/src/main/java/com/kidgrow/filecenter/service/IFileService.java
@@ -18,6 +18,8 @@ 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); kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-biz/src/main/java/com/kidgrow/filecenter/service/impl/AbstractIFileService.java
@@ -48,6 +48,26 @@ 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; } /** * 文件来源 * kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-biz/src/main/java/com/kidgrow/filecenter/util/FileUtil.java
@@ -32,7 +32,21 @@ 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; kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/config/AliyunOSSAutoConfigure.java
@@ -67,13 +67,30 @@ 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()); kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
@@ -46,9 +46,9 @@ * @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); } kidgrow-business/kidgrow-filecenter/pom.xml
@@ -23,13 +23,13 @@ <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> kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/ProductOrderRecordServiceImpl.java
@@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> @@ -96,7 +97,7 @@ } /** * 统计用户套餐使用情况 * 统计用户所有套餐剩余 * @param hospitalId * @param departmentId * @return @@ -108,16 +109,25 @@ 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("医院和科室数据有误!"); } } /** kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml
@@ -146,33 +146,21 @@ <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 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/java/com/kidgrow/oprationcenter/controller/ProductOrderRecordController.java
@@ -127,6 +127,14 @@ } /** * 查询用户的套餐剩余量 */ @ApiOperation(value = "查询") @GetMapping("/biUserNowProduct") public ResultBody biUserNowProduct(@RequestParam long hospitalId, Long departmentId) { return productOrderRecordService.biUserNowProduct(hospitalId,departmentId); } /** * 查询 */ @ApiOperation(value = "查询") kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/mapper/SysDoctorMapper.java
@@ -31,4 +31,10 @@ * @return SysDoctor对象 */ SysDoctor findByObject(@Param("p") SysDoctor sysDoctor); /** * 查询账户名是否管理员 * @param userName * @return SysDoctor */ SysDoctor userIsAdmin(String userName); } kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/ISysDoctorService.java
@@ -50,5 +50,11 @@ * @return */ ResultBody setAdminDoctor(Map<String, Object> map); /** * H端检查用户名是否管理员 * @param userName * @return */ ResultBody userIsAdmin(String userName); } kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysDoctorServiceImpl.java
@@ -5,6 +5,7 @@ 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; @@ -288,4 +289,26 @@ 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); } } } kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/java/com/kidgrow/usercenter/service/impl/SysUserServiceImpl.java
@@ -622,8 +622,6 @@ sysOrganizationHos.setOrgAttr(1); sysOrganizationHos.setOrgLevel(1); sysOrganizationHos.setOrgName(userRegVo.getHospitalName()); sysOrganizationHos.setCreateUserId(0l); sysOrganizationHos.setCreateUserName("自主注册"); sysOrganizationList.add(sysOrganizationHos); //添加科室组织数据 @@ -631,8 +629,6 @@ sysOrganizationDe.setOrgAttr(2); sysOrganizationDe.setOrgLevel(2); sysOrganizationDe.setOrgName(userRegVo.getDepartmentName()); sysOrganizationDe.setCreateUserId(0L); sysOrganizationDe.setCreateUserName("自主注册"); sysOrganizationList.add(sysOrganizationDe); //批量写入 boolean orgRe= organizationService.saveBatch(sysOrganizationList); @@ -658,8 +654,7 @@ 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("科室数据写入失败"); @@ -760,8 +755,7 @@ 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 { kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysDoctorMapper.xml
@@ -112,4 +112,20 @@ <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> kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-biz/src/main/resources/mapper/SysUserMapper.xml
@@ -2,102 +2,104 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.kidgrow.usercenter.mapper.SysUserMapper"> <sql id="where"> <where> t.is_del=0 <if test="u.id != null and u.id != ''"> and t.id like concat('%', #{u.id}, '%') </if> <if test="u.username != null and u.username != ''"> and t.username like concat('%', #{u.username}, '%') </if> <if test="u.nickname != null and u.nickname != ''"> and t.nickname like concat('%', #{u.nickname}, '%') </if> <if test="u.enabled != null and u.enabled != ''"> and t.enabled = #{u.enabled} </if> <if test="u.type != null and u.type != ''"> and t.type = #{u.type} </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='user_id'"> and t.id like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='username'"> and t.username like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='nick_name'"> and t.nickname like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='mobile'"> and t.mobile like concat('%', #{u.searchValue}, '%') </if> </where> </sql> <sql id="where_map"> <where> <if test="u.id != null and u.id != ''"> and t.id like concat('%', #{u.id}, '%') </if> <if test="u.username != null and u.username != ''"> and t.username = #{u.username} </if> <if test="u.nickname != null and u.nickname != ''"> and t.nickname like concat('%', #{u.nickname}, '%') </if> <if test="u.enabled != null and u.enabled != ''"> and t.enabled = #{u.enabled} </if> <if test="u.type != null and u.type != ''"> and t.type = #{u.type} </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='user_id'"> and t.id like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='username'"> and t.username like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='nick_name'"> and t.nickname like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='mobile'"> and t.mobile like concat('%', #{u.searchValue}, '%') </if> </where> </sql> <sql id="where"> <where> t.is_del=0 <if test="u.id != null and u.id != ''"> and t.id like concat('%', #{u.id}, '%') </if> <if test="u.username != null and u.username != ''"> and t.username like concat('%', #{u.username}, '%') </if> <if test="u.nickname != null and u.nickname != ''"> and t.nickname like concat('%', #{u.nickname}, '%') </if> <if test="u.enabled != null and u.enabled != ''"> and t.enabled = #{u.enabled} </if> <if test="u.type != null and u.type != ''"> and t.type = #{u.type} </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='user_id'"> and t.id like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='username'"> and t.username like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='nick_name'"> and t.nickname like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='mobile'"> and t.mobile like concat('%', #{u.searchValue}, '%') </if> </where> </sql> <sql id="where_map"> <where> <if test="u.id != null and u.id != ''"> and t.id like concat('%', #{u.id}, '%') </if> <if test="u.username != null and u.username != ''"> and t.username = #{u.username} </if> <if test="u.nickname != null and u.nickname != ''"> and t.nickname like concat('%', #{u.nickname}, '%') </if> <if test="u.enabled != null and u.enabled != ''"> and t.enabled = #{u.enabled} </if> <if test="u.type != null and u.type != ''"> and t.type = #{u.type} </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='user_id'"> and t.id like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='username'"> and t.username like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='nick_name'"> and t.nickname like concat('%', #{u.searchValue}, '%') </if> <if test="u.searchKey != null and u.searchKey != '' and u.searchKey=='mobile'"> and t.mobile like concat('%', #{u.searchValue}, '%') </if> </where> </sql> <select id="findList" resultType="com.kidgrow.common.model.SysUser"> select * from sys_user t <include refid="where" /> order by t.id desc </select> <select id="selectCountByMap" parameterType="map" resultType="integer"> select count(*) from sys_user t <include refid="where_map" /> </select> <select id="findList" resultType="com.kidgrow.common.model.SysUser"> select * from sys_user t <include refid="where"/> order by t.id desc </select> <select id="selectCountByMap" parameterType="map" resultType="integer"> select count(*) from sys_user t <include refid="where_map"/> </select> <select id="findAppointUsers" parameterType="integer" resultType="com.kidgrow.common.model.SysUser"> SELECT USERS.id, USERS.nickname, USERS.mobile FROM `sys_role_user` RU LEFT JOIN sys_user USERS ON RU.user_id = USERS.id LEFT JOIN sys_role ROLE ON RU.role_id = ROLE.id WHERE USERS.is_del = 0 <if test="type == 0"> AND ROLE.`code` IN ( 'salemanager', 'sale') </if> <if test="type == 1"> AND ROLE.`code` IN ( 'oprationmanager', 'opration') </if> </select> <select id="findDoctorUserAllData" resultType="com.kidgrow.common.model.DoctorUserAll"> <select id="findAppointUsers" parameterType="integer" resultType="com.kidgrow.common.model.SysUser"> SELECT USERS.id, USERS.nickname, USERS.mobile FROM `sys_role_user` RU LEFT JOIN sys_user USERS ON RU.user_id = USERS.id LEFT JOIN sys_role ROLE ON RU.role_id = ROLE.id WHERE USERS.is_del = 0 <if test="type == 0"> AND ROLE.`code` IN ( 'salemanager', 'sale') </if> <if test="type == 1"> AND ROLE.`code` IN ( 'oprationmanager', 'opration') </if> </select> <select id="findDoctorUserAllData" resultType="com.kidgrow.common.model.DoctorUserAll"> SELECT sysuser.id, sysdoctor.doctor_name, sysdoctor.doctor_ccie, kidgrow-business/kidgrow-usercenter/kidgrow-usercenter-server/src/main/java/com/kidgrow/usercenter/controller/SysDoctorController.java
@@ -71,6 +71,14 @@ return ResultBody.ok().data(model).msg("查询成功"); } /** * 判断用户名是否管理员 */ @ApiOperation(value = "判断用户名是否管理员") @GetMapping("/userName") public ResultBody findById(@RequestParam String userName) { return sysDoctorService.userIsAdmin(userName); } /** * 根据 Map 查询 */ @ApiOperation(value = "查询")