Commit 0f28138ac45d10d7121b2524663c280784eb5cba
1 parent
d520fd4a2a
Exists in
master
提交代码
Showing 6 changed files with 86 additions and 21 deletions
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/KidInoculationRecords.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateOrder.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateOrderQuery.java
- mainData/src/main/resources/mainOrm/MedInoculateorder.xml
- mainData/src/main/resources/mainOrm/MedKids.xml
- webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
mainData/src/main/java/com/lymsh/yimiao/main/data/model/KidInoculationRecords.java
View file @
0f28138
| ... | ... | @@ -18,6 +18,15 @@ | 
| 18 | 18 | private String vaccineNameTitle; | 
| 19 | 19 | private String vaccineType; | 
| 20 | 20 | private Integer cnt; | 
| 21 | + private String vaccineNameId; | |
| 22 | + | |
| 23 | + public String getVaccineNameId() { | |
| 24 | + return vaccineNameId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setVaccineNameId(String vaccineNameId) { | |
| 28 | + this.vaccineNameId = vaccineNameId; | |
| 29 | + } | |
| 21 | 30 | |
| 22 | 31 | public String getBirthday() { | 
| 23 | 32 | return birthday; | 
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateOrder.java
View file @
0f28138
| ... | ... | @@ -11,6 +11,15 @@ | 
| 11 | 11 | private String ioInoculateTime; | 
| 12 | 12 | private String ioOrderOPer; | 
| 13 | 13 | private String ioOrderTime; | 
| 14 | + private String ioIsDelete; | |
| 15 | + | |
| 16 | + public String getIoIsDelete() { | |
| 17 | + return ioIsDelete; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setIoIsDelete(String ioIsDelete) { | |
| 21 | + this.ioIsDelete = ioIsDelete; | |
| 22 | + } | |
| 14 | 23 | |
| 15 | 24 | public String getIoId() { | 
| 16 | 25 | return ioId; | 
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateOrderQuery.java
View file @
0f28138
| ... | ... | @@ -14,6 +14,16 @@ | 
| 14 | 14 | private String ioOrderOPer; | 
| 15 | 15 | private String ioOrderTime; | 
| 16 | 16 | |
| 17 | + public String getIoIsDelete() { | |
| 18 | + return ioIsDelete; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setIoIsDelete(String ioIsDelete) { | |
| 22 | + this.ioIsDelete = ioIsDelete; | |
| 23 | + } | |
| 24 | + | |
| 25 | + private String ioIsDelete; | |
| 26 | + | |
| 17 | 27 | private List<String> ids;//多个id情况 | 
| 18 | 28 | |
| 19 | 29 | public List<String> getIds() { | 
mainData/src/main/resources/mainOrm/MedInoculateorder.xml
View file @
0f28138
| ... | ... | @@ -11,10 +11,11 @@ | 
| 11 | 11 | <result column="io_inoculateTime" property="ioInoculateTime" jdbcType="VARCHAR" /> | 
| 12 | 12 | <result column="io_orderOper" property="ioOrderOPer" jdbcType="VARCHAR" /> | 
| 13 | 13 | <result column="io_orderTime" property="ioOrderTime" jdbcType="VARCHAR" /> | 
| 14 | +<result column="io_isDelete" property="ioIsDelete" jdbcType="VARCHAR" /> | |
| 14 | 15 | </resultMap> | 
| 15 | 16 | |
| 16 | 17 | <select id="getMedInoculateOrder" resultMap="MedInoculateOrderResultMap" parameterType="java.lang.String"> | 
| 17 | -select io_id,io_kidId,io_vaccineId,io_organizationId,io_inoculateDate,io_inoculateTime,io_orderOper,io_orderTime | |
| 18 | +select io_id,io_kidId,io_vaccineId,io_organizationId,io_inoculateDate,io_inoculateTime,io_orderOper,io_orderTime,io_isDelete | |
| 18 | 19 | FROM med_inoculateorder | 
| 19 | 20 | WHERE io_id = #{ioId,jdbcType=VARCHAR} | 
| 20 | 21 | </select> | 
| 21 | 22 | |
| ... | ... | @@ -58,13 +59,16 @@ | 
| 58 | 59 | <if test="ioOrderTime != null and ioOrderTime != ''"> | 
| 59 | 60 | and io_orderTime = #{ioOrderTime,jdbcType=VARCHAR} | 
| 60 | 61 | </if> | 
| 62 | + <if test="ioIsDelete != null and ioIsDelete != ''"> | |
| 63 | + and io_isDelete = #{ioIsDelete,jdbcType=VARCHAR} | |
| 64 | + </if> | |
| 61 | 65 | </where> | 
| 62 | 66 | </sql> | 
| 63 | 67 | |
| 64 | 68 | |
| 65 | 69 | |
| 66 | 70 | <select id="queryMedInoculateOrder" resultMap="MedInoculateOrderResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedInoculateOrderQuery"> | 
| 67 | -select io_id,io_kidId,io_vaccineId,io_organizationId,io_inoculateDate,io_inoculateTime,io_orderOper,io_orderTime | |
| 71 | +select io_id,io_kidId,io_vaccineId,io_organizationId,io_inoculateDate,io_inoculateTime,io_orderOper,io_orderTime,io_isDelete | |
| 68 | 72 | from med_inoculateorder | 
| 69 | 73 | <include refid="MedInoculateOrderCondition" /> | 
| 70 | 74 | <include refid="orderAndLimit" /> | 
mainData/src/main/resources/mainOrm/MedKids.xml
View file @
0f28138
| ... | ... | @@ -108,6 +108,7 @@ | 
| 108 | 108 | <result column="VN_NAME" property="vaccineNameTitle" jdbcType="VARCHAR" /> | 
| 109 | 109 | <result column="VN_VACCINETYPE" property="vaccineType" jdbcType="VARCHAR" /> | 
| 110 | 110 | <result column="CNT" property="cnt" jdbcType="INTEGER" /> | 
| 111 | + <result column="VN_ID" property="vaccineNameId" jdbcType="VARCHAR" /> | |
| 111 | 112 | </resultMap> | 
| 112 | 113 | |
| 113 | 114 | <select id="queryInoculationRecord" resultMap="KidInoculationRecordMap" parameterType="java.lang.String"> | 
| ... | ... | @@ -121,6 +122,7 @@ | 
| 121 | 122 | B.IC_JICI, | 
| 122 | 123 | C.VI_NAME, | 
| 123 | 124 | A.VN_NAME, | 
| 125 | + A.VN_ID, | |
| 124 | 126 | A.VN_VACCINETYPE, | 
| 125 | 127 | CCC.CNT | 
| 126 | 128 | FROM med_InoculateRecord B | 
| ... | ... | @@ -134,7 +136,8 @@ | 
| 134 | 136 | GROUP BY AA.VN_NAME) CCC ON A.VN_NAME=CCC.VN_NAME | 
| 135 | 137 | WHERE B.IC_DELETE = 1 | 
| 136 | 138 | AND B.IC_KIDID= #{recordKidId,jdbcType=VARCHAR} | 
| 137 | - </select> | |
| 139 | + ORDER BY IC_INOCULATETIME DESC | |
| 140 | +</select> | |
| 138 | 141 | |
| 139 | 142 | |
| 140 | 143 | 
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
View file @
0f28138
| ... | ... | @@ -302,35 +302,65 @@ | 
| 302 | 302 | map.put("birthday", DateUtil.getSecond(DateUtil.parseYMD(kids.getBirthday()))); | 
| 303 | 303 | map.put("avatar", null);//先给默认头像 | 
| 304 | 304 | |
| 305 | + //下次接种疫苗 | |
| 305 | 306 | MedInoculateOrderQuery inoculateorderQuery = new MedInoculateOrderQuery(); | 
| 306 | 307 | inoculateorderQuery.setIoKidId(kids.getId()); | 
| 307 | - //时间倒序 | |
| 308 | - inoculateorderQuery.setSort("io_inoculateDate desc"); | |
| 308 | + inoculateorderQuery.setIoIsDelete(isDelete); | |
| 309 | 309 | List<MedInoculateOrder> inoculateorderList = medInoculateorderService.queryMedInoculateOrder(inoculateorderQuery); | 
| 310 | - if (CollectionUtils.isNotEmpty(inoculateorderList)) { | |
| 311 | - //取出离现在日期最近的一个预约接种 | |
| 312 | - MedInoculateOrder medInoculateorder = inoculateorderList.get(0); | |
| 313 | - //下次接种时间 | |
| 314 | - map.put("ioInoculateDate", DateUtil.getSecond(DateUtil.parseYMD(medInoculateorder.getIoInoculateDate()))); | |
| 315 | - //下次接种疫苗 | |
| 316 | - map.put("vaccineId", medInoculateorder.getIoVaccineId()); | |
| 317 | - MedVaccineName medVaccineName = medVaccineNameService.getMedVaccineName(medInoculateorder.getIoVaccineId()); | |
| 318 | - map.put("vaccineName", medVaccineName == null ? "" : medVaccineName.getVnName()); | |
| 319 | - //剂次 | |
| 320 | - int sum = medVaccineName.getVnMonthAge().split(",").length; | |
| 321 | 310 | |
| 311 | + List<Map> list = new ArrayList<>(); | |
| 322 | 312 | |
| 313 | + if (CollectionUtils.isNotEmpty(inoculateorderList)) { | |
| 323 | 314 | |
| 324 | 315 | //接种地点 | 
| 325 | - map.put("organizationId", medInoculateorder.getIoOrganizationId()); | |
| 326 | - MedOrganization medOrganization = medOrganizationService.getMedOrganization(medInoculateorder.getIoOrganizationId()); | |
| 316 | + MedInoculateOrder order = inoculateorderList.get(0); | |
| 317 | + map.put("organizationId", order.getIoOrganizationId()); | |
| 318 | + MedOrganization medOrganization = medOrganizationService.getMedOrganization(order.getIoOrganizationId()); | |
| 327 | 319 | map.put("organizationName", medOrganization == null ? "" : medOrganization.getoName()); | 
| 320 | + | |
| 321 | + for (MedInoculateOrder data : inoculateorderList){ | |
| 322 | + Map<String, Object> orderMap = new HashMap<>(); | |
| 323 | + //下次接种时间 | |
| 324 | + orderMap.put("ioInoculateDate", DateUtil.getSecond(DateUtil.parseYMD(data.getIoInoculateDate()))); | |
| 325 | + //下次接种疫苗ID | |
| 326 | + orderMap.put("vaccineId", data.getIoVaccineId()); | |
| 327 | + //下次接种疫苗名称 | |
| 328 | + MedVaccineName medVaccineName = medVaccineNameService.getMedVaccineName(data.getIoVaccineId()); | |
| 329 | + orderMap.put("vaccineName", medVaccineName == null ? "" : medVaccineName.getVnName()); | |
| 330 | + //剂次 | |
| 331 | + if (medVaccineName != null) { | |
| 332 | + //总针数 | |
| 333 | + int sum = medVaccineName.getVnMonthAge().split(",").length; | |
| 334 | + //预约打第几针 | |
| 335 | + int jiCi = 1; | |
| 336 | + | |
| 337 | + if (CollectionUtils.isNotEmpty(recordsList)) { | |
| 338 | + for (KidInoculationRecords records : recordsList) { | |
| 339 | + if (data.getIoVaccineId().equals(records.getVaccineNameId())) { | |
| 340 | + if (records.getJiCi() < sum) { | |
| 341 | + jiCi = jiCi + records.getJiCi(); | |
| 342 | + } | |
| 343 | + } | |
| 344 | + } | |
| 345 | + } | |
| 346 | + orderMap.put("sum",sum); | |
| 347 | + orderMap.put("jiCi",jiCi); | |
| 348 | + } | |
| 349 | + list.add(orderMap); | |
| 350 | + } | |
| 351 | + map.put("inoculate",list); | |
| 352 | + | |
| 328 | 353 | } else { | 
| 329 | - map.put("ioInoculateDate", null); | |
| 330 | - map.put("vaccineId", null); | |
| 331 | - map.put("vaccineName", null); | |
| 332 | 354 | map.put("organizationId", null); | 
| 333 | 355 | map.put("organizationName", null); | 
| 356 | + Map<String, Object> orderMap = new HashMap<>(); | |
| 357 | + orderMap.put("ioInoculateDate", null); | |
| 358 | + orderMap.put("vaccineId", null); | |
| 359 | + orderMap.put("vaccineName", null); | |
| 360 | + orderMap.put("sum",""); | |
| 361 | + orderMap.put("jiCi",""); | |
| 362 | + list.add(orderMap); | |
| 363 | + map.put("inoculate",list); | |
| 334 | 364 | } | 
| 335 | 365 | } else { | 
| 336 | 366 | ResultUtils.buildParameterErrorResultAndWrite(response, "宝宝信息不存在"); |