Commit 2e8d663b45d852d1b6f607b10cccd02e72e533a4
1 parent
905d7b7959
Exists in
master
提交代码
Showing 11 changed files with 254 additions and 47 deletions
- mainData/src/main/java/com/lymsh/yimiao/main/data/enumdata/MouthAgeEnum.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedFactory.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedFactoryQuery.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedOrganization.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedOrganizationQuery.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineInfo.java
- mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineInfoQuery.java
- mainData/src/main/resources/mainOrm/MedFactory.xml
- mainData/src/main/resources/mainOrm/MedOrganization.xml
- mainData/src/main/resources/mainOrm/MedVaccineinfo.xml
- webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
mainData/src/main/java/com/lymsh/yimiao/main/data/enumdata/MouthAgeEnum.java
View file @
2e8d663
| 1 | +package com.lymsh.yimiao.main.data.enumdata; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by riecard on 15/9/28. | |
| 5 | + */ | |
| 6 | +public enum MouthAgeEnum { | |
| 7 | + | |
| 8 | + | |
| 9 | + zero(0,"0月龄"), | |
| 10 | + one(1,"1月龄"), | |
| 11 | + two(2,"2月龄"), | |
| 12 | + three(3,"3月龄"), | |
| 13 | + four(4,"4月龄"), | |
| 14 | + five(5,"5月龄"), | |
| 15 | + six(6,"6月龄"), | |
| 16 | + seven(7,"7月龄"), | |
| 17 | + eight(8,"8月龄"), | |
| 18 | + nine(9,"9月龄"), | |
| 19 | + ten(10,"10月龄"), | |
| 20 | + eleven(11,"11月龄"), | |
| 21 | + oneYear(12,"一周岁"), | |
| 22 | + oneYearHalf(18,"一岁半"), | |
| 23 | + twoYear(24,"2周岁"), | |
| 24 | + threeYear(36,"3周岁"), | |
| 25 | + fourYear(48,"4周岁"), | |
| 26 | + sixYear(72,"6周岁"); | |
| 27 | + | |
| 28 | + private MouthAgeEnum(Integer id, String title) { | |
| 29 | + this.id = id; | |
| 30 | + this.title = title; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public static String getTitle(Integer id) { | |
| 34 | + for (MouthAgeEnum e: MouthAgeEnum.values()) { | |
| 35 | + if (e.getId() == id) { | |
| 36 | + return e.getTitle(); | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return ""; | |
| 40 | + } | |
| 41 | + | |
| 42 | + private Integer id; | |
| 43 | + private String title; | |
| 44 | + | |
| 45 | + public Integer getId() { | |
| 46 | + return id; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setId(Integer id) { | |
| 50 | + this.id = id; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public String getTitle() { | |
| 54 | + return title; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setTitle(String title) { | |
| 58 | + this.title = title; | |
| 59 | + } | |
| 60 | +} |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedFactory.java
View file @
2e8d663
| ... | ... | @@ -6,6 +6,15 @@ |
| 6 | 6 | private String fId; |
| 7 | 7 | private String fName; |
| 8 | 8 | private String fIsValid; |
| 9 | + private String isDelete; | |
| 10 | + | |
| 11 | + public String getIsDelete() { | |
| 12 | + return isDelete; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setIsDelete(String isDelete) { | |
| 16 | + this.isDelete = isDelete; | |
| 17 | + } | |
| 9 | 18 | |
| 10 | 19 | public String getFId() { |
| 11 | 20 | return fId; |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedFactoryQuery.java
View file @
2e8d663
| ... | ... | @@ -10,6 +10,15 @@ |
| 10 | 10 | private String fId; |
| 11 | 11 | private String fName; |
| 12 | 12 | private String fIsValid; |
| 13 | + private String isDelete; | |
| 14 | + | |
| 15 | + public String getIsDelete() { | |
| 16 | + return isDelete; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setIsDelete(String isDelete) { | |
| 20 | + this.isDelete = isDelete; | |
| 21 | + } | |
| 13 | 22 | |
| 14 | 23 | public String getFId() { |
| 15 | 24 | return fId; |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedOrganization.java
View file @
2e8d663
| ... | ... | @@ -14,6 +14,15 @@ |
| 14 | 14 | private String oVillageNo; |
| 15 | 15 | private String oAddress; |
| 16 | 16 | private String oIsValid; |
| 17 | + private String isDelete; | |
| 18 | + | |
| 19 | + public String getIsDelete() { | |
| 20 | + return isDelete; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setIsDelete(String isDelete) { | |
| 24 | + this.isDelete = isDelete; | |
| 25 | + } | |
| 17 | 26 | |
| 18 | 27 | public String getoId() { |
| 19 | 28 | return oId; |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedOrganizationQuery.java
View file @
2e8d663
| ... | ... | @@ -18,6 +18,15 @@ |
| 18 | 18 | private String oVillageNo; |
| 19 | 19 | private String oAddress; |
| 20 | 20 | private String oIsValid; |
| 21 | + private String isDelete; | |
| 22 | + | |
| 23 | + public String getIsDelete() { | |
| 24 | + return isDelete; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setIsDelete(String isDelete) { | |
| 28 | + this.isDelete = isDelete; | |
| 29 | + } | |
| 21 | 30 | |
| 22 | 31 | public String getoId() { |
| 23 | 32 | return oId; |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineInfo.java
View file @
2e8d663
| ... | ... | @@ -8,6 +8,15 @@ |
| 8 | 8 | private String viFactoryId; |
| 9 | 9 | private String viVaccineNameId; |
| 10 | 10 | private String viIsValid; |
| 11 | + private String isDelete; | |
| 12 | + | |
| 13 | + public String getIsDelete() { | |
| 14 | + return isDelete; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setIsDelete(String isDelete) { | |
| 18 | + this.isDelete = isDelete; | |
| 19 | + } | |
| 11 | 20 | |
| 12 | 21 | public String getViId() { |
| 13 | 22 | return viId; |
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineInfoQuery.java
View file @
2e8d663
| ... | ... | @@ -12,6 +12,15 @@ |
| 12 | 12 | private String viFactoryId; |
| 13 | 13 | private String viVaccineNameId; |
| 14 | 14 | private String viIsValid; |
| 15 | + private String isDelete; | |
| 16 | + | |
| 17 | + public String getIsDelete() { | |
| 18 | + return isDelete; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setIsDelete(String isDelete) { | |
| 22 | + this.isDelete = isDelete; | |
| 23 | + } | |
| 15 | 24 | |
| 16 | 25 | public String getViId() { |
| 17 | 26 | return viId; |
mainData/src/main/resources/mainOrm/MedFactory.xml
View file @
2e8d663
| ... | ... | @@ -3,15 +3,16 @@ |
| 3 | 3 | <mapper namespace="com.lymsh.yimiao.main.data.dao.MedFactoryMapper"> |
| 4 | 4 | |
| 5 | 5 | <resultMap id="MedFactoryResultMap" type="com.lymsh.yimiao.main.data.model.MedFactory"> |
| 6 | -<result column="f_id" property="fId" jdbcType="VARCHAR" /> | |
| 7 | -<result column="f_name" property="fName" jdbcType="VARCHAR" /> | |
| 8 | -<result column="f_isValid" property="fIsValid" jdbcType="VARCHAR" /> | |
| 6 | +<result column="fa_id" property="fId" jdbcType="VARCHAR" /> | |
| 7 | +<result column="fa_name" property="fName" jdbcType="VARCHAR" /> | |
| 8 | +<result column="fa_isValid" property="fIsValid" jdbcType="VARCHAR" /> | |
| 9 | +<result column="fa_isDelete" property="isDelete" jdbcType="VARCHAR" /> | |
| 9 | 10 | </resultMap> |
| 10 | 11 | |
| 11 | 12 | <select id="getMedFactory" resultMap="MedFactoryResultMap" parameterType="java.lang.String"> |
| 12 | -select f_id,f_name,f_isValid | |
| 13 | +select fa_id,fa_name,fa_isValid,fa_isDelete | |
| 13 | 14 | FROM med_factory |
| 14 | -WHERE f_id = #{f_id,jdbcType=VARCHAR} | |
| 15 | +WHERE fa_id = #{f_id,jdbcType=VARCHAR} | |
| 15 | 16 | </select> |
| 16 | 17 | |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | |
| ... | ... | @@ -30,21 +31,24 @@ |
| 30 | 31 | <where> |
| 31 | 32 | 1 = 1 |
| 32 | 33 | <if test="fId != null and fId != ''"> |
| 33 | -and f_id = #{fId,jdbcType=VARCHAR} | |
| 34 | +and fa_id = #{fId,jdbcType=VARCHAR} | |
| 34 | 35 | </if> |
| 35 | 36 | <if test="fName != null and fName != ''"> |
| 36 | 37 | and f_name = #{fName,jdbcType=VARCHAR} |
| 37 | 38 | </if> |
| 38 | 39 | <if test="fIsValid != null and fIsValid != ''"> |
| 39 | -and f_isValid = #{fIsValid,jdbcType=VARCHAR} | |
| 40 | +and fa_isValid = #{fIsValid,jdbcType=VARCHAR} | |
| 40 | 41 | </if> |
| 42 | + <if test="isDelete != null and isDelete != ''"> | |
| 43 | +and fa_isDelete = #{isDelete,jdbcType=VARCHAR} | |
| 44 | +</if> | |
| 41 | 45 | </where> |
| 42 | 46 | </sql> |
| 43 | 47 | |
| 44 | 48 | |
| 45 | 49 | |
| 46 | 50 | <select id="queryMedFactory" resultMap="MedFactoryResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedFactoryQuery"> |
| 47 | -select f_id,f_name,f_isValid | |
| 51 | +select fa_id,fa_name,fa_isValid,fa_isDelete | |
| 48 | 52 | from med_factory |
| 49 | 53 | <include refid="MedFactoryCondition" /> |
| 50 | 54 | <include refid="orderAndLimit" /> |
mainData/src/main/resources/mainOrm/MedOrganization.xml
View file @
2e8d663
| ... | ... | @@ -14,10 +14,11 @@ |
| 14 | 14 | <result column="o_villageNo" property="oVillageNo" jdbcType="VARCHAR" /> |
| 15 | 15 | <result column="o_address" property="oAddress" jdbcType="VARCHAR" /> |
| 16 | 16 | <result column="o_isValid" property="oIsValid" jdbcType="VARCHAR" /> |
| 17 | +<result column="isDelete" property="isDelete;" jdbcType="VARCHAR" /> | |
| 17 | 18 | </resultMap> |
| 18 | 19 | |
| 19 | 20 | <select id="getMedOrganization" resultMap="MedOrganizationResultMap" parameterType="java.lang.String"> |
| 20 | -select o_id,o_name,o_contactWay,o_linkMan,o_provinceNo,o_cityNo,o_countyNo,o_townShipNo,o_villageNo,o_address,o_isValid | |
| 21 | +select o_id,o_name,o_contactWay,o_linkMan,o_provinceNo,o_cityNo,o_countyNo,o_townShipNo,o_villageNo,o_address,o_isValid,isDelete | |
| 21 | 22 | FROM med_organization |
| 22 | 23 | WHERE o_id = #{oId,jdbcType=VARCHAR} |
| 23 | 24 | </select> |
| 24 | 25 | |
| ... | ... | @@ -70,13 +71,16 @@ |
| 70 | 71 | <if test="oIsValid != null and oIsValid != ''"> |
| 71 | 72 | and o_isValid = #{oIsValid,jdbcType=VARCHAR} |
| 72 | 73 | </if> |
| 74 | + <if test="isDelete != null and isDelete != ''"> | |
| 75 | +and isDelete = #{isDelete,jdbcType=VARCHAR} | |
| 76 | +</if> | |
| 73 | 77 | </where> |
| 74 | 78 | </sql> |
| 75 | 79 | |
| 76 | 80 | |
| 77 | 81 | |
| 78 | 82 | <select id="queryMedOrganization" resultMap="MedOrganizationResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedOrganizationQuery"> |
| 79 | -select o_id,o_name,o_contactWay,o_linkMan,o_provinceNo,o_cityNo,o_countyNo,o_townShipNo,o_villageNo,o_address,o_isValid | |
| 83 | +select o_id,o_name,o_contactWay,o_linkMan,o_provinceNo,o_cityNo,o_countyNo,o_townShipNo,o_villageNo,o_address,o_isValid,isDelete | |
| 80 | 84 | from med_organization |
| 81 | 85 | <include refid="MedOrganizationCondition" /> |
| 82 | 86 | <include refid="orderAndLimit" /> |
mainData/src/main/resources/mainOrm/MedVaccineinfo.xml
View file @
2e8d663
| ... | ... | @@ -8,10 +8,11 @@ |
| 8 | 8 | <result column="vi_factoryId" property="viFactoryId" jdbcType="VARCHAR" /> |
| 9 | 9 | <result column="vi_vaccineNameId" property="viVaccineNameId" jdbcType="VARCHAR" /> |
| 10 | 10 | <result column="vi_isValid" property="viIsValid" jdbcType="VARCHAR" /> |
| 11 | +<result column="isDelete" property="isDelete" jdbcType="VARCHAR" /> | |
| 11 | 12 | </resultMap> |
| 12 | 13 | |
| 13 | 14 | <select id="getMedVaccineInfo" resultMap="MedVaccineInfoResultMap" parameterType="java.lang.String"> |
| 14 | -select vi_id,vi_name,vi_factoryId,vi_vaccineNameId,vi_isValid | |
| 15 | +select vi_id,vi_name,vi_factoryId,vi_vaccineNameId,vi_isValid,isDelete | |
| 15 | 16 | FROM med_vaccineinfo |
| 16 | 17 | WHERE vi_id = #{viId,jdbcType=INTEGER} |
| 17 | 18 | </select> |
| 18 | 19 | |
| ... | ... | @@ -46,13 +47,16 @@ |
| 46 | 47 | <if test="viIsValid != null and viIsValid != ''"> |
| 47 | 48 | and vi_isValid = #{viIsValid,jdbcType=VARCHAR} |
| 48 | 49 | </if> |
| 50 | + <if test="isDelete != null and isDelete != ''"> | |
| 51 | +and isDelete = #{isDelete,jdbcType=VARCHAR} | |
| 52 | +</if> | |
| 49 | 53 | </where> |
| 50 | 54 | </sql> |
| 51 | 55 | |
| 52 | 56 | |
| 53 | 57 | |
| 54 | 58 | <select id="queryMedVaccineInfo" resultMap="MedVaccineInfoResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedVaccineInfoQuery"> |
| 55 | -select vi_id,vi_name,vi_factoryId,vi_vaccineNameId,vi_isValid | |
| 59 | +select vi_id,vi_name,vi_factoryId,vi_vaccineNameId,vi_isValid,isDelete | |
| 56 | 60 | from med_vaccineinfo |
| 57 | 61 | <include refid="MedVaccineInfoCondition" /> |
| 58 | 62 | <include refid="orderAndLimit" /> |
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java
View file @
2e8d663
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import com.lymsh.mommybaby.basecommon.constant.ConstantInterface; |
| 7 | 7 | import com.lymsh.mommybaby.basecommon.util.DateUtil; |
| 8 | 8 | import com.lymsh.mommybaby.basecommon.util.ResultUtils; |
| 9 | +import com.lymsh.yimiao.main.data.enumdata.MouthAgeEnum; | |
| 9 | 10 | import com.lymsh.yimiao.main.data.enumdata.YnEnum; |
| 10 | 11 | import com.lymsh.yimiao.main.data.model.*; |
| 11 | 12 | import com.lymsh.yimiao.main.data.service.*; |
| 12 | 13 | |
| ... | ... | @@ -19,8 +20,8 @@ |
| 19 | 20 | import org.springframework.web.bind.annotation.RequestMapping; |
| 20 | 21 | import org.springframework.web.bind.annotation.RequestMethod; |
| 21 | 22 | import org.springframework.web.bind.annotation.RequestParam; |
| 22 | -import sun.security.util.Length; | |
| 23 | 23 | |
| 24 | + | |
| 24 | 25 | import javax.servlet.http.HttpServletRequest; |
| 25 | 26 | import javax.servlet.http.HttpServletResponse; |
| 26 | 27 | import java.util.*; |
| ... | ... | @@ -55,6 +56,8 @@ |
| 55 | 56 | private MedVaccineNameService medVaccineNameService; |
| 56 | 57 | @Autowired |
| 57 | 58 | private MedInoculateRecordService medInoculateRecordService; |
| 59 | + @Autowired | |
| 60 | + private MedFactoryService medFactoryService; | |
| 58 | 61 | |
| 59 | 62 | private final static String isDelete = "1"; |
| 60 | 63 | |
| 61 | 64 | |
| 62 | 65 | |
| 63 | 66 | |
| 64 | 67 | |
| 65 | 68 | |
| 66 | 69 | |
| 67 | 70 | |
| ... | ... | @@ -362,40 +365,54 @@ |
| 362 | 365 | * 根据月龄获取宝宝该月龄预约接种的疫苗(分为免费疫苗和收费疫苗两个模块) |
| 363 | 366 | * |
| 364 | 367 | * @param response |
| 365 | - * @param mouthAge 月龄 | |
| 366 | - * @param id 宝宝ID | |
| 368 | + * @param kidId 宝宝ID | |
| 367 | 369 | */ |
| 368 | 370 | @RequestMapping(value = "/inoculatePlan", method = RequestMethod.GET) |
| 369 | 371 | @TokenRequired |
| 370 | 372 | public void getKidVaccines(HttpServletResponse response, |
| 371 | - @RequestParam("mouthAge")String mouthAge, | |
| 372 | - @RequestParam("id")String id) { | |
| 373 | + @RequestParam("birthday")String birthday,//2016-01-02 | |
| 374 | + @RequestParam("id")String kidId) { | |
| 375 | + //使用生日来和当前时间做比较,算出月龄 | |
| 373 | 376 | |
| 374 | - List<Map> list = new ArrayList<>(); | |
| 375 | - List<Map> freeList = new ArrayList<>(); | |
| 376 | - List<Map> chargeList = new ArrayList<>(); | |
| 377 | + //0,1.2.3.4.5.6.7.8.10.11.1岁,1岁半,2岁,3岁,4岁,6岁 | |
| 378 | + List<Map> list = new ArrayList<>();//最外层的list | |
| 377 | 379 | |
| 378 | - Map<String,Object> map = new HashMap<>(); | |
| 380 | + for (MouthAgeEnum mouth : MouthAgeEnum.values()){ | |
| 381 | + List<Map> mouthAgeList = new ArrayList<>(); | |
| 382 | + Map<String,Object> mouthMap = new HashMap<>(); | |
| 379 | 383 | |
| 380 | - //先根据月龄去找这个月龄下要接种的所有疫苗 | |
| 381 | - MedVaccineNameQuery vaccineNameQuery = new MedVaccineNameQuery(); | |
| 382 | - vaccineNameQuery.setVnMonthAge(mouthAge); | |
| 383 | - vaccineNameQuery.setIsDelete(isDelete); | |
| 384 | - List<MedVaccineName> vaccineNameList = medVaccineNameService.queryMedVaccineName(vaccineNameQuery); | |
| 385 | - if (CollectionUtils.isNotEmpty(vaccineNameList)){ | |
| 386 | - for (MedVaccineName data : vaccineNameList){ | |
| 387 | - //免费 | |
| 388 | - if (data.getVnVaccineType()==1){ | |
| 389 | - freeList.add(getInoculate(data,mouthAge,id)); | |
| 390 | - //收费 | |
| 391 | - }else if (data.getVnVaccineType()==2){ | |
| 392 | - chargeList.add(getInoculate(data,mouthAge,id)); | |
| 384 | + Map<String,Object> inoculationMap = new HashMap<>(); | |
| 385 | + | |
| 386 | + List<Map> freeList = new ArrayList<>(); | |
| 387 | + List<Map> chargeList = new ArrayList<>(); | |
| 388 | + | |
| 389 | + String mouthAge = String.valueOf(mouth.getId()); | |
| 390 | + | |
| 391 | + //先根据月龄去找这个月龄下要接种的所有疫苗 | |
| 392 | + MedVaccineNameQuery vaccineNameQuery = new MedVaccineNameQuery(); | |
| 393 | + vaccineNameQuery.setVnMonthAge(mouthAge); | |
| 394 | + vaccineNameQuery.setIsDelete(isDelete); | |
| 395 | + List<MedVaccineName> vaccineNameList = medVaccineNameService.queryMedVaccineName(vaccineNameQuery); | |
| 396 | + if (CollectionUtils.isNotEmpty(vaccineNameList)){ | |
| 397 | + for (MedVaccineName data : vaccineNameList){ | |
| 398 | + if (data.getVnVaccineType()==1){ | |
| 399 | + //免费 | |
| 400 | + freeList.add(getInoculate(data,mouthAge,kidId)); | |
| 401 | + }else if (data.getVnVaccineType()==2){ | |
| 402 | + //收费 | |
| 403 | + chargeList.add(getInoculate(data,mouthAge,kidId)); | |
| 404 | + } | |
| 393 | 405 | } |
| 406 | + inoculationMap.put("freeList",freeList); | |
| 407 | + inoculationMap.put("chargeList",chargeList); | |
| 394 | 408 | } |
| 409 | + mouthAgeList.add(inoculationMap); | |
| 410 | + | |
| 411 | + mouthMap.put("mouthAgeList",mouthAgeList); | |
| 412 | + | |
| 413 | + list.add(mouthMap); | |
| 395 | 414 | } |
| 396 | - map.put("freeList",freeList); | |
| 397 | - map.put("chargeList",chargeList); | |
| 398 | - list.add(map); | |
| 415 | + | |
| 399 | 416 | ResultUtils.buildSuccessResultAndWrite(response,list); |
| 400 | 417 | } |
| 401 | 418 | |
| 402 | 419 | |
| 403 | 420 | |
| 404 | 421 | |
| 405 | 422 | |
| 406 | 423 | |
| 407 | 424 | |
| 408 | 425 | |
| ... | ... | @@ -423,32 +440,96 @@ |
| 423 | 440 | //去接种预约表里面查某个疫苗是否接种,如果在指定时间内没有接种 |
| 424 | 441 | |
| 425 | 442 | boolean isInoculate = false; |
| 443 | + String vaccineInfoId = null; | |
| 426 | 444 | |
| 445 | + //查出这个宝宝的所有接种信息 | |
| 427 | 446 | MedInoculateRecordQuery inoculateRecordQuery = new MedInoculateRecordQuery(); |
| 428 | 447 | inoculateRecordQuery.setIcKidId(kidId); |
| 429 | - inoculateRecordQuery.setIcVaccineId(data.getVnId()); | |
| 430 | 448 | inoculateRecordQuery.setIsDelete(isDelete); |
| 431 | 449 | List<MedInoculateRecord> inoculateRecordList = medInoculateRecordService.queryMedInoculateRecord(inoculateRecordQuery); |
| 432 | 450 | if (CollectionUtils.isNotEmpty(inoculateRecordList)){ |
| 433 | - MedInoculateRecord medInoculateRecord = inoculateRecordList.get(0); | |
| 434 | - //是否接种 | |
| 435 | - if (length == Integer.valueOf(medInoculateRecord.getIcJiCi())){ | |
| 436 | - isInoculate = true; | |
| 451 | + for (MedInoculateRecord temp : inoculateRecordList){ | |
| 452 | + | |
| 453 | + MedVaccineInfoQuery infoQuery = new MedVaccineInfoQuery(); | |
| 454 | + infoQuery.setIsDelete(isDelete); | |
| 455 | + infoQuery.setViId(temp.getIcVaccineId()); | |
| 456 | + List<MedVaccineInfo> infoList = medVaccineinfoService.queryMedVaccineInfo(infoQuery); | |
| 457 | + | |
| 458 | + String VaccineNameId = ""; | |
| 459 | + | |
| 460 | + if (CollectionUtils.isNotEmpty(infoList)){ | |
| 461 | + VaccineNameId = infoList.get(0).getViVaccineNameId(); | |
| 462 | + } | |
| 463 | + | |
| 464 | + //最后使用剂次和疫苗名称ID来判断接种表里面宝宝的接种是否成立 | |
| 465 | + if (length==Integer.valueOf(temp.getIcJiCi()) && data.getVnId().equals(VaccineNameId)){ | |
| 466 | + isInoculate = true; | |
| 467 | + vaccineInfoId = temp.getIcVaccineId(); | |
| 468 | + } | |
| 437 | 469 | } |
| 438 | 470 | } |
| 439 | 471 | map.put("isInoculate",isInoculate); |
| 472 | + map.put("vaccineInfoId",vaccineInfoId); | |
| 440 | 473 | return map; |
| 441 | 474 | } |
| 442 | 475 | |
| 443 | 476 | /** |
| 444 | 477 | * 获取接种记录 |
| 445 | 478 | * @param response |
| 446 | - * @param request | |
| 479 | + * @param kidId 宝宝ID | |
| 480 | + * @param vaccineInfoId 疫苗基本信息ID | |
| 447 | 481 | */ |
| 448 | 482 | @RequestMapping(value = "/inoculateRecord", method = RequestMethod.GET) |
| 449 | 483 | @TokenRequired |
| 450 | - public void getKidVaccines(HttpServletResponse response,HttpServletRequest request){ | |
| 484 | + public void getKidVaccines(HttpServletResponse response, | |
| 485 | + @RequestParam("kidId")String kidId, | |
| 486 | + @RequestParam("jiCi")String jiCi, | |
| 487 | + @RequestParam("vaccineInfoId")String vaccineInfoId){ | |
| 451 | 488 | |
| 489 | + List<Map> list = new ArrayList<>(); | |
| 490 | + | |
| 491 | + MedInoculateRecordQuery recordQuery = new MedInoculateRecordQuery(); | |
| 492 | + recordQuery.setIcKidId(kidId); | |
| 493 | + recordQuery.setIcVaccineId(vaccineInfoId); | |
| 494 | + recordQuery.setIcJiCi(jiCi); | |
| 495 | + recordQuery.setIsDelete(isDelete); | |
| 496 | + List<MedInoculateRecord> recordList = medInoculateRecordService.queryMedInoculateRecord(recordQuery); | |
| 497 | + if (CollectionUtils.isNotEmpty(recordList)) { | |
| 498 | + MedInoculateRecord data = recordList.get(0); | |
| 499 | + Map<String, Object> map = new HashMap<>(); | |
| 500 | + //疫苗名称 | |
| 501 | + MedVaccineInfo info = medVaccineinfoService.getMedVaccineInfo(vaccineInfoId); | |
| 502 | + if (info != null && isDelete.equals(info.getIsDelete())) { | |
| 503 | + map.put("vaccineInfoName", info.getViName()); | |
| 504 | + //生产企业 | |
| 505 | + MedFactory medFactory = medFactoryService.getMedFactory(info.getViFactoryId()); | |
| 506 | + if (medFactory != null && isDelete.equals(medFactory.getIsDelete())) { | |
| 507 | + map.put("factoryName", medFactory.getFName()); | |
| 508 | + } | |
| 509 | + } else { | |
| 510 | + map.put("vaccineInfoName", null); | |
| 511 | + map.put("factoryName", null); | |
| 512 | + | |
| 513 | + } | |
| 514 | + //接种日期 | |
| 515 | + map.put("inoculateTime", DateUtil.getSecond(DateUtil.parseYMD(data.getIcInoculateTime()))); | |
| 516 | + //接种医生 | |
| 517 | + map.put("doctor", data.getIcDoctor()); | |
| 518 | + //接种部位 | |
| 519 | + map.put("position", data.getIcPosition()); | |
| 520 | + | |
| 521 | + //接种单位 | |
| 522 | + MedOrganization medOrganization = medOrganizationService.getMedOrganization(data.getIcOrganizationId()); | |
| 523 | + if (medOrganization != null && isDelete.equals(medOrganization.getIsDelete())) { | |
| 524 | + map.put("organization", medOrganization.getoName()); | |
| 525 | + } else { | |
| 526 | + map.put("organization", null); | |
| 527 | + } | |
| 528 | + //疫苗批号 | |
| 529 | + map.put("batchNumber", data.getIcBatchNumber()); | |
| 530 | + list.add(map); | |
| 531 | + } | |
| 532 | + ResultUtils.buildSuccessResultAndWrite(response,list); | |
| 452 | 533 | } |
| 453 | 534 | |
| 454 | 535 |