Commit 3c8ab1ada55e42f06c7bb614e8c9b05d09f3f07a
1 parent
687fffdb8d
Exists in
master
and in
6 other branches
update code
Showing 4 changed files with 92 additions and 44 deletions
- platform-biz-service/src/main/resources/mainOrm/master/MeasureInfoMapper.xml
- platform-dal/src/main/java/com/lyms/platform/query/MeasureInfoQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
platform-biz-service/src/main/resources/mainOrm/master/MeasureInfoMapper.xml
View file @
3c8ab1a
| ... | ... | @@ -184,6 +184,15 @@ |
| 184 | 184 | and (phone = #{queryNo,jdbcType=VARCHAR} or cert_no = #{queryNo,jdbcType=VARCHAR} or user_name = #{queryNo,jdbcType=VARCHAR}) |
| 185 | 185 | </if> |
| 186 | 186 | |
| 187 | + <if test="hospitalId != null and hospitalId != ''"> | |
| 188 | + and hospital_id = #{hospitalId,jdbcType=VARCHAR} | |
| 189 | + </if> | |
| 190 | + <if test="hospitalIds != null and hospitalIds.size() > 0"> | |
| 191 | + and hospital_id in | |
| 192 | + <foreach collection="hospitalIds" index="index" item="item" open="(" separator="," close=")"> | |
| 193 | + #{item} | |
| 194 | + </foreach> | |
| 195 | + </if> | |
| 187 | 196 | </where> |
| 188 | 197 | </sql> |
| 189 | 198 | </mapper> |
platform-dal/src/main/java/com/lyms/platform/query/MeasureInfoQuery.java
View file @
3c8ab1a
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | import org.springframework.data.mongodb.core.query.Criteria; |
| 10 | 10 | |
| 11 | 11 | import java.util.Date; |
| 12 | +import java.util.List; | |
| 12 | 13 | |
| 13 | 14 | /** |
| 14 | 15 | * Created by Administrator on 2018-01-09. |
| ... | ... | @@ -56,6 +57,7 @@ |
| 56 | 57 | |
| 57 | 58 | private String queryNo; |
| 58 | 59 | private String hospitalId; |
| 60 | + private List<String> hospitalIds; | |
| 59 | 61 | |
| 60 | 62 | private Date recordTime; |
| 61 | 63 | |
| 62 | 64 | |
| ... | ... | @@ -312,6 +314,12 @@ |
| 312 | 314 | this.id = id; |
| 313 | 315 | } |
| 314 | 316 | |
| 317 | + public List<String> getHospitalIds() { | |
| 318 | + return hospitalIds; | |
| 319 | + } | |
| 315 | 320 | |
| 321 | + public void setHospitalIds(List<String> hospitalIds) { | |
| 322 | + this.hospitalIds = hospitalIds; | |
| 323 | + } | |
| 316 | 324 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java
View file @
3c8ab1a
| ... | ... | @@ -30,15 +30,17 @@ |
| 30 | 30 | */ |
| 31 | 31 | @RequestMapping(method = RequestMethod.GET, value = "/queryMeasureInfoList") |
| 32 | 32 | @ResponseBody |
| 33 | + @TokenRequired | |
| 33 | 34 | public BaseListResponse queryMeasureInfoList(@RequestParam(value = "queryNo", required = false) String queryNo, |
| 34 | 35 | @RequestParam("page") Integer page, |
| 35 | 36 | @RequestParam("limit") Integer limit, |
| 36 | 37 | @RequestParam("valueType") Integer valueType, |
| 37 | 38 | @RequestParam(value = "vcCardNo", required = false) String vcCardNo, |
| 38 | 39 | @RequestParam(value = "recordTime", required = false) String recordTime, |
| 39 | - @RequestParam(value = "age", required = false) Integer age | |
| 40 | + @RequestParam(value = "age", required = false) Integer age, | |
| 41 | + HttpServletRequest request | |
| 40 | 42 | ) { |
| 41 | - return measureInfoFacade.queryMeasureInfoList(queryNo,valueType,vcCardNo,recordTime,age,page,limit); | |
| 43 | + return measureInfoFacade.queryMeasureInfoList(queryNo,valueType,vcCardNo,recordTime,age,page,limit,getUserId(request)); | |
| 42 | 44 | } |
| 43 | 45 | |
| 44 | 46 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
3c8ab1a
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
| 4 | +import com.lyms.platform.biz.service.DataPermissionService; | |
| 4 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 6 | import com.lyms.platform.common.enums.SexEnum; |
| 6 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 7 | 8 | |
| 8 | 9 | |
| ... | ... | @@ -9,16 +10,16 @@ |
| 9 | 10 | import com.lyms.platform.operate.web.request.MeasureInfoRequest; |
| 10 | 11 | import com.lyms.platform.operate.web.result.MeasureInfoResult; |
| 11 | 12 | import com.lyms.platform.pojo.BasicConfig; |
| 13 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 12 | 14 | import com.lyms.platform.pojo.MeasureInfoModel; |
| 15 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
| 13 | 16 | import com.lyms.platform.query.MeasureInfoQuery; |
| 14 | 17 | import org.apache.commons.collections.CollectionUtils; |
| 15 | 18 | import org.apache.commons.lang.StringUtils; |
| 16 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | 20 | import org.springframework.stereotype.Component; |
| 18 | 21 | |
| 19 | -import java.util.ArrayList; | |
| 20 | -import java.util.Date; | |
| 21 | -import java.util.List; | |
| 22 | +import java.util.*; | |
| 22 | 23 | |
| 23 | 24 | /** |
| 24 | 25 | * Created by Administrator on 2018-01-10. |
| 25 | 26 | |
| 26 | 27 | |
| 27 | 28 | |
| 28 | 29 | |
| 29 | 30 | |
| 30 | 31 | |
| 31 | 32 | |
| 32 | 33 | |
| 33 | 34 | |
| ... | ... | @@ -29,59 +30,87 @@ |
| 29 | 30 | private com.lyms.platform.permission.service.MeasureInfoService mysqlMeasureInfoService; |
| 30 | 31 | |
| 31 | 32 | @Autowired |
| 33 | + private DataPermissionService dataPermissionService; | |
| 34 | + | |
| 35 | + @Autowired | |
| 32 | 36 | private BasicConfigService basicConfigService; |
| 33 | 37 | |
| 34 | 38 | public BaseListResponse queryMeasureInfoList(String queryNo, |
| 35 | 39 | Integer valueType, String vcCardNo, |
| 36 | 40 | String recordTime, Integer age, |
| 37 | - Integer page, Integer limit) { | |
| 41 | + Integer page, Integer limit,Integer userId) { | |
| 38 | 42 | |
| 39 | - MeasureInfoQuery query = new MeasureInfoQuery(); | |
| 40 | - query.setQueryNo(queryNo); | |
| 41 | - query.setValueType(valueType); | |
| 42 | - query.setLimit(limit); | |
| 43 | - query.setPage(page); | |
| 44 | - query.setAge(age); | |
| 45 | - query.setVcCardNo(vcCardNo); | |
| 46 | - query.setSort(" created desc "); | |
| 47 | - query.setNeed("true"); | |
| 48 | - if (StringUtils.isNotEmpty(recordTime)) { | |
| 49 | - String[] dates = recordTime.split(" - "); | |
| 50 | - query.setRecordTimeStart(DateUtil.parseYMD(dates[0])); | |
| 51 | - if (dates.length == 2) { | |
| 52 | - query.setRecordTimeEnd(DateUtil.addDay(DateUtil.parseYMD(dates[1]),1)); | |
| 43 | + | |
| 44 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 45 | + dataPermissionsModelQuery.setUserId(userId); | |
| 46 | + | |
| 47 | + | |
| 48 | + List<String> hospitalList = new ArrayList<>(); | |
| 49 | + | |
| 50 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 51 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
| 52 | + Set<String> set = permissionsModels.get(0).getData().keySet(); | |
| 53 | + Iterator<String> it = set.iterator(); | |
| 54 | + while (it.hasNext()) { | |
| 55 | + String id = it.next(); | |
| 56 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(id) && !hospitalList.contains(id)) { | |
| 57 | + hospitalList.add(id); | |
| 58 | + } | |
| 53 | 59 | } |
| 54 | 60 | } |
| 55 | - List<MeasureInfoModel> list = mysqlMeasureInfoService.queryMeasureInfoList(query); | |
| 56 | 61 | |
| 57 | 62 | List<MeasureInfoResult> results = new ArrayList<>(); |
| 58 | - if (CollectionUtils.isNotEmpty(list)) | |
| 63 | + MeasureInfoQuery query = new MeasureInfoQuery(); | |
| 64 | + if (CollectionUtils.isNotEmpty(hospitalList)) | |
| 59 | 65 | { |
| 60 | - for (MeasureInfoModel model : list) | |
| 66 | + //ๆ้ | |
| 67 | + query.setHospitalIds(hospitalList); | |
| 68 | + query.setQueryNo(queryNo); | |
| 69 | + query.setValueType(valueType); | |
| 70 | + query.setLimit(limit); | |
| 71 | + query.setPage(page); | |
| 72 | + query.setAge(age); | |
| 73 | + query.setVcCardNo(vcCardNo); | |
| 74 | + query.setSort(" record_time desc "); | |
| 75 | + query.setNeed("true"); | |
| 76 | + if (StringUtils.isNotEmpty(recordTime)) { | |
| 77 | + String[] dates = recordTime.split(" - "); | |
| 78 | + query.setRecordTimeStart(DateUtil.parseYMD(dates[0])); | |
| 79 | + if (dates.length == 2) { | |
| 80 | + query.setRecordTimeEnd(DateUtil.addDay(DateUtil.parseYMD(dates[1]),1)); | |
| 81 | + } | |
| 82 | + } | |
| 83 | + List<MeasureInfoModel> list = mysqlMeasureInfoService.queryMeasureInfoList(query); | |
| 84 | + | |
| 85 | + | |
| 86 | + if (CollectionUtils.isNotEmpty(list)) | |
| 61 | 87 | { |
| 62 | - MeasureInfoResult result = new MeasureInfoResult(); | |
| 63 | - result.setId(model.getId()); | |
| 64 | - result.setUserName(model.getUserName()); | |
| 88 | + for (MeasureInfoModel model : list) | |
| 89 | + { | |
| 90 | + MeasureInfoResult result = new MeasureInfoResult(); | |
| 91 | + result.setId(model.getId()); | |
| 92 | + result.setUserName(model.getUserName()); | |
| 65 | 93 | |
| 66 | - if (StringUtils.isNotEmpty(model.getCertType())) { | |
| 67 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(model.getCertType()); | |
| 68 | - if (null != basicConfig) { | |
| 69 | - result.setCertType(basicConfig.getName()); | |
| 94 | + if (StringUtils.isNotEmpty(model.getCertType())) { | |
| 95 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(model.getCertType()); | |
| 96 | + if (null != basicConfig) { | |
| 97 | + result.setCertType(basicConfig.getName()); | |
| 98 | + } | |
| 70 | 99 | } |
| 100 | + result.setCertNo(model.getCertNo()); | |
| 101 | + result.setHospitalId(model.getHospitalId()); | |
| 102 | + result.setOpenId(model.getOpenId()); | |
| 103 | + result.setRecordCount(model.getRecordCount()); | |
| 104 | + result.setRecordTime(DateUtil.getyyyy_MM_dd(model.getRecordTime())); | |
| 105 | + result.setSex(SexEnum.getTextById(model.getSex())); | |
| 106 | + result.setAge(model.getAge() == null ? "--" : String.valueOf(model.getAge())); | |
| 107 | + result.setValueOne(model.getValueOne()); | |
| 108 | + result.setValueTwo(model.getValueTwo()); | |
| 109 | + result.setVcCardNo(model.getVcCardNo() == null ? "--" : model.getVcCardNo()); | |
| 110 | + result.setWxXode(model.getWxCode()); | |
| 111 | + result.setPhone(model.getPhone()); | |
| 112 | + results.add(result); | |
| 71 | 113 | } |
| 72 | - result.setCertNo(model.getCertNo()); | |
| 73 | - result.setHospitalId(model.getHospitalId()); | |
| 74 | - result.setOpenId(model.getOpenId()); | |
| 75 | - result.setRecordCount(model.getRecordCount()); | |
| 76 | - result.setRecordTime(DateUtil.getyyyy_MM_dd(model.getRecordTime())); | |
| 77 | - result.setSex(SexEnum.getTextById(model.getSex())); | |
| 78 | - result.setAge(model.getAge() == null ? "--" : String.valueOf(model.getAge())); | |
| 79 | - result.setValueOne(model.getValueOne()); | |
| 80 | - result.setValueTwo(model.getValueTwo()); | |
| 81 | - result.setVcCardNo(model.getVcCardNo() == null ? "--" : model.getVcCardNo()); | |
| 82 | - result.setWxXode(model.getWxCode()); | |
| 83 | - result.setPhone(model.getPhone()); | |
| 84 | - results.add(result); | |
| 85 | 114 | } |
| 86 | 115 | } |
| 87 | 116 |