Commit 031ddcd9bcd13651ba5b7c733db3462ef43ef747

Authored by litao@lymsh.com
1 parent cbb4d8e80f

改bug

Showing 3 changed files with 96 additions and 75 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 031ddcd
... ... @@ -115,6 +115,6 @@
115 115  
116 116 Integer findUnUsedPeopleInfoCount(Map<String, Object> param);
117 117  
118   - int findMulitPatientCount(List<String> sendUserIds);
  118 + List<Map<String, Object>> findMulitPatienInfo(List<String> sendUserIds);
119 119 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 031ddcd
... ... @@ -16,6 +16,7 @@
16 16 import com.lyms.platform.operate.web.result.HighScoreResult;
17 17 import com.lyms.platform.operate.web.result.ResidentsPageResult;
18 18 import com.lyms.platform.operate.web.utils.*;
  19 +import com.lyms.platform.permission.dao.master.CouponMapper;
19 20 import com.lyms.platform.permission.model.Organization;
20 21 import com.lyms.platform.permission.model.Users;
21 22 import com.lyms.platform.permission.service.CouponService;
22 23  
... ... @@ -97,7 +98,10 @@
97 98 @Autowired
98 99 private MongoTemplate mongoTemplate;
99 100  
  101 + @Autowired
  102 + private CouponMapper couponMapper;
100 103  
  104 +
101 105 /**
102 106 * 建档查询
103 107 *
104 108  
... ... @@ -131,7 +135,11 @@
131 135 {
132 136  
133 137 Map<String, Object> map = new HashMap<>();
  138 + map.put("lastMenstrualPeriodBasis", BasisEnums.getName(data.getLastMenstrualPeriodBasis()));
  139 + map.put("lastMenstrualPeriodBasisDoctorId", couponMapper.findUserName(data.getLastMenstrualPeriodBasis()));
  140 + map.put("lastMenstrualPeriodBasisDate", data.getLastMenstrualPeriodBasisDate());
134 141  
  142 +
135 143 map.put("isSendCoupon", data.isSendCoupon() == null ? false : data.isSendCoupon());
136 144  
137 145 map.put("mensStartDay", data.getMensStartDay());
... ... @@ -1637,7 +1645,8 @@
1637 1645 }
1638 1646  
1639 1647 if (placenta.get("gjkd") != null) {
1640   - placetaMap.put("gjkd", UnitUtils.unitSplice(placenta.get("gjkd"), UnitConstants.CM));
  1648 +// placetaMap.put("gjkd", UnitUtils.unitSplice(placenta.get("gjkd"), UnitConstants.CM));
  1649 + placetaMap.put("gjkd", UnitUtils.unitSplice(placenta.get("gjkd"), ""));
1641 1650 }
1642 1651  
1643 1652 if (placenta.get("gjrs") != null) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 031ddcd
... ... @@ -596,7 +596,7 @@
596 596 map.put("hospitalName", couponMapper.findHospitalNameById(patient.getHospitalId()));
597 597 }
598 598 }
599   - map.put("checkTime", getCheckTime((Integer) map.get("type"), (String) map.get("user_id")));
  599 + map.put("checkTime", getCheckTime((Integer) map.get("type"), (String) map.get("user_id")));
600 600 restList.add(map);
601 601 }
602 602 Integer count = couponMapper.findUnUsedInfoCount(CollectionUtils.createMap("userIds", userIds, "hospitalId", hospitalId));
... ... @@ -737,7 +737,7 @@
737 737 Map<String, Object> temp = new HashMap<>();
738 738 Patients pt = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "created")), Patients.class);
739 739 if(pt != null) {
740   - temp.put("username", pt.getUsername());
  740 + temp.put("username", pt.getUsername());
741 741 temp.put("phone", com.lyms.platform.common.utils.StringUtils.encryPhone(pt.getPhone()));
742 742 temp.put("cardNo", com.lyms.platform.common.utils.StringUtils.encryCardNo(pt.getCardNo()));
743 743 String residenceAddress = findName(pt.getProvinceRegisterId()) + findName(pt.getCityRegisterId()) + findName(pt.getAreaRegisterId()) + findName(pt.getStreetRegisterId()) + pt.getAddressRegister();
744 744  
745 745  
746 746  
747 747  
748 748  
749 749  
750 750  
... ... @@ -903,29 +903,41 @@
903 903 }
904 904 // return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap, "reportModel", reportModel);
905 905  
  906 + /** 处理多产程问题 */
906 907 for (Map<String, Object> map : couponReport) {
907 908 List<String> sendUserIds = (List<String>) map.get("sendUserIds");
  909 + List<String> sendUserIds2 = new ArrayList<>();
908 910 if(CollectionUtils.isNotEmpty(sendUserIds)) {
909   - int addSendcount = couponMapper.findMulitPatientCount(sendUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
910   - map.put("people_send_count", ((Long) map.get("people_send_count")) + addSendcount);
911   - for (int i = 0; i < addSendcount; i++) {
912   - sendUserIds.add(UUID.randomUUID().toString());
  911 + List<Map<String, Object>> mulitPatienInfo = couponMapper.findMulitPatienInfo(sendUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
  912 + for (Map<String, Object> m : mulitPatienInfo) {
  913 + Integer count = (Integer) m.get("count");
  914 + sendUserIds2.add((String) m.get("user_id"));
  915 + if(count > 1) {
  916 + for (int i = 1; i < count; i++) {
  917 + sendUserIds2.add(m.get("user_id") + "___" + (i + 1));
  918 + }
  919 + }
913 920 }
914 921 }
  922 + map.put("sendUserIds", sendUserIds2);
915 923  
916 924 List<String> usedUserIds = (List<String>) map.get("usedUserIds");
  925 + List<String> usedUserIds2 = new ArrayList<>();
917 926 if(CollectionUtils.isNotEmpty(usedUserIds)) {
918   - int addUsedcount = couponMapper.findMulitPatientCount(usedUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
919   - map.put("user_used_count", (((Long) map.get("user_used_count")) + addUsedcount) );
920   - for (int i = 0; i < addUsedcount; i++) {
921   - usedUserIds.add(UUID.randomUUID().toString());
  927 + List<Map<String, Object>> mulitPatienInfo = couponMapper.findMulitPatienInfo(usedUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
  928 + for (Map<String, Object> m : mulitPatienInfo) {
  929 + Integer count = (Integer) m.get("count");
  930 + usedUserIds2.add((String) m.get("user_id"));
  931 + if(count > 1) {
  932 + for (int i = 1; i < count; i++) {
  933 + usedUserIds2.add(m.get("user_id") + "___" + (i + 1));
  934 + }
  935 + }
922 936 }
923 937 }
924   -
925   -
926   -
  938 + map.put("usedUserIds", usedUserIds2);
927 939 }
928   -
  940 +
929 941 return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap, "reportModel", reportModal);
930 942 }
931 943  
... ... @@ -1113,7 +1125,7 @@
1113 1125 coupon.put(s, 0);
1114 1126 }
1115 1127 }
1116   - }
  1128 + }
1117 1129 Map<String, Object> temp = new LinkedHashMap<>();
1118 1130 Set<String> keys = titleMap.keySet();
1119 1131 for (String key : keys) {
... ... @@ -1134,9 +1146,9 @@
1134 1146 Map<String, Object> sortTemp = new TreeMap<>(
1135 1147 new Comparator<String>() {
1136 1148 public int compare(String obj1, String obj2) {
1137   - return obj1.compareTo(obj2);
1138   - }
1139   - });
  1149 + return obj1.compareTo(obj2);
  1150 + }
  1151 + });
1140 1152 for (String key : keys) {
1141 1153 if(key.startsWith("10")) {
1142 1154 sortTemp.put(key, titleMap.get(key));
... ... @@ -1267,8 +1279,8 @@
1267 1279 couponInfo.put("use_date", DateUtil.getyyyy_MM_dd(useDate));
1268 1280 /** 设置产检日期、姓名、产检孕周、产检第次、产检机构、产检医生、联系电话 */
1269 1281 setUsedInfo((Integer) couponInfo.get("type"), (String) couponInfo.get("used_id"),
1270   - (String) couponInfo.get("sequence_id"), useDate, (String) couponInfo.get("operator_use_id"), couponInfo
1271   - );
  1282 + (String) couponInfo.get("sequence_id"), useDate, (String) couponInfo.get("operator_use_id"), couponInfo
  1283 + );
1272 1284 }
1273 1285 }
1274 1286 int count = couponMapper.findCouponInfoCount(param);
... ... @@ -1429,7 +1441,7 @@
1429 1441 username = findUserNameByPid(maternalDeliverModel.getPid());
1430 1442 Patients patients = mongoTemplate.findById(maternalDeliverModel.getParentId(), Patients.class);
1431 1443 if(patients != null) {
1432   - phone = patients.getPhone();
  1444 + phone = patients.getPhone();
1433 1445 }
1434 1446 }
1435 1447 } else if(type == 5) {
... ... @@ -1562,18 +1574,18 @@
1562 1574 Integer number = 1;
1563 1575 List<T> lists = mongoTemplate.find(Query.query(Criteria.where(key).is(value)).with(new Sort(Sort.Direction.ASC, sortField)), clazz);
1564 1576 if(CollectionUtils.isNotEmpty(lists)) {
1565   - try {
1566   - for(int i = 0; i < lists.size(); i++) {
1567   - T t = lists.get(i);
1568   - String tId = ReflectUtil.invoke(t, "getId") + "";
1569   - String currentId = ReflectUtil.invoke(current, "getId") + "";
1570   - if(StringUtils.isNotEmpty(tId) && StringUtils.isNotEmpty(currentId) && tId.equals(currentId)) {
1571   - number = ++i;
1572   - }
1573   - }
1574   - } catch (Exception e) {
1575   - e.printStackTrace();
1576   - }
  1577 + try {
  1578 + for(int i = 0; i < lists.size(); i++) {
  1579 + T t = lists.get(i);
  1580 + String tId = ReflectUtil.invoke(t, "getId") + "";
  1581 + String currentId = ReflectUtil.invoke(current, "getId") + "";
  1582 + if(StringUtils.isNotEmpty(tId) && StringUtils.isNotEmpty(currentId) && tId.equals(currentId)) {
  1583 + number = ++i;
  1584 + }
  1585 + }
  1586 + } catch (Exception e) {
  1587 + e.printStackTrace();
  1588 + }
1577 1589 }
1578 1590 return number;
1579 1591 }
... ... @@ -1643,7 +1655,7 @@
1643 1655  
1644 1656 /** 出院小结: lyms_discharge_abstract_mother 医院需要确定下 */
1645 1657 Criteria disCriteria = Criteria.where("createDate").gte(DateUtil.getYearDate(year))
1646   - .lt(DateUtil.getNextYearDate(year)).and("yn").nin(0);
  1658 + .lt(DateUtil.getNextYearDate(year)).and("yn").nin(0);
1647 1659 List<DischargeAbstractMotherModel> dischargeAbstractMotherModels = mongoUtil.findField(DischargeAbstractMotherModel.class, disCriteria, "patientId");
1648 1660 for (DischargeAbstractMotherModel dischargeAbstractMotherModel : dischargeAbstractMotherModels) {
1649 1661 patientIds.add(dischargeAbstractMotherModel.getPatientId());
1650 1662  
1651 1663  
1652 1664  
1653 1665  
... ... @@ -1798,47 +1810,47 @@
1798 1810 tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1799 1811 }
1800 1812 } else {
1801   - for (Patients patient : patients) {
1802   - /** 查出所有符合条件的patients */
1803   - Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0");
1804   - if(startDate != null && endDate != null) {
1805   - criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
1806   - }
1807   - if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */
1808   - criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek));
1809   - }
1810   - if(childBirth != null) {
1811   - criteria.and("type").is(childBirth);
1812   - }
1813   - List<Patients> p = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid");
1814   - List<String> patientIds = CollectionUtils.getId(p, "id", String.class);
  1813 + for (Patients patient : patients) {
  1814 + /** 查出所有符合条件的patients */
  1815 + Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("yn").ne("0");
  1816 + if(startDate != null && endDate != null) {
  1817 + criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1));
  1818 + }
  1819 + if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */
  1820 + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)).gte(DateUtil.getWeekDay(-endWeek));
  1821 + }
  1822 + if(childBirth != null) {
  1823 + criteria.and("type").is(childBirth);
  1824 + }
  1825 + List<Patients> p = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid");
  1826 + List<String> patientIds = CollectionUtils.getId(p, "id", String.class);
1815 1827  
1816   - /** 初诊数据 */
1817   - Criteria c = Criteria.where("hospitalId").is(hospitalId).and("parentId").in(patientIds).and("pid").is(pid);
1818   - Long antExChuModelCount = mongoTemplate.count(Query.query(c), AntExChuModel.class);
1819   - Long antExModelCount = mongoTemplate.count(Query.query(c), AntenatalExaminationModel.class);
1820   - if(antExChuModelCount.intValue() + antExModelCount.intValue() == number) {
1821   - tempMap.put("NAME", patient.getUsername());
1822   - tempMap.put("YUNZHOU", DateUtil.getWeek(patient.getLastMenses(), patient.getLastCTime()));
1823   - String riskLevelId = patient.getRiskLevelId();
1824   - if(StringUtils.isNotBlank(riskLevelId)) {
1825   - List<String> basicIds = JSON.parseArray(riskLevelId, String.class);
1826   - String HIGH_RISK_GRADE = "";
1827   - for (String basicId : basicIds) {
1828   - HIGH_RISK_GRADE = HIGH_RISK_GRADE + mongoUtil.findName(basicId) + ",";
1829   - }
1830   - tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */
  1828 + /** 初诊数据 */
  1829 + Criteria c = Criteria.where("hospitalId").is(hospitalId).and("parentId").in(patientIds).and("pid").is(pid);
  1830 + Long antExChuModelCount = mongoTemplate.count(Query.query(c), AntExChuModel.class);
  1831 + Long antExModelCount = mongoTemplate.count(Query.query(c), AntenatalExaminationModel.class);
  1832 + if(antExChuModelCount.intValue() + antExModelCount.intValue() == number) {
  1833 + tempMap.put("NAME", patient.getUsername());
  1834 + tempMap.put("YUNZHOU", DateUtil.getWeek(patient.getLastMenses(), patient.getLastCTime()));
  1835 + String riskLevelId = patient.getRiskLevelId();
  1836 + if(StringUtils.isNotBlank(riskLevelId)) {
  1837 + List<String> basicIds = JSON.parseArray(riskLevelId, String.class);
  1838 + String HIGH_RISK_GRADE = "";
  1839 + for (String basicId : basicIds) {
  1840 + HIGH_RISK_GRADE = HIGH_RISK_GRADE + mongoUtil.findName(basicId) + ",";
1831 1841 }
1832   - tempMap.put("HIGH_RISK_FACTOR", patient.getoRiskFactor()); /** 风险因素 */
1833   - tempMap.put("EDD_DATE", patient.getDueDate());
1834   - tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(patient.getLastCTime()));
1835   - String prodDoctor = patient.getBookbuildingDoctor();
1836   - if(StringUtils.isNotBlank(prodDoctor)) {
1837   - Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
1838   - tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
1839   - }
  1842 + tempMap.put("HIGH_RISK_GRADE", HIGH_RISK_GRADE.substring(0, HIGH_RISK_GRADE.length() - 1)); /** 高危等级 */
1840 1843 }
  1844 + tempMap.put("HIGH_RISK_FACTOR", patient.getoRiskFactor()); /** 风险因素 */
  1845 + tempMap.put("EDD_DATE", patient.getDueDate());
  1846 + tempMap.put("LAST_EXAMINE_DATE", DateUtil.getyyyy_MM_dd(patient.getLastCTime()));
  1847 + String prodDoctor = patient.getBookbuildingDoctor();
  1848 + if(StringUtils.isNotBlank(prodDoctor)) {
  1849 + Users users = usersService.getUsers(Integer.parseInt(prodDoctor));
  1850 + tempMap.put("DOCTOR_NAME", users == null ? null : users.getName());
  1851 + }
1841 1852 }
  1853 + }
1842 1854 }
1843 1855 }
1844 1856  
... ... @@ -1881,7 +1893,7 @@
1881 1893 for (Map<String, Object> data : datas) {
1882 1894 String pid = (String) data.get("pid");
1883 1895 if(userCheckInfo.containsKey(pid)) {
1884   - userCheckInfo.get(pid).add(data);
  1896 + userCheckInfo.get(pid).add(data);
1885 1897 } else {
1886 1898 List<Map<String, Object>> maps = new ArrayList<>();
1887 1899 maps.add(data);