Commit dcdc6e8fc76a76477e55e45b57a193c66fd29a59
1 parent
611af264e5
Exists in
master
and in
6 other branches
bug修复
Showing 20 changed files with 324 additions and 43 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/RemoteService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/RemoteUrlEnum.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/GenSequenceIdService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
- platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CouponController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyBookbuildingAddRequest.java
- platform-operate-api/src/main/resources/config.properties
- platform-operate-api/src/main/resources/database.properties
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/RemoteService.java
View file @
dcdc6e8
| 1 | +package com.lyms.platform.biz; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.utils.HttpClientUtil; | |
| 4 | +import com.lyms.platform.common.utils.PropertiesUtil; | |
| 5 | +import org.apache.commons.lang3.StringUtils; | |
| 6 | +import org.springframework.stereotype.Service; | |
| 7 | + | |
| 8 | +import javax.annotation.PostConstruct; | |
| 9 | +import java.text.MessageFormat; | |
| 10 | +import java.util.HashMap; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * @Author: litao | |
| 15 | + * @Date: 2017/5/16 0016 13:25 | |
| 16 | + * @Version: V1.0 | |
| 17 | + */ | |
| 18 | +@Service | |
| 19 | +public class RemoteService { | |
| 20 | + | |
| 21 | + private String BASE_URL; | |
| 22 | + | |
| 23 | + public static final String INVALID_COUPON_URL = "coupon/invalid"; | |
| 24 | + | |
| 25 | + @PostConstruct | |
| 26 | + public void init() { | |
| 27 | + String type = PropertiesUtil.getInstance().get("config","remote.url.type"); | |
| 28 | + if(StringUtils.isNotBlank(type)) { | |
| 29 | + this.BASE_URL = PropertiesUtil.getInstance().get("config", MessageFormat.format("platform.operate.api.{0}.url", type)); | |
| 30 | + } | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 作废优惠券相关 | |
| 35 | + * @param personId | |
| 36 | + */ | |
| 37 | + public void invalidCoupon(String personId, String couponTypes, RemoteUrlEnum urlEnum) { | |
| 38 | + Map<String, String> params = new HashMap<>(); | |
| 39 | + params.put("personId", personId); | |
| 40 | + params.put("couponTypes", couponTypes); | |
| 41 | + HttpClientUtil.doPost(BASE_URL + urlEnum.getUrl(), params, "utf-8"); | |
| 42 | + } | |
| 43 | + | |
| 44 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/RemoteUrlEnum.java
View file @
dcdc6e8
| 1 | +package com.lyms.platform.biz; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @Author: litao | |
| 5 | + * @Date: 2017/5/16 0016 17:22 | |
| 6 | + * @Version: V1.0 | |
| 7 | + */ | |
| 8 | +public enum RemoteUrlEnum { | |
| 9 | + INVALID_COUPON_URL("coupon/invalid", "作废优惠券"); | |
| 10 | + | |
| 11 | + RemoteUrlEnum(String url, String desc) { | |
| 12 | + this.url = url; | |
| 13 | + this.desc = desc; | |
| 14 | + } | |
| 15 | + | |
| 16 | + private String url; | |
| 17 | + private String desc; | |
| 18 | + | |
| 19 | + public String getUrl() { | |
| 20 | + return url; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setUrl(String url) { | |
| 24 | + this.url = url; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getDesc() { | |
| 28 | + return desc; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setDesc(String desc) { | |
| 32 | + this.desc = desc; | |
| 33 | + } | |
| 34 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/GenSequenceIdService.java
View file @
dcdc6e8
| ... | ... | @@ -27,13 +27,13 @@ |
| 27 | 27 | private int createSize; |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - public String poll() { | |
| 30 | + public String poll(String areaCode) { | |
| 31 | 31 | String s = genSequenceIdDao.poll(); |
| 32 | 32 | if(StringUtils.isBlank(s)) { |
| 33 | 33 | generateData(); |
| 34 | 34 | s = genSequenceIdDao.poll(); |
| 35 | 35 | } |
| 36 | - return s; | |
| 36 | + return areaCode + s; | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
dcdc6e8
| 1 | 1 | package com.lyms.platform.biz.service; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.RemoteService; | |
| 4 | +import com.lyms.platform.biz.RemoteUrlEnum; | |
| 3 | 5 | import com.lyms.platform.biz.dal.*; |
| 4 | 6 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 5 | 7 | import com.lyms.platform.common.enums.SieveStatusEnums; |
| ... | ... | @@ -23,7 +25,6 @@ |
| 23 | 25 | @Service |
| 24 | 26 | public class PatientsService { |
| 25 | 27 | |
| 26 | - | |
| 27 | 28 | @Autowired |
| 28 | 29 | private IPatientDao iPatientDao; |
| 29 | 30 | @Autowired |
| ... | ... | @@ -38,6 +39,8 @@ |
| 38 | 39 | private IAntExRecordDao iAntExRecordDao; |
| 39 | 40 | @Autowired |
| 40 | 41 | private PatientCheckTicketService patientCheckTicketService; |
| 42 | + @Autowired | |
| 43 | + private RemoteService remoteService; | |
| 41 | 44 | |
| 42 | 45 | public Patients addPatient(Patients obj) { |
| 43 | 46 | return iPatientDao.addPatient(obj); |
| ... | ... | @@ -242,6 +245,7 @@ |
| 242 | 245 | * 自动分娩产妇的 |
| 243 | 246 | */ |
| 244 | 247 | public void autoMatDeliver() { |
| 248 | + | |
| 245 | 249 | Date endDate = DateUtil.addDay(new Date(), -294); |
| 246 | 250 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 247 | 251 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 248 | 252 | |
| ... | ... | @@ -259,8 +263,11 @@ |
| 259 | 263 | // hujiaqi添加结束 |
| 260 | 264 | updatePatient(patients); |
| 261 | 265 | |
| 266 | + /** 自动分娩 >> 作废未使用的产检券 */ | |
| 267 | + remoteService.invalidCoupon(patients.getPid(), "2", RemoteUrlEnum.INVALID_COUPON_URL); | |
| 268 | + | |
| 262 | 269 | //作废产检劵 |
| 263 | - patientCheckTicketService.cancelCheckTicket(patients.getHospitalId(), patients.getId()); | |
| 270 | + /* patientCheckTicketService.cancelCheckTicket(patients.getHospitalId(), patients.getId()); | |
| 264 | 271 | PersonModelQuery personYunModelQuery = new PersonModelQuery(); |
| 265 | 272 | personYunModelQuery.setYn(YnEnums.YES.getId()); |
| 266 | 273 | personYunModelQuery.setId(patients.getPid()); |
| ... | ... | @@ -269,7 +276,7 @@ |
| 269 | 276 | PersonModel pm = list.get(0); |
| 270 | 277 | pm.setType(3);//基本信息更新成产妇 |
| 271 | 278 | personService.updatePerson(pm, pm.getId()); |
| 272 | - } | |
| 279 | + }*/ | |
| 273 | 280 | } |
| 274 | 281 | } |
| 275 | 282 |
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
dcdc6e8
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java
View file @
dcdc6e8
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java
View file @
dcdc6e8
| ... | ... | @@ -117,10 +117,43 @@ |
| 117 | 117 | if(CollectionUtils.isEmpty(temps)) { |
| 118 | 118 | return RespBuilder.buildErro(ResponseCode.COUPON_TEMP_NOT_FOUND); |
| 119 | 119 | } |
| 120 | - sendCoupon(temps, hospitalId, createUserId, userId, person.getType()); | |
| 120 | + | |
| 121 | + String areaCode = getAreaCode(hospitalId); | |
| 122 | + if(StringUtils.isBlank(areaCode)) { | |
| 123 | + return RespBuilder.buildErro(ResponseCode.OUPON_HOSPITAL_NOT_BOUND_AREA); | |
| 124 | + } | |
| 125 | + | |
| 126 | + sendCoupon(temps, hospitalId, createUserId, userId, person.getType(), areaCode); | |
| 121 | 127 | return RespBuilder.buildSuccess(); |
| 122 | 128 | } |
| 123 | 129 | |
| 130 | + /** | |
| 131 | + * 根据医院id查询区域id | |
| 132 | + * @param hospitalId | |
| 133 | + * @return | |
| 134 | + */ | |
| 135 | + private String getAreaCode(String hospitalId) { | |
| 136 | + String cityId = couponMapper.findCityId(hospitalId); | |
| 137 | + if(StringUtils.isNotBlank(cityId)) { | |
| 138 | + AreaCodeModel areaCodeModel = mongoTemplate.findOne(Query.query(Criteria.where("areaId").is(cityId)), AreaCodeModel.class); | |
| 139 | + if(areaCodeModel != null) { | |
| 140 | + String areaCode = areaCodeModel.getAreaCode(); | |
| 141 | + if(StringUtils.isNotBlank(areaCode)) { | |
| 142 | + int length = areaCode.length(); | |
| 143 | + | |
| 144 | + if(length == 4) { | |
| 145 | + return areaCode; | |
| 146 | + } else { | |
| 147 | + for (int i = 0; i < 4 - length; i++) { | |
| 148 | + areaCode = "0" + areaCode; | |
| 149 | + } | |
| 150 | + } | |
| 151 | + } | |
| 152 | + } | |
| 153 | + } | |
| 154 | + return null; | |
| 155 | + } | |
| 156 | + | |
| 124 | 157 | private boolean isCreated(String userId, String hospitalId) { |
| 125 | 158 | Map<String, Object> param = new HashMap<>(); |
| 126 | 159 | param.put("userId", userId); |
| ... | ... | @@ -129,7 +162,7 @@ |
| 129 | 162 | return CollectionUtils.isNotEmpty(list); |
| 130 | 163 | } |
| 131 | 164 | |
| 132 | - private void sendCoupon(List<Map<String, Object>> temps, String hospitalId, Integer createUserId, String userId, Integer personType) { | |
| 165 | + private void sendCoupon(List<Map<String, Object>> temps, String hospitalId, Integer createUserId, String userId, Integer personType, String areaCode) { | |
| 133 | 166 | for (Map<String, Object> temp : temps) { |
| 134 | 167 | Object sendType = temp.get("send_type"); |
| 135 | 168 | if(sendType != null) {/** 1=全部发放 2=按有效时间发放 */ |
| ... | ... | @@ -137,7 +170,7 @@ |
| 137 | 170 | couponInfo.setCreateDate(new Date()); |
| 138 | 171 | couponInfo.setCreateHospitalId(hospitalId); |
| 139 | 172 | couponInfo.setCreateUserId(String.valueOf(createUserId)); |
| 140 | - couponInfo.setSequenceId(genIdService.poll()); | |
| 173 | + couponInfo.setSequenceId(genIdService.poll(areaCode)); | |
| 141 | 174 | couponInfo.setStatus(1); |
| 142 | 175 | couponInfo.setUserId(userId); |
| 143 | 176 | if(temp.get("coupon_template_id") != null) { |
| ... | ... | @@ -155,6 +188,7 @@ |
| 155 | 188 | couponInfo.setUseDate(patients.getBookbuildingDate()); |
| 156 | 189 | couponInfo.setOperatorUseId(patients.getBookbuildingDoctor()); |
| 157 | 190 | couponInfo.setUsedHospitalId(patients.getHospitalId()); |
| 191 | + couponInfo.setUsedId(patients.getId()); | |
| 158 | 192 | } |
| 159 | 193 | } else { |
| 160 | 194 | BabyModel baby = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId)), BabyModel.class); |
| ... | ... | @@ -162,6 +196,7 @@ |
| 162 | 196 | couponInfo.setUseDate(baby.getBuildDate()); |
| 163 | 197 | couponInfo.setOperatorUseId(baby.getBuildDoctor()); |
| 164 | 198 | couponInfo.setUsedHospitalId(baby.getHospitalId()); |
| 199 | + couponInfo.setUsedId(baby.getId()); | |
| 165 | 200 | } |
| 166 | 201 | } |
| 167 | 202 | } |
| ... | ... | @@ -177,9 +212,6 @@ |
| 177 | 212 | continue; |
| 178 | 213 | } |
| 179 | 214 | |
| 180 | - | |
| 181 | - | |
| 182 | - | |
| 183 | 215 | Object actualStart = temp.get("actual_start"); |
| 184 | 216 | Object actualEnd = temp.get("actual_end"); |
| 185 | 217 | Object unitType = temp.get("unit_type"); |
| ... | ... | @@ -328,6 +360,9 @@ |
| 328 | 360 | param.put("useDate", new Date()); |
| 329 | 361 | param.put("userId", delUserId); |
| 330 | 362 | couponMapper.update(param); |
| 363 | + | |
| 364 | + /** 孕妇或儿童档案被删除 【所有未使用的优惠券】要自动作废 */ | |
| 365 | + invalid(delUserId, "1,2,3,4,5,6,7,8"); | |
| 331 | 366 | } |
| 332 | 367 | |
| 333 | 368 | @Override |
| ... | ... | @@ -354,6 +389,19 @@ |
| 354 | 389 | String s = HttpClientUtil.doGet(PropertiesUtil.getInstance().getDefault("or.code.create.url"), params, "utf-8", null); |
| 355 | 390 | JSONObject jsonObject = JSONObject.fromObject(s); |
| 356 | 391 | return jsonObject.get("url").toString(); |
| 392 | + } | |
| 393 | + | |
| 394 | + @Override | |
| 395 | + public void invalid(String personId, String couponTypes) { | |
| 396 | + Map<String, Object> param = new HashMap<>(); | |
| 397 | + param.put("personId", personId); | |
| 398 | + param.put("couponTypes", com.lyms.platform.common.utils.StringUtils.covertToList(couponTypes, Integer.class)); | |
| 399 | + couponMapper.invalid(param); | |
| 400 | + } | |
| 401 | + | |
| 402 | + @Override | |
| 403 | + public String findByUsedId(String usedId) { | |
| 404 | + return couponMapper.findByUsedId(usedId); | |
| 357 | 405 | } |
| 358 | 406 | |
| 359 | 407 | /** 1=省 2=市 3=区 4=单医院 */ |
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
dcdc6e8
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | </resultMap> |
| 19 | 19 | |
| 20 | 20 | <sql id="columnList"> |
| 21 | - sequence_id,create_date,use_date, operator_use_id, user_id,create_user_id,coupon_template_id,create_hospital_id,used_hospital_id,status | |
| 21 | + sequence_id,create_date,use_date, operator_use_id, user_id,create_user_id,coupon_template_id,create_hospital_id,used_id,used_hospital_id,status | |
| 22 | 22 | </sql> |
| 23 | 23 | |
| 24 | 24 | <select id="findList" parameterType="map" resultMap="couponInfoMap"> |
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | </select> |
| 38 | 38 | |
| 39 | 39 | <insert id="save" parameterType="com.lyms.platform.permission.model.CouponInfo"> |
| 40 | - insert into coupon_info(id, <include refid="columnList" />) values(#{id},#{sequenceId},#{createDate},#{useDate},#{operatorUseId},#{userId},#{createUserId},#{couponTemplateId},#{createHospitalId},#{usedHospitalId},#{status}) | |
| 40 | + insert into coupon_info(id, <include refid="columnList" />) values(#{id},#{sequenceId},#{createDate},#{useDate},#{operatorUseId},#{userId},#{createUserId},#{couponTemplateId},#{createHospitalId},#{usedId},#{usedHospitalId},#{status}) | |
| 41 | 41 | </insert> |
| 42 | 42 | |
| 43 | 43 | <select id="findTemp" parameterType="map" resultType="map"> |
| ... | ... | @@ -102,6 +102,26 @@ |
| 102 | 102 | |
| 103 | 103 | <select id="findUrl" parameterType="string" resultType="map"> |
| 104 | 104 | SELECT create_hospital_id, user_id FROM coupon_info where sequence_id = #{id} |
| 105 | + </select> | |
| 106 | + | |
| 107 | + <update id="invalid" parameterType="map"> | |
| 108 | + update coupon_info a inner join ( | |
| 109 | + select a.id | |
| 110 | + from coupon_info a, coupon_template b, coupon_type c | |
| 111 | + where a.coupon_template_id = b.id and b.type_id = c.id and a.status=1 and c.type in | |
| 112 | + <foreach collection="couponTypes" open="(" close=")" separator="," item="type"> | |
| 113 | + #{type} | |
| 114 | + </foreach> | |
| 115 | + and a.user_id = #{personId} | |
| 116 | + ) b on a.id = b.id set a.status = 3 | |
| 117 | + </update> | |
| 118 | + | |
| 119 | + <select id="findByUsedId" parameterType="string" resultType="string"> | |
| 120 | + select sequence_id from coupon_info where used_id = #{id} limit 0,1 | |
| 121 | + </select> | |
| 122 | + | |
| 123 | + <select id="findCityId" parameterType="string" resultType="string"> | |
| 124 | + select city_id from organization where id = #{hospitalId} | |
| 105 | 125 | </select> |
| 106 | 126 | |
| 107 | 127 | </mapper> |
platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
View file @
dcdc6e8
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | COUPON_IS_CREATED(1007, "该用户已生成优惠券"), |
| 18 | 18 | COUPON_NOT_AVAILABLE(1008, "使用的优惠券类型不正确"), |
| 19 | 19 | COUPON_AREA_NO_USE(1009, "该区域不能使用"), |
| 20 | + OUPON_HOSPITAL_NOT_BOUND_AREA(1010, "该医院未绑定区域ID"), | |
| 20 | 21 | |
| 21 | 22 | COUPON_NOT_FOUND(1001, "优惠券不存在"), |
| 22 | 23 | COUPON_NOT_UNIQUE(1002, "优惠券有多个"), |
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
dcdc6e8
| 1 | 1 | package com.lyms.platform.common.utils; |
| 2 | 2 | |
| 3 | -import org.apache.commons.lang.math.*; | |
| 4 | -import org.apache.commons.lang.math.NumberUtils; | |
| 5 | - | |
| 3 | +import java.util.ArrayList; | |
| 6 | 4 | import java.util.Date; |
| 5 | +import java.util.List; | |
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | 8 | * 添加类的一句话简单描述。 |
| ... | ... | @@ -67,9 +66,7 @@ |
| 67 | 66 | stringBuilder.insert(stringBuilder.length() - 2, "."); |
| 68 | 67 | return stringBuilder.toString(); |
| 69 | 68 | } |
| 70 | - public static void main(String[] args){ | |
| 71 | - System.out.println(cutBabyWeight("5000.1")); | |
| 72 | - } | |
| 69 | + | |
| 73 | 70 | public static Object isEmpty(Object obj, Object defaultVal) { |
| 74 | 71 | if (null == obj) { |
| 75 | 72 | return defaultVal; |
| ... | ... | @@ -220,6 +217,16 @@ |
| 220 | 217 | return ""; |
| 221 | 218 | } |
| 222 | 219 | |
| 220 | + public static <T> List<T> covertToList(String s, Class<T> clazz) { | |
| 221 | + List<T> list = new ArrayList<>(); | |
| 222 | + if (isNotEmpty(s)) { | |
| 223 | + String[] values = s.split(","); | |
| 224 | + for (String value : values) { | |
| 225 | + list.add((T) value); | |
| 226 | + } | |
| 227 | + } | |
| 228 | + return list; | |
| 229 | + } | |
| 223 | 230 | // public static void main(String[] arg) { |
| 224 | 231 | // System.out.print(encryPhone("18382670036")); |
| 225 | 232 | // } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CouponController.java
View file @
dcdc6e8
| ... | ... | @@ -42,6 +42,8 @@ |
| 42 | 42 | |
| 43 | 43 | @Autowired |
| 44 | 44 | private PatientsService patientsService; |
| 45 | + | |
| 46 | + | |
| 45 | 47 | /** |
| 46 | 48 | * 创建用户产检券 |
| 47 | 49 | * @param userId |
| 48 | 50 | |
| ... | ... | @@ -76,17 +78,8 @@ |
| 76 | 78 | return couponService.validate(code, type, autoMatchFacade.getHospitalId(getUserId(request))); |
| 77 | 79 | } |
| 78 | 80 | |
| 79 | - /** | |
| 80 | - * 后期再建档的时候 先验证优惠券 然后再使用 这里先不验证优惠券 | |
| 81 | - * @return | |
| 82 | - */ | |
| 83 | - @RequestMapping(method = RequestMethod.POST, value = "/test") | |
| 84 | - @ResponseBody | |
| 85 | - public BaseObjectResponse testUse() { | |
| 86 | -// patientsService. | |
| 87 | - return RespBuilder.buildSuccess(); | |
| 88 | - } | |
| 89 | 81 | |
| 82 | + | |
| 90 | 83 | /** |
| 91 | 84 | * 获取当前登陆医生所属医院的所有人员 |
| 92 | 85 | * @param request |
| ... | ... | @@ -109,6 +102,26 @@ |
| 109 | 102 | @ResponseBody |
| 110 | 103 | public BaseObjectResponse areas(HttpServletRequest request) { |
| 111 | 104 | return couponService.areas(autoMatchFacade.getHospitalId(getUserId(request))); |
| 105 | + } | |
| 106 | + | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * 作废用户优惠券 | |
| 110 | + * @param personId | |
| 111 | + * @param couponTypes 要删除的类型 | |
| 112 | + */ | |
| 113 | + @RequestMapping(method = RequestMethod.POST, value = "/invalid") | |
| 114 | + public void invalid(String personId, String couponTypes){ | |
| 115 | + couponService.invalid(personId, couponTypes); | |
| 116 | + } | |
| 117 | + | |
| 118 | + | |
| 119 | + @RequestMapping(method = RequestMethod.GET, value = "/test") | |
| 120 | + @ResponseBody | |
| 121 | + public BaseObjectResponse testUse() { | |
| 122 | + System.err.println("xxxxxxxxxxxxxxxxx"); | |
| 123 | + patientsService.autoMatDeliver(); | |
| 124 | + return RespBuilder.buildSuccess(); | |
| 112 | 125 | } |
| 113 | 126 | |
| 114 | 127 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
dcdc6e8
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
dcdc6e8
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.hospitalapi.dzfy.DzfyHisService; | |
| 3 | 4 | import com.lyms.hospitalapi.fnfy.FnfyHisService; |
| 4 | 5 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
| 5 | -import com.lyms.hospitalapi.dzfy.DzfyHisService; | |
| 6 | 6 | import com.lyms.hospitalapi.qinglongxian.QingLongXianHisService; |
| 7 | 7 | import com.lyms.hospitalapi.v2.HisService; |
| 8 | 8 | import com.lyms.platform.biz.service.*; |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | |
| ... | ... | @@ -13,24 +13,20 @@ |
| 13 | 13 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 14 | 14 | import com.lyms.platform.common.result.BaseResponse; |
| 15 | 15 | import com.lyms.platform.common.utils.*; |
| 16 | -import com.lyms.platform.common.utils.StringUtils; | |
| 17 | 16 | import com.lyms.platform.operate.web.request.*; |
| 18 | 17 | import com.lyms.platform.operate.web.result.*; |
| 19 | 18 | import com.lyms.platform.operate.web.utils.BabyListTask; |
| 20 | -import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 21 | 19 | import com.lyms.platform.operate.web.utils.GrowthCountTask; |
| 22 | 20 | import com.lyms.platform.operate.web.utils.MessageCenterService; |
| 23 | 21 | import com.lyms.platform.permission.model.Organization; |
| 24 | 22 | import com.lyms.platform.permission.model.OrganizationQuery; |
| 25 | 23 | import com.lyms.platform.permission.model.Users; |
| 24 | +import com.lyms.platform.permission.service.CouponService; | |
| 26 | 25 | import com.lyms.platform.permission.service.OrganizationService; |
| 27 | 26 | import com.lyms.platform.permission.service.UsersService; |
| 28 | 27 | import com.lyms.platform.pojo.*; |
| 29 | 28 | import com.lyms.platform.query.*; |
| 30 | 29 | import org.apache.commons.collections.CollectionUtils; |
| 31 | -import org.apache.commons.lang.*; | |
| 32 | -import org.apache.commons.lang.math.*; | |
| 33 | -import org.apache.commons.lang.math.NumberUtils; | |
| 34 | 30 | import org.springframework.beans.factory.annotation.Autowired; |
| 35 | 31 | import org.springframework.beans.factory.annotation.Qualifier; |
| 36 | 32 | import org.springframework.data.domain.Sort; |
| ... | ... | @@ -41,7 +37,9 @@ |
| 41 | 37 | import java.io.IOException; |
| 42 | 38 | import java.io.OutputStream; |
| 43 | 39 | import java.util.*; |
| 44 | -import java.util.concurrent.*; | |
| 40 | +import java.util.concurrent.Callable; | |
| 41 | +import java.util.concurrent.Future; | |
| 42 | +import java.util.concurrent.TimeUnit; | |
| 45 | 43 | |
| 46 | 44 | /** |
| 47 | 45 | * |
| 48 | 46 | |
| ... | ... | @@ -127,7 +125,10 @@ |
| 127 | 125 | @Qualifier("commonThreadPool") |
| 128 | 126 | private ThreadPoolTaskExecutor commonThreadPool; |
| 129 | 127 | |
| 128 | + @Autowired | |
| 129 | + private CouponService couponService; | |
| 130 | 130 | |
| 131 | + | |
| 131 | 132 | public BaseResponse getBabyBase(String babyId) { |
| 132 | 133 | //查询儿童的基本信息 |
| 133 | 134 | BabyBasicResult base = new BabyBasicResult(); |
| ... | ... | @@ -416,6 +417,15 @@ |
| 416 | 417 | */ |
| 417 | 418 | public BaseObjectResponse addBabyBookbuilding(BabyBookbuildingAddRequest request,Integer userId) { |
| 418 | 419 | |
| 420 | + /** 验证产检券是否可用 可用就改为已使用状态 */ | |
| 421 | + if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode()) && request.getCouponType() != null) { | |
| 422 | + BaseObjectResponse resp = couponService.validate(request.getCouponCode(), request.getCouponType(), autoMatchFacade.getHospitalId(userId)); | |
| 423 | + if (resp.getErrorcode() != 0) { | |
| 424 | + return resp; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + | |
| 428 | + | |
| 419 | 429 | BaseObjectResponse br = new BaseObjectResponse(); |
| 420 | 430 | try { |
| 421 | 431 | //判断儿童是否建档在该医院 |
| ... | ... | @@ -481,6 +491,12 @@ |
| 481 | 491 | babyPerson.setYn(YnEnums.YES.getId()); |
| 482 | 492 | babyPerson.setCreated(new Date()); |
| 483 | 493 | resperson = personService.addPerson(babyPerson); |
| 494 | + | |
| 495 | + /** 把优惠券设置为已使用状态 */ | |
| 496 | + if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode()) && request.getCouponType() != null) { | |
| 497 | + couponService.use(autoMatchFacade.getHospitalId(userId), request.getCouponCode(), userId, babyPerson.getId()); | |
| 498 | + } | |
| 499 | + | |
| 484 | 500 | babyPersonId = resperson.getId(); |
| 485 | 501 | } |
| 486 | 502 | |
| ... | ... | @@ -531,6 +547,8 @@ |
| 531 | 547 | patientUpdate.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); |
| 532 | 548 | patientsService.updatePatientByPid(patientUpdate, pm.getId()); |
| 533 | 549 | |
| 550 | + /** 儿童建档对应孕妇分娩 【未使用的产检券】要自动作废 */ | |
| 551 | + couponService.invalid(pm.getId(), "2"); | |
| 534 | 552 | |
| 535 | 553 | //作废产检劵 |
| 536 | 554 | patientCheckTicketService.cancelCheckTicket(patients.getHospitalId(), patients.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
dcdc6e8
| ... | ... | @@ -490,11 +490,10 @@ |
| 490 | 490 | ticket.setPatientId(p.getId()); |
| 491 | 491 | ticket.setCreated(new Date()); |
| 492 | 492 | // ticket.setId(areaCode.getAreaCode() + ticketPid + i); |
| 493 | -// ticket.setId(genSequenceIdService.poll(areaCode.getAreaCode())); | |
| 494 | - ticket.setId(genSequenceIdService.poll()); | |
| 493 | + ticket.setId(genSequenceIdService.poll(areaCode.getAreaCode())); | |
| 495 | 494 | ticket.setPid(p.getPid()); |
| 496 | 495 | ticket.setCoupon(CouponEnums.PRENATAL); |
| 497 | - patientCheckTicketService.addTicket(ticket); | |
| 496 | +// patientCheckTicketService.addTicket(ticket); | |
| 498 | 497 | } |
| 499 | 498 | } |
| 500 | 499 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
dcdc6e8
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.RemoteService; | |
| 4 | +import com.lyms.platform.biz.RemoteUrlEnum; | |
| 3 | 5 | import com.lyms.platform.biz.service.*; |
| 4 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 7 | import com.lyms.platform.common.enums.*; |
| 6 | 8 | |
| ... | ... | @@ -11,10 +13,11 @@ |
| 11 | 13 | import com.lyms.platform.operate.web.request.MatDeliverQueryRequest; |
| 12 | 14 | import com.lyms.platform.operate.web.request.NewBabyManagerRequest; |
| 13 | 15 | import com.lyms.platform.operate.web.result.*; |
| 14 | -import com.lyms.platform.operate.web.utils.*; | |
| 16 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 15 | 17 | import com.lyms.platform.permission.model.Organization; |
| 16 | 18 | import com.lyms.platform.permission.model.OrganizationQuery; |
| 17 | 19 | import com.lyms.platform.permission.model.Users; |
| 20 | +import com.lyms.platform.permission.service.CouponService; | |
| 18 | 21 | import com.lyms.platform.permission.service.OrganizationService; |
| 19 | 22 | import com.lyms.platform.permission.service.UsersService; |
| 20 | 23 | import com.lyms.platform.pojo.*; |
| 21 | 24 | |
| ... | ... | @@ -81,7 +84,13 @@ |
| 81 | 84 | @Autowired |
| 82 | 85 | private BasicConfigService basicConfigService; |
| 83 | 86 | |
| 87 | + @Autowired | |
| 88 | + private RemoteService remoteService; | |
| 84 | 89 | |
| 90 | + @Autowired | |
| 91 | + private CouponService couponService; | |
| 92 | + | |
| 93 | + | |
| 85 | 94 | private static Map<Integer, String> ONE_ENUMS = new HashMap<>(); |
| 86 | 95 | |
| 87 | 96 | private static Map<String, List> babyMap = new HashMap<>(); |
| ... | ... | @@ -131,6 +140,14 @@ |
| 131 | 140 | * @return |
| 132 | 141 | */ |
| 133 | 142 | public BaseResponse addOrUpdateMatDeliver(MatDeliverAddRequest deliverAddRequest, Integer userId) { |
| 143 | + /** 验证产检券是否可用 可用就改为已使用状态 */ | |
| 144 | + if(StringUtils.isNotBlank(deliverAddRequest.getCouponCode()) && deliverAddRequest.getCouponType() != null) { | |
| 145 | + BaseObjectResponse resp = couponService.validate(deliverAddRequest.getCouponCode(), deliverAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId)); | |
| 146 | + if (resp.getErrorcode() != 0) { | |
| 147 | + return resp; | |
| 148 | + } | |
| 149 | + } | |
| 150 | + | |
| 134 | 151 | List<MaternalDeliverModel.Baby> babyList = new ArrayList<>(); |
| 135 | 152 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 136 | 153 | MaternalDeliverModel maternalDeliverModel = deliverAddRequest.convertToDataModel(); |
| ... | ... | @@ -250,6 +267,12 @@ |
| 250 | 267 | |
| 251 | 268 | maternalDeliverModel.setYn(YnEnums.YES.getId()); |
| 252 | 269 | matDeliverService.addMatDeliver(maternalDeliverModel); |
| 270 | + | |
| 271 | + /** 使用优惠券 */ | |
| 272 | + if(StringUtils.isNotBlank(deliverAddRequest.getCouponCode()) && deliverAddRequest.getCouponType() != null) { | |
| 273 | + couponService.use(hospitalId, deliverAddRequest.getCouponCode(), userId, maternalDeliverModel.getId()); | |
| 274 | + } | |
| 275 | + | |
| 253 | 276 | //作废产检劵 |
| 254 | 277 | patientCheckTicketService.cancelCheckTicket(hospitalId,deliverAddRequest.getParentId()); |
| 255 | 278 | //修改 |
| ... | ... | @@ -324,6 +347,9 @@ |
| 324 | 347 | |
| 325 | 348 | //修改分娩日期 |
| 326 | 349 | updatePatientFmDate(patients.getPid(), fmDate, 3); |
| 350 | + | |
| 351 | + /** 填写分娩表分娩 >> 作废未使用的产检券 */ | |
| 352 | + remoteService.invalidCoupon(patients.getPid(), "2", RemoteUrlEnum.INVALID_COUPON_URL); | |
| 327 | 353 | } |
| 328 | 354 | } else { |
| 329 | 355 | return new BaseResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("parentId 为空,找不到产妇"); |
| ... | ... | @@ -760,6 +786,7 @@ |
| 760 | 786 | matDeliverListResult.setRiskFactor(highScoreResult.getHighRisk()); |
| 761 | 787 | matDeliverListResult.setRiskScore(highScoreResult.getScoreStr()); |
| 762 | 788 | matDeliverListResult.setTireNumber1(tTireNumber); |
| 789 | + | |
| 763 | 790 | } catch (Exception e) { |
| 764 | 791 | } |
| 765 | 792 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(matDeliverListResult); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
dcdc6e8
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | import com.lyms.platform.operate.web.result.StopPregResult; |
| 14 | 14 | import com.lyms.platform.permission.model.Users; |
| 15 | 15 | import com.lyms.platform.permission.model.UsersQuery; |
| 16 | +import com.lyms.platform.permission.service.CouponService; | |
| 16 | 17 | import com.lyms.platform.permission.service.UsersService; |
| 17 | 18 | import com.lyms.platform.pojo.*; |
| 18 | 19 | import com.lyms.platform.query.*; |
| ... | ... | @@ -58,6 +59,9 @@ |
| 58 | 59 | @Autowired |
| 59 | 60 | private PatientCheckTicketService patientCheckTicketService; |
| 60 | 61 | |
| 62 | + @Autowired | |
| 63 | + private CouponService couponService; | |
| 64 | + | |
| 61 | 65 | /** |
| 62 | 66 | * 更新终止妊娠 |
| 63 | 67 | * |
| ... | ... | @@ -105,6 +109,11 @@ |
| 105 | 109 | } |
| 106 | 110 | |
| 107 | 111 | stopPregnancyService.updateStopPreg(model, request.getId()); |
| 112 | + | |
| 113 | + /** 终止妊娠后 【未使用的产检券和分娩券】要自动作废 */ | |
| 114 | + couponService.invalid(request.getPid(), "2,4"); | |
| 115 | + | |
| 116 | + | |
| 108 | 117 | BaseResponse objectResponse = new BaseResponse(); |
| 109 | 118 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 110 | 119 | objectResponse.setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
dcdc6e8
| ... | ... | @@ -9,10 +9,14 @@ |
| 9 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
| 10 | 10 | import com.lyms.platform.common.utils.SystemConfig; |
| 11 | 11 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
| 12 | -import com.lyms.platform.operate.web.result.*; | |
| 12 | +import com.lyms.platform.operate.web.result.BabyCheckPageResult; | |
| 13 | +import com.lyms.platform.operate.web.result.BabyPageResult; | |
| 14 | +import com.lyms.platform.operate.web.result.HighScoreResult; | |
| 15 | +import com.lyms.platform.operate.web.result.ResidentsPageResult; | |
| 13 | 16 | import com.lyms.platform.operate.web.utils.*; |
| 14 | 17 | import com.lyms.platform.permission.model.Organization; |
| 15 | 18 | import com.lyms.platform.permission.model.Users; |
| 19 | +import com.lyms.platform.permission.service.CouponService; | |
| 16 | 20 | import com.lyms.platform.permission.service.OrganizationService; |
| 17 | 21 | import com.lyms.platform.permission.service.UsersService; |
| 18 | 22 | import com.lyms.platform.pojo.*; |
| ... | ... | @@ -67,6 +71,9 @@ |
| 67 | 71 | @Autowired |
| 68 | 72 | private ResidentsArchiveService residentsArchiveService; |
| 69 | 73 | |
| 74 | + @Autowired | |
| 75 | + private CouponService couponService; | |
| 76 | + | |
| 70 | 77 | /** |
| 71 | 78 | * 建档查询 |
| 72 | 79 | * @param id |
| ... | ... | @@ -169,6 +176,8 @@ |
| 169 | 176 | //建档孕周 |
| 170 | 177 | map.put("buildDueWeek",ResolveUtils.getPregnancyWeek(data,data.getBookbuildingDate())); |
| 171 | 178 | |
| 179 | + /** 优惠券编号 */ | |
| 180 | + map.put("couponCode", couponService.findByUsedId(id)); | |
| 172 | 181 | br.setData(map); |
| 173 | 182 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 174 | 183 | br.setErrormsg("成功"); |
| ... | ... | @@ -541,6 +550,9 @@ |
| 541 | 550 | map.put("ydqjd",FunvCommonUtil.getBaseicConfigByid(ydqjd, basicConfigService)); |
| 542 | 551 | map.put("bChao",data.getbChao()); |
| 543 | 552 | |
| 553 | + /** 优惠券编号 */ | |
| 554 | + map.put("couponCode", couponService.findByUsedId(id)); | |
| 555 | + | |
| 544 | 556 | //体重指数 yqWeight |
| 545 | 557 | if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(data.getYqWeight()) && com.lyms.platform.common.utils.StringUtils.isNotEmpty(data.getHeight())) |
| 546 | 558 | { |
| ... | ... | @@ -742,6 +754,9 @@ |
| 742 | 754 | map.put("treatmentOpinion",data.getTreatmentOpinion()); |
| 743 | 755 | map.put("guide",data.getGuide()); |
| 744 | 756 | |
| 757 | + /** 优惠券编号 */ | |
| 758 | + map.put("couponCode", couponService.findByUsedId(id)); | |
| 759 | + | |
| 745 | 760 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 746 | 761 | br.setErrormsg("成功"); |
| 747 | 762 | br.setData(map); |
| ... | ... | @@ -1125,6 +1140,9 @@ |
| 1125 | 1140 | } |
| 1126 | 1141 | |
| 1127 | 1142 | map.put("baby", babyList); |
| 1143 | + | |
| 1144 | + /** 优惠券编号 */ | |
| 1145 | + map.put("couponCode", couponService.findByUsedId(id)); | |
| 1128 | 1146 | |
| 1129 | 1147 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1130 | 1148 | br.setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyBookbuildingAddRequest.java
View file @
dcdc6e8
| ... | ... | @@ -169,6 +169,26 @@ |
| 169 | 169 | //病历号(住院号) |
| 170 | 170 | private String blNo; |
| 171 | 171 | |
| 172 | + private String couponCode; | |
| 173 | + | |
| 174 | + private Integer couponType; | |
| 175 | + | |
| 176 | + public String getCouponCode() { | |
| 177 | + return couponCode; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public void setCouponCode(String couponCode) { | |
| 181 | + this.couponCode = couponCode; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public Integer getCouponType() { | |
| 185 | + return couponType; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setCouponType(Integer couponType) { | |
| 189 | + this.couponType = couponType; | |
| 190 | + } | |
| 191 | + | |
| 172 | 192 | public String getBlNo() { |
| 173 | 193 | return blNo; |
| 174 | 194 | } |
platform-operate-api/src/main/resources/config.properties
View file @
dcdc6e8
| ... | ... | @@ -65,4 +65,10 @@ |
| 65 | 65 | jdbc.6.url=jdbc:oracle:thin:@119.90.57.26:1522:orcl |
| 66 | 66 | jdbc.6.username=LYMS_ODS |
| 67 | 67 | jdbc.6.password=Welcome1 |
| 68 | + | |
| 69 | +# 远程调用类型 1=本地 2=测试环境 3=线上环境 | |
| 70 | +remote.url.type=1 | |
| 71 | +platform.operate.api.1.url=http://localhost:9091/ | |
| 72 | +platform.operate.api.2.url=https://dev-rp.healthbaby.com.cn/ | |
| 73 | +platform.operate.api.3.url=https://dev-rp.healthbaby.com.cn/ |
platform-operate-api/src/main/resources/database.properties
View file @
dcdc6e8