Commit 53c6cdf7e3f972b3cb2ea2e2f4a73641dfb7aec1

Authored by wtt
1 parent 2fc6b43ca8
Exists in master and in 1 other branch dev

巨大儿部分

Showing 3 changed files with 179 additions and 12 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java View file @ 53c6cdf
... ... @@ -172,6 +172,18 @@
172 172 return patientFacade.queryAbnormalWeight(patientsQueryRequest, loginState.getId());
173 173 }
174 174 /**
  175 + * 巨大儿管理
  176 + * @param patientsQueryRequest 全部孕妇管理查询 (因为请求参数一样同用一个对象)
  177 + * @return 返回结果
  178 + */
  179 + @RequestMapping(value = "/queryGiantWeight", method = RequestMethod.GET)
  180 + @ResponseBody
  181 + @TokenRequired
  182 + public BaseResponse queryGiantWeight(@Valid RiskPatientsQueryRequest patientsQueryRequest, HttpServletRequest request) {
  183 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  184 + return patientFacade.queryGiantWeight(patientsQueryRequest, loginState.getId());
  185 + }
  186 + /**
175 187 * 孕期体重异常管理 导出
176 188 * @Author: 武涛涛
177 189 * @Date: 2021/1/4 14:27
... ... @@ -181,6 +193,16 @@
181 193 public void exportQueryAbnormalWeight(@Valid RiskPatientsQueryRequest riskPatientsQueryRequest, HttpServletRequest request, HttpServletResponse response) {
182 194 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
183 195 patientFacade.exportQueryAbnormalWeight(riskPatientsQueryRequest, loginState.getId(), response);
  196 + }
  197 + /**
  198 + * 巨大儿管理 导出
  199 + * @Author: 武涛涛
  200 + */
  201 + @RequestMapping(value = "/exportQueryGiantWeight", method = RequestMethod.GET)
  202 + @TokenRequired
  203 + public void exportQueryGiantWeight(@Valid RiskPatientsQueryRequest riskPatientsQueryRequest, HttpServletRequest request, HttpServletResponse response) {
  204 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  205 + patientFacade.exportQueryGiantWeight(riskPatientsQueryRequest, loginState.getId(), response);
184 206 }
185 207 /**
186 208 * 双胎全部孕妇管理
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 53c6cdf
... ... @@ -25,10 +25,7 @@
25 25 import com.lyms.platform.permission.service.OrganizationService;
26 26 import com.lyms.platform.permission.service.UsersService;
27 27 import com.lyms.platform.pojo.*;
28   -import com.lyms.platform.query.AntExChuQuery;
29   -import com.lyms.platform.query.BabyModelQuery;
30   -import com.lyms.platform.query.DataPermissionsModelQuery;
31   -import com.lyms.platform.query.PatientsQuery;
  28 +import com.lyms.platform.query.*;
32 29 import org.apache.commons.collections.CollectionUtils;
33 30 import org.slf4j.Logger;
34 31 import org.slf4j.LoggerFactory;
35 32  
36 33  
... ... @@ -784,19 +781,98 @@
784 781  
785 782 }
786 783 }
787   - //获取bmi大于 25 &筛选bmi条件
788   - PatientsQuery pq = new PatientsQuery();
789   - pq.setIds(ids);
790   - pq.setPage(riskPatientsQueryRequest.getPage());
791   - pq.setLimit(riskPatientsQueryRequest.getLimit());
792   - List <Patients> ps = patientsService.queryPatientBySort(pq, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder());
793   - if(CollectionUtils.isNotEmpty(ps)){
794   - data = convertToQuanWeight(ps);
  784 + if(CollectionUtils.isNotEmpty(ids)) {
  785 + //获取bmi大于 25 &筛选bmi条件
  786 + PatientsQuery pq = new PatientsQuery();
  787 + pq.setIds(ids);
  788 + pq.setPage(riskPatientsQueryRequest.getPage());
  789 + pq.setLimit(riskPatientsQueryRequest.getLimit());
  790 + List <Patients> ps = patientsService.queryPatientBySort(pq, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder());
  791 + if (CollectionUtils.isNotEmpty(ps)) {
  792 + data = convertToQuanWeight(ps);
  793 + }
795 794 }
796 795 }
797 796 return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery.getPageInfo());
798 797 }
  798 + /**
  799 + * 巨大儿管理
  800 + * @param riskPatientsQueryRequest
  801 + * @return
  802 + */
  803 + public BaseResponse queryGiantWeight(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer userId) {
799 804  
  805 + //分娩档案
  806 + String hospital = autoMatchFacade.getHospitalId(userId);
  807 + PatientsQuery patientsQuery = new PatientsQuery();
  808 + patientsQuery.setYn(YnEnums.YES.getId());
  809 + patientsQuery.setType(3);
  810 + patientsQuery.setSort(" created ");
  811 + patientsQuery.setDueStatus(0);
  812 + List buildType = new ArrayList();
  813 + buildType.add(0);
  814 + buildType.add(3);
  815 + patientsQuery.setSmsBuildTypeList(buildType);
  816 + patientsQuery.setIsAutoFm(YnEnums.NO.getId());
  817 + patientsQuery.setFmHospital(hospital);
  818 + patientsQuery.setCardNo(riskPatientsQueryRequest.getCardNo());
  819 + patientsQuery.setLastMensesStart(riskPatientsQueryRequest.capEnd());
  820 + patientsQuery.setLastMensesEnd(riskPatientsQueryRequest.capStart());
  821 + patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel());
  822 + patientsQuery.setrFactorList(com.lyms.platform.common.utils.StringUtils.covertToList(riskPatientsQueryRequest.getrFacotr(), String.class));
  823 + List <Patients> patientses = patientsService.queryPatientBySort(patientsQuery, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder());
  824 + List<Map> data = new ArrayList<>();
  825 + List<String> idsMd = new ArrayList<>();
  826 + List<String> idsPW = new ArrayList<>();
  827 + if (CollectionUtils.isNotEmpty(patientses)) {
  828 + for (Patients patients : patientses) {
  829 + //儿童体重大于等于4000克
  830 + if(com.lyms.platform.common.utils.StringUtils.isNotEmpty(patients.getId())){
  831 + Query querymd = Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").ne("0")
  832 + .and("baby").elemMatch(Criteria.where("babyWeight").gte("4000")));
  833 + List<MaternalDeliverModel> deliverModels = mongoTemplate.find(querymd, MaternalDeliverModel.class);
  834 + if(CollectionUtils.isNotEmpty(deliverModels)){
  835 + MaternalDeliverModel maternalDeliverModel = deliverModels.get(0);
  836 + idsMd.add(patients.getId());
  837 + }
  838 + }
  839 + }
  840 +
  841 + //孕妇体重
  842 + if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiStart()) && StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiEnd()) && CollectionUtils.isNotEmpty(idsMd)){
  843 + for (String id : idsMd) {
  844 + Query query = new Query();
  845 + if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiStart()) && StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiEnd())){
  846 + query = Query.query(Criteria.where("patientId").is(id)
  847 + .and("yn").ne("0").and("bmi").gte(riskPatientsQueryRequest.getBmiStart()).lte(riskPatientsQueryRequest.getBmiEnd()));
  848 + }else if(StringUtils.isEmpty(riskPatientsQueryRequest.getBmiStart()) && StringUtils.isEmpty(riskPatientsQueryRequest.getBmiEnd())){
  849 + query = Query.query(Criteria.where("patientId").is(id) .and("yn").ne("0"));
  850 + }
  851 + List<PatientWeight> patientWeightList = mongoTemplate.find(query, PatientWeight.class);
  852 + if(CollectionUtils.isNotEmpty(patientWeightList)){
  853 + PatientWeight patientWeight = patientWeightList.get(0);
  854 + if(patientWeight!=null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())){
  855 + idsPW.add(id);
  856 + }
  857 + }
  858 +
  859 + }
  860 + }
  861 + if(CollectionUtils.isNotEmpty(idsMd) || CollectionUtils.isNotEmpty(idsPW)){
  862 + //获取bmi大于 25 &筛选bmi条件
  863 + PatientsQuery pq = new PatientsQuery();
  864 + pq.setIds(CollectionUtils.isEmpty(idsPW)? idsMd : idsPW);
  865 + pq.setPage(riskPatientsQueryRequest.getPage());
  866 + pq.setLimit(riskPatientsQueryRequest.getLimit());
  867 + List <Patients> ps = patientsService.queryPatientBySort(pq, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder());
  868 + if(CollectionUtils.isNotEmpty(ps)){
  869 + data = convertToQuanWeight(ps);
  870 + }
  871 + }
  872 + }
  873 + return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery.getPageInfo());
  874 + }
  875 +
800 876 public void exportQueryAbnormalWeight(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer id, HttpServletResponse response) {
801 877  
802 878 try {
... ... @@ -849,6 +925,57 @@
849 925  
850 926 }
851 927  
  928 + public void exportQueryGiantWeight(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer id, HttpServletResponse response) {
  929 +
  930 + try {
  931 + BaseListResponse listResponse = (BaseListResponse) queryGiantWeight(riskPatientsQueryRequest, id);
  932 +
  933 + List<Map> list = listResponse.getData();
  934 + List<Map<String, Object>> datas = new ArrayList<>();
  935 +
  936 + if (CollectionUtils.isNotEmpty(list)) {
  937 + for (Map map : list) {
  938 + Map m = new HashMap <>();
  939 + m.put("username", map.get("username"));
  940 + m.put("age", map.get("age"));
  941 + m.put("phone", map.get("phone"));
  942 + m.put("currentWeek", map.get("currentWeek"));
  943 + m.put("riskFactor", map.get("riskFactor"));
  944 + m.put("bmi", map.get("bmi"));
  945 + m.put("beforeHeight", map.get("beforeHeight"));
  946 + m.put("beforeWeight", map.get("beforeWeight"));
  947 + Map<String, String> dayWeights = (Map<String, String>)map.get("dayWeights");
  948 + List <String> stringList = new ArrayList <>();
  949 + for(Map.Entry<String, String> entry : dayWeights.entrySet()){
  950 + if(StringUtils.isNotEmpty(entry.getKey()) && StringUtils.isNotEmpty(entry.getValue())){
  951 + String mapKey = entry.getKey();
  952 + String mapValue = entry.getValue();
  953 + stringList.add(mapKey + " / " + mapValue);
  954 + }
  955 + }
  956 + for (int i = 0; i <= 20 ; i++) {
  957 + if(i >= stringList.size()){
  958 + m.put("dayWeight"+i,"");
  959 + }else {
  960 + m.put("dayWeight"+i, stringList.get(i));
  961 + }
  962 + }
  963 + datas.add(m);
  964 + }
  965 + }
  966 + OutputStream out = response.getOutputStream();
  967 + Map<String, String> cnames = new LinkedHashMap<>();
  968 + cnamesMap(cnames);
  969 + response.setContentType("application/octet-stream");
  970 + response.setCharacterEncoding("UTF-8");
  971 + response.setHeader("Content-Disposition", "attachment;fileName=" + "巨大儿管理.xls");
  972 + ExcelUtil.toExcel(out, datas, cnames);
  973 + } catch (Exception e) {
  974 + e.printStackTrace();
  975 + ExceptionUtils.catchException(e, "巨大儿管理导出异常");
  976 + }
  977 +
  978 + }
852 979  
853 980 private void cnamesMap(Map<String, String> cnames) {
854 981 cnames.put("username", "姓名");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java View file @ 53c6cdf
... ... @@ -17,6 +17,8 @@
17 17 public class RiskPatientsQueryRequest extends BasePageQueryRequest {
18 18 //巨大儿使用 BMI:⭕ 1 〇25≤BMI<28 、 2 〇BMI≥28
19 19 private String bmi;
  20 + private String bmiStart;
  21 + private String bmiEnd;
20 22  
21 23 //判断定制机构 lp滦平
22 24 private String hstart;
... ... @@ -861,6 +863,22 @@
861 863  
862 864 public void setTwinsType(String twinsType) {
863 865 this.twinsType = twinsType;
  866 + }
  867 +
  868 + public String getBmiStart() {
  869 + return bmiStart;
  870 + }
  871 +
  872 + public void setBmiStart(String bmiStart) {
  873 + this.bmiStart = bmiStart;
  874 + }
  875 +
  876 + public String getBmiEnd() {
  877 + return bmiEnd;
  878 + }
  879 +
  880 + public void setBmiEnd(String bmiEnd) {
  881 + this.bmiEnd = bmiEnd;
864 882 }
865 883 }