Commit 559d5c2bb1d7e648af1fc9a754e33e39ac8fc143
1 parent
8fc1fb874b
Exists in
master
提交代码
Showing 6 changed files with 67 additions and 8 deletions
- mainData/src/main/java/com/lymsh/yimiao/main/data/dao/MedKidsMapper.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateRecordQuery.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/service/MedKidsService.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/service/impl/MedKidsServiceImpl.java
- 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/dao/MedKidsMapper.java
View file @
559d5c2
| 1 | 1 | package com.lymsh.yimiao.main.data.dao; |
| 2 | 2 | |
| 3 | 3 | import com.lymsh.yimiao.main.data.model.KidInoculationRecords; |
| 4 | +import com.lymsh.yimiao.main.data.model.MedInoculateRecordQuery; | |
| 4 | 5 | import com.lymsh.yimiao.main.data.model.MedKids; |
| 5 | 6 | import com.lymsh.yimiao.main.data.model.MedKidsQuery; |
| 6 | 7 | |
| ... | ... | @@ -19,7 +20,9 @@ |
| 19 | 20 | |
| 20 | 21 | public List<MedKids> queryMedKids(MedKidsQuery query); |
| 21 | 22 | |
| 22 | - public List<KidInoculationRecords> queryInoculationRecord(String kids); | |
| 23 | + public List<KidInoculationRecords> queryInoculationRecord(String kidId); | |
| 24 | + | |
| 25 | + public List<KidInoculationRecords> queryInoculationRecords(MedInoculateRecordQuery query); | |
| 23 | 26 | |
| 24 | 27 | } |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateRecordQuery.java
View file @
559d5c2
| ... | ... | @@ -19,6 +19,15 @@ |
| 19 | 19 | private String icIsInoculate; |
| 20 | 20 | private String icJiCi; |
| 21 | 21 | private String isDelete; |
| 22 | + private String recordKidId; | |
| 23 | + | |
| 24 | + public String getRecordKidId() { | |
| 25 | + return recordKidId; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setRecordKidId(String recordKidId) { | |
| 29 | + this.recordKidId = recordKidId; | |
| 30 | + } | |
| 22 | 31 | |
| 23 | 32 | private List<String> ids;//多个id情况 |
| 24 | 33 |
mainData/src/main/java/com/lymsh/yimiao/main/data/service/MedKidsService.java
View file @
559d5c2
| 1 | 1 | package com.lymsh.yimiao.main.data.service; |
| 2 | 2 | |
| 3 | 3 | import com.lymsh.yimiao.main.data.model.KidInoculationRecords; |
| 4 | +import com.lymsh.yimiao.main.data.model.MedInoculateRecordQuery; | |
| 4 | 5 | import com.lymsh.yimiao.main.data.model.MedKids; |
| 5 | 6 | import com.lymsh.yimiao.main.data.model.MedKidsQuery; |
| 6 | 7 | |
| ... | ... | @@ -19,7 +20,9 @@ |
| 19 | 20 | |
| 20 | 21 | public List<MedKids> queryMedKids(MedKidsQuery query); |
| 21 | 22 | |
| 22 | - public List<KidInoculationRecords> queryInoculationRecord(String kids); | |
| 23 | + public List<KidInoculationRecords> queryInoculationRecord(String kidId); | |
| 24 | + | |
| 25 | + public List<KidInoculationRecords> queryInoculationRecords(MedInoculateRecordQuery query); | |
| 23 | 26 | |
| 24 | 27 | } |
mainData/src/main/java/com/lymsh/yimiao/main/data/service/impl/MedKidsServiceImpl.java
View file @
559d5c2
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lymsh.yimiao.main.data.dao.MedKidsMapper; |
| 4 | 4 | import com.lymsh.yimiao.main.data.model.KidInoculationRecords; |
| 5 | +import com.lymsh.yimiao.main.data.model.MedInoculateRecordQuery; | |
| 5 | 6 | import com.lymsh.yimiao.main.data.model.MedKids; |
| 6 | 7 | import com.lymsh.yimiao.main.data.model.MedKidsQuery; |
| 7 | 8 | import com.lymsh.yimiao.main.data.service.MedKidsService; |
| ... | ... | @@ -31,8 +32,13 @@ |
| 31 | 32 | public List<MedKids> queryMedKids (MedKidsQuery query){if (query.getNeed() != null) {query.mysqlBuild(medKidsMapper.queryMedKidsCount(query));}return medKidsMapper.queryMedKids(query);} |
| 32 | 33 | |
| 33 | 34 | @Override |
| 34 | - public List<KidInoculationRecords> queryInoculationRecord(String kids) { | |
| 35 | - return medKidsMapper.queryInoculationRecord(kids); | |
| 35 | + public List<KidInoculationRecords> queryInoculationRecords(MedInoculateRecordQuery query) { | |
| 36 | + return medKidsMapper.queryInoculationRecords(query); | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public List<KidInoculationRecords> queryInoculationRecord(String kidId) { | |
| 41 | + return medKidsMapper.queryInoculationRecord(kidId); | |
| 36 | 42 | } |
| 37 | 43 | } |
mainData/src/main/resources/mainOrm/MedKids.xml
View file @
559d5c2
| ... | ... | @@ -140,7 +140,33 @@ |
| 140 | 140 | </select> |
| 141 | 141 | |
| 142 | 142 | |
| 143 | - | |
| 143 | + <select id="queryInoculationRecords" resultMap="KidInoculationRecordMap" parameterType="com.lymsh.yimiao.main.data.model.MedInoculateRecordQuery"> | |
| 144 | + SELECT D.KI_NAME, | |
| 145 | + TO_DATE(D.KI_BIRTHDAY,'YYYY/MM/DD') AS KI_BIRTHDAY, | |
| 146 | + B.IC_KIDID, | |
| 147 | + B.IC_ID, | |
| 148 | + B.IC_VACCINEID, | |
| 149 | + TO_DATE(B.IC_INOCULATETIME,'YYYY/MM/DD') AS IC_INOCULATETIME, | |
| 150 | + TRUNC(MONTHS_BETWEEN(TO_DATE(B.IC_INOCULATETIME,'YYYY/MM/DD'),TO_DATE(D.KI_BIRTHDAY,'YYYY/MM/DD'))) AS MONTH_AGE, | |
| 151 | + B.IC_JICI, | |
| 152 | + C.VI_NAME, | |
| 153 | + A.VN_NAME, | |
| 154 | + A.VN_ID, | |
| 155 | + A.VN_VACCINETYPE, | |
| 156 | + CCC.CNT | |
| 157 | + FROM med_InoculateRecord B | |
| 158 | + INNER JOIN med_Vaccineinfo C ON B.IC_VACCINEID=C.VI_ID AND C.ISDELETE=1 | |
| 159 | + INNER JOIN med_VaccineName A ON C.VI_VACCINENAMEID=A.VN_ID AND A.ISDELETE=1 | |
| 160 | + INNER JOIN MED_KIDS D ON B.IC_KIDID=D.KI_ID | |
| 161 | + INNER JOIN (SELECT AA.VN_NAME,COUNT(DISTINCT b.column_value) AS CNT | |
| 162 | + FROM med_VaccineName AA, table(splitstr(AA.VN_MONTHAGE, ',')) b | |
| 163 | + WHERE AA.VN_MONTHAGE IS NOT NULL | |
| 164 | + AND AA.ISDELETE = 1 | |
| 165 | + GROUP BY AA.VN_NAME) CCC ON A.VN_NAME=CCC.VN_NAME | |
| 166 | + WHERE B.IC_DELETE = 1 | |
| 167 | + AND B.IC_KIDID= #{recordKidId,jdbcType=VARCHAR} | |
| 168 | + <include refid="orderAndLimit" /> | |
| 169 | + </select> | |
| 144 | 170 | |
| 145 | 171 | </mapper> |
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
View file @
559d5c2
| ... | ... | @@ -269,7 +269,7 @@ |
| 269 | 269 | * @param id 宝宝id |
| 270 | 270 | */ |
| 271 | 271 | @RequestMapping(value = "/babys", method = RequestMethod.GET) |
| 272 | - //@TokenRequired | |
| 272 | + @TokenRequired | |
| 273 | 273 | public void getKids(HttpServletResponse response, |
| 274 | 274 | @RequestParam("id") String id) { |
| 275 | 275 | if (StringUtils.isBlank(id)) { |
| 276 | 276 | |
| 277 | 277 | |
| ... | ... | @@ -277,16 +277,28 @@ |
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | + Map<String, Object> map = new HashMap<>(); | |
| 281 | + | |
| 282 | +// MedInoculateRecordQuery recordQuery = new MedInoculateRecordQuery(); | |
| 283 | +// recordQuery.setRecordKidId(id); | |
| 284 | +// recordQuery.setSort("IC_INOCULATETIME desc"); | |
| 285 | +// List<KidInoculationRecords> recordsAsc = medKidsService.queryInoculationRecords(recordQuery); | |
| 286 | + | |
| 280 | 287 | List<KidInoculationRecords> recordsList = medKidsService.queryInoculationRecord(id); |
| 281 | 288 | |
| 289 | + if (CollectionUtils.isNotEmpty(recordsList)){ | |
| 290 | + //最后一次接种时间 | |
| 291 | + map.put("lastInculateTime",DateUtil.getSecond(DateUtil.parseYMDHMS(recordsList.get(0).getInoculateTime()))); | |
| 292 | + }else { | |
| 293 | + map.put("lastInculateTime",""); | |
| 294 | + } | |
| 295 | + | |
| 282 | 296 | //取出建档最早的那个 |
| 283 | 297 | MedKidsQuery query = new MedKidsQuery(); |
| 284 | 298 | query.setIsDelete(isDelete); |
| 285 | 299 | query.setId(id); |
| 286 | 300 | query.setSort("KI_BUILDTIME DESC"); |
| 287 | 301 | List<MedKids> medKidList = medKidsService.queryMedKids(query); |
| 288 | - | |
| 289 | - Map<String, Object> map = new HashMap<>(); | |
| 290 | 302 | |
| 291 | 303 | if (CollectionUtils.isNotEmpty(medKidList)) { |
| 292 | 304 | //取出第一个宝宝 |