Commit 905d7b7959615e7f04145a6c79d1ea559da8f87d

Authored by landong2015
1 parent ba12265c9f
Exists in master

提交代码

Showing 10 changed files with 111 additions and 38 deletions

mainData/src/main/java/com/lymsh/yimiao/main/data/enumdata/YnEnum.java View file @ 905d7b7
... ... @@ -4,6 +4,9 @@
4 4 * Created by riecard on 15/9/28.
5 5 */
6 6 public enum YnEnum {
  7 +
  8 +
  9 +
7 10 yes(1,"有效"),
8 11 no(2,"无效");
9 12  
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateRecord.java View file @ 905d7b7
... ... @@ -13,6 +13,15 @@
13 13 private String icOrganizationId;
14 14 private String icIsInoculate;
15 15 private String icJiCi;
  16 + private String isDelete;
  17 +
  18 + public String getIsDelete() {
  19 + return isDelete;
  20 + }
  21 +
  22 + public void setIsDelete(String isDelete) {
  23 + this.isDelete = isDelete;
  24 + }
16 25  
17 26 public String getIcId() {
18 27 return icId;
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedInoculateRecordQuery.java View file @ 905d7b7
... ... @@ -17,6 +17,15 @@
17 17 private String icOrganizationId;
18 18 private String icIsInoculate;
19 19 private String icJiCi;
  20 + private String isDelete;
  21 +
  22 + public String getIsDelete() {
  23 + return isDelete;
  24 + }
  25 +
  26 + public void setIsDelete(String isDelete) {
  27 + this.isDelete = isDelete;
  28 + }
20 29  
21 30 public String getIcId() {
22 31 return icId;
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineName.java View file @ 905d7b7
... ... @@ -12,6 +12,15 @@
12 12 private String vnDescription;
13 13 private String vnIsValid;
14 14 private Integer vnVaccineType;
  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 Integer getVnVaccineType() {
17 26 return vnVaccineType;
mainData/src/main/java/com/lymsh/yimiao/main/data/model/MedVaccineNameQuery.java View file @ 905d7b7
... ... @@ -16,6 +16,15 @@
16 16 private String vnDescription;
17 17 private String vnIsValid;
18 18 private Integer vnVaccineType;
  19 + private String isDelete;
  20 +
  21 + public String getIsDelete() {
  22 + return isDelete;
  23 + }
  24 +
  25 + public void setIsDelete(String isDelete) {
  26 + this.isDelete = isDelete;
  27 + }
19 28  
20 29 public Integer getVnVaccineType() {
21 30 return vnVaccineType;
mainData/src/main/resources/mainOrm/MedInoculaterecord.xml View file @ 905d7b7
... ... @@ -8,15 +8,16 @@
8 8 <result column="ic_vaccineId" property="icVaccineId" jdbcType="VARCHAR" />
9 9 <result column="ic_inoculateTime" property="icInoculateTime" jdbcType="VARCHAR" />
10 10 <result column="ic_doctor" property="icDoctor" jdbcType="VARCHAR" />
11   -<result column="ic_position" property="icPosition" jdbcType="VARCHAR" />
  11 +<result column="io_position" property="icPosition" jdbcType="VARCHAR" />
12 12 <result column="ic_batchNumber" property="icBatchNumber" jdbcType="VARCHAR" />
13 13 <result column="ic_organizationId" property="icOrganizationId" jdbcType="VARCHAR" />
14 14 <result column="ic_isInoculate" property="icIsInoculate" jdbcType="VARCHAR" />
15 15 <result column="ic_jici" property="icJiCi" jdbcType="VARCHAR" />
  16 +<result column="ic_delete" property="isDelete" jdbcType="VARCHAR" />
16 17 </resultMap>
17 18  
18 19 <select id="getMedInoculateRecord" resultMap="MedInoculateRecordResultMap" parameterType="java.lang.String">
19   -select ic_id,ic_kidId,ic_vaccineId,ic_inoculateTime,ic_doctor,ic_position,ic_batchNumber,ic_organizationId,ic_isInoculate,ic_jici
  20 +select ic_id,ic_kidId,ic_vaccineId,ic_inoculateTime,ic_doctor,io_position,ic_batchNumber,ic_organizationId,ic_isInoculate,ic_jici,ic_delete
20 21 FROM med_inoculaterecord
21 22 WHERE ic_id = #{icId,jdbcType=VARCHAR}
22 23 </select>
... ... @@ -52,7 +53,7 @@
52 53 and ic_doctor = #{icDoctor,jdbcType=VARCHAR}
53 54 </if>
54 55 <if test="icPosition != null and icPosition != ''">
55   -and ic_position = #{icPosition,jdbcType=VARCHAR}
  56 +and io_position = #{icPosition,jdbcType=VARCHAR}
56 57 </if>
57 58 <if test="icBatchNumber != null and icBatchNumber != ''">
58 59 and ic_batchNumber = #{icBatchNumber,jdbcType=VARCHAR}
59 60  
... ... @@ -66,13 +67,16 @@
66 67 <if test="icJiCi != null and icJiCi != ''">
67 68 and ic_jici = #{icJiCi,jdbcType=VARCHAR}
68 69 </if>
  70 + <if test="isDelete != null and isDelete != ''">
  71 +and ic_delete = #{isDelete,jdbcType=VARCHAR}
  72 +</if>
69 73 </where>
70 74 </sql>
71 75  
72 76  
73 77  
74 78 <select id="queryMedInoculateRecord" resultMap="MedInoculateRecordResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedInoculateRecordQuery">
75   -select ic_id,ic_kidId,ic_vaccineId,ic_inoculateTime,ic_doctor,ic_position,ic_batchNumber,ic_organizationId,ic_isInoculate,ic_jici
  79 +select ic_id,ic_kidId,ic_vaccineId,ic_inoculateTime,ic_doctor,io_position,ic_batchNumber,ic_organizationId,ic_isInoculate,ic_jici,ic_delete
76 80 from med_inoculaterecord
77 81 <include refid="MedInoculateRecordCondition" />
78 82 <include refid="orderAndLimit" />
mainData/src/main/resources/mainOrm/MedVaccinename.xml View file @ 905d7b7
... ... @@ -12,10 +12,11 @@
12 12 <result column="vn_description" property="vnDescription" jdbcType="VARCHAR" />
13 13 <result column="vn_isValid" property="vnIsValid" jdbcType="VARCHAR" />
14 14 <result column="vn_vaccineType" property="vnVaccineType" jdbcType="INTEGER" />
  15 +<result column="isDelete" property="isDelete" jdbcType="INTEGER" />
15 16 </resultMap>
16 17  
17 18 <select id="getMedVaccineName" resultMap="MedVaccineNameResultMap" parameterType="java.lang.String">
18   -select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid,vn_vaccineType
  19 +select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid,vn_vaccineType,isDelete
19 20 from med_vaccinename
20 21 WHERE vn_id = #{vnId,jdbcType=VARCHAR}
21 22 </select>
... ... @@ -45,7 +46,11 @@
45 46 and vn_preventDisease = #{vnPreventDisease,jdbcType=VARCHAR}
46 47 </if>
47 48 <if test="vnMonthAge != null and vnMonthAge != ''">
48   -and vn_monthAge = #{vnMonthAge,jdbcType=VARCHAR}
  49 +and (vn_monthAge = #{vnMonthAge,jdbcType=VARCHAR}
  50 + OR vn_monthAge like CONCAT(#{vnMonthAge,jdbcType=VARCHAR}, ',%')
  51 + OR vn_monthAge LIKE CONCAT('%,',#{vnMonthAge,jdbcType=VARCHAR})
  52 + OR vn_monthAge LIKE '%,'||#{vnMonthAge,jdbcType=VARCHAR}||',%'
  53 + )
49 54 </if>
50 55 <if test="vnPosition != null and vnPosition != ''">
51 56 and vn_position = #{vnPosition,jdbcType=VARCHAR}
52 57  
... ... @@ -62,13 +67,16 @@
62 67 <if test="vnVaccineType != null and vnVaccineType != ''">
63 68 and vn_vaccineType = #{vnVaccineType,jdbcType=INTEGER}
64 69 </if>
  70 + <if test="isDelete != null and isDelete != ''">
  71 + and isDelete = #{isDelete,jdbcType=INTEGER}
  72 + </if>
65 73 </where>
66 74 </sql>
67 75  
68 76  
69 77  
70 78 <select id="queryMedVaccineName" resultMap="MedVaccineNameResultMap" parameterType="com.lymsh.yimiao.main.data.model.MedVaccineNameQuery">
71   -select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid
  79 +select vn_id,vn_name,vn_preventDisease,vn_monthAge,vn_position,vn_taboo,vn_description,vn_isValid,isDelete,vn_vaccineType
72 80 from med_vaccinename
73 81 <include refid="MedVaccineNameCondition" />
74 82 <include refid="orderAndLimit" />
mainData/src/main/resources/mainOrm/YmNotifications.xml View file @ 905d7b7
... ... @@ -53,6 +53,8 @@
53 53  
54 54 <select id="getYmNotifications" resultMap="YmNotificationsResultMap" parameterType="java.lang.Integer">
55 55 select id,type,content,created,yn,publish_id,publish_name
  56 +from ym_notifications
  57 +WHERE id = #{id,jdbcType=INTEGER}
56 58 </select>
57 59  
58 60  
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/KidsController.java View file @ 905d7b7
... ... @@ -19,6 +19,7 @@
19 19 import org.springframework.web.bind.annotation.RequestMapping;
20 20 import org.springframework.web.bind.annotation.RequestMethod;
21 21 import org.springframework.web.bind.annotation.RequestParam;
  22 +import sun.security.util.Length;
22 23  
23 24 import javax.servlet.http.HttpServletRequest;
24 25 import javax.servlet.http.HttpServletResponse;
... ... @@ -55,6 +56,7 @@
55 56 @Autowired
56 57 private MedInoculateRecordService medInoculateRecordService;
57 58  
  59 + private final static String isDelete = "1";
58 60  
59 61 // /**
60 62 // * 发送验证码
... ... @@ -361,6 +363,7 @@
361 363 *
362 364 * @param response
363 365 * @param mouthAge 月龄
  366 + * @param id 宝宝ID
364 367 */
365 368 @RequestMapping(value = "/inoculatePlan", method = RequestMethod.GET)
366 369 @TokenRequired
367 370  
368 371  
369 372  
370 373  
371 374  
372 375  
373 376  
374 377  
375 378  
376 379  
... ... @@ -372,44 +375,69 @@
372 375 List<Map> freeList = new ArrayList<>();
373 376 List<Map> chargeList = new ArrayList<>();
374 377  
  378 + Map<String,Object> map = new HashMap<>();
  379 +
375 380 //先根据月龄去找这个月龄下要接种的所有疫苗
376 381 MedVaccineNameQuery vaccineNameQuery = new MedVaccineNameQuery();
377 382 vaccineNameQuery.setVnMonthAge(mouthAge);
  383 + vaccineNameQuery.setIsDelete(isDelete);
378 384 List<MedVaccineName> vaccineNameList = medVaccineNameService.queryMedVaccineName(vaccineNameQuery);
379 385 if (CollectionUtils.isNotEmpty(vaccineNameList)){
380 386 for (MedVaccineName data : vaccineNameList){
381 387 //免费
382 388 if (data.getVnVaccineType()==1){
383   - Map<String,Object> map = new HashMap<>();
384   -
385   - map.put("id",data.getVnId());
386   - map.put("name",data.getVnName());
387   - //需要处理剂次
388   - map.put("jiCi","");
389   - //去接种预约表里面查某个疫苗是否接种,如果在指定时间内没有接种
390   - MedInoculateRecordQuery inoculateRecordQuery = new MedInoculateRecordQuery();
391   - inoculateRecordQuery.setIcKidId(id);
392   - inoculateRecordQuery.setIcVaccineId(data.getVnId());
393   - List<MedInoculateRecord> inoculateRecordList = medInoculateRecordService.queryMedInoculateRecord(inoculateRecordQuery);
394   - if (CollectionUtils.isNotEmpty(inoculateRecordList)){
395   - MedInoculateRecord medInoculateRecord = inoculateRecordList.get(0);
396   -
397   -
398   - }
399   -
400   -
401   -
  389 + freeList.add(getInoculate(data,mouthAge,id));
402 390 //收费
403 391 }else if (data.getVnVaccineType()==2){
404   - Map<String,Object> map = new HashMap<>();
  392 + chargeList.add(getInoculate(data,mouthAge,id));
  393 + }
  394 + }
  395 + }
  396 + map.put("freeList",freeList);
  397 + map.put("chargeList",chargeList);
  398 + list.add(map);
  399 + ResultUtils.buildSuccessResultAndWrite(response,list);
  400 + }
405 401  
  402 + public Map<String,Object> getInoculate(MedVaccineName data,String mouthAge,String kidId){
  403 + Map<String,Object> map = new HashMap<>();
406 404  
  405 + map.put("id",data.getVnId());//疫苗名称ID
  406 + map.put("name",data.getVnName());//疫苗名称title
  407 + String mouth = null;
407 408  
  409 + int length = 0;
408 410  
  411 + if (data.getVnMonthAge()!=null){
  412 +
  413 + String[] ages = data.getVnMonthAge().split(",");
  414 + for (int a = 0 ; a < ages.length ; a++){
  415 + if (mouthAge.equals(ages[a])){
  416 + length = a + 1;
409 417 }
410 418 }
  419 + mouth = "(第" + length + "/" + ages.length + "剂)";
411 420 }
  421 + map.put("mouthAge",mouth);
412 422  
  423 + //去接种预约表里面查某个疫苗是否接种,如果在指定时间内没有接种
  424 +
  425 + boolean isInoculate = false;
  426 +
  427 + MedInoculateRecordQuery inoculateRecordQuery = new MedInoculateRecordQuery();
  428 + inoculateRecordQuery.setIcKidId(kidId);
  429 + inoculateRecordQuery.setIcVaccineId(data.getVnId());
  430 + inoculateRecordQuery.setIsDelete(isDelete);
  431 + List<MedInoculateRecord> inoculateRecordList = medInoculateRecordService.queryMedInoculateRecord(inoculateRecordQuery);
  432 + if (CollectionUtils.isNotEmpty(inoculateRecordList)){
  433 + MedInoculateRecord medInoculateRecord = inoculateRecordList.get(0);
  434 + //是否接种
  435 + if (length == Integer.valueOf(medInoculateRecord.getIcJiCi())){
  436 + isInoculate = true;
  437 + }
  438 + }
  439 + map.put("isInoculate",isInoculate);
  440 + return map;
413 441 }
414 442  
415 443 /**
webApi/src/main/java/com/lyms/yimiao/web/controller/v1/NotificationsController.java View file @ 905d7b7
... ... @@ -39,17 +39,12 @@
39 39 //获取消息(1.系统消息2.接种消息)
40 40 @RequestMapping(value = "/notifications", method = RequestMethod.GET)
41 41 @TokenRequired
42   - public void getNotifications(HttpServletResponse response,
43   - @RequestParam("page") int page,
44   - @RequestParam("limit") int limit ){
  42 + public void getNotifications(HttpServletResponse response){
45 43  
46 44 YmNotificationsQuery notificationsQuery = new YmNotificationsQuery();
47 45 notificationsQuery.setYn(YnEnum.yes.getId());
48 46  
49   - notificationsQuery.setPage(page);
50   - notificationsQuery.setLimit(limit);
51 47 notificationsQuery.setSort("created desc");
52   - notificationsQuery.setNeed("y");
53 48  
54 49 List<YmNotifications> notificationsList = notificationsService.queryYmNotifications(notificationsQuery);
55 50  
... ... @@ -65,10 +60,7 @@
65 60 list.add(map);
66 61 }
67 62 }
68   - CommonResult result = new CommonResult();
69   - result.setList(list);
70   - result.setPageInfo(notificationsQuery.getPageInfo());
71   - ResultUtils.buildSuccessResultAndWrite(response,result);
  63 + ResultUtils.buildSuccessResultAndWrite(response,list);
72 64 }
73 65  
74 66 //定时发送给当前登录用户接种通知