Commit 1cc0a4a5ebb76e53e5d5b6f4c6946c655aa1a3d6
1 parent
23371d4f9d
Exists in
dev
#fix:优化医信照护订单导出逻辑及续费逻辑
Showing 13 changed files with 102 additions and 15 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsHisInfoMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/OrderDetailsResult.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/OrderListResponse.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java
- talkonlineweb/src/main/resources/mapper/LymsHisInfoMapper.xml
- talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
View file @
1cc0a4a
| ... | ... | @@ -100,8 +100,8 @@ |
| 100 | 100 | * @return |
| 101 | 101 | */ |
| 102 | 102 | @PostMapping("upAllHisInfo") |
| 103 | - /* @TokenRequired | |
| 104 | - @Resubmit*/ | |
| 103 | + @TokenRequired | |
| 104 | + @Resubmit | |
| 105 | 105 | public BaseResponse upAllHisInfo(){ |
| 106 | 106 | BaseResponse baseResponse=new BaseResponse(); |
| 107 | 107 | baseResponse.setErrorcode(0); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java
View file @
1cc0a4a
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | import com.lyms.talkonlineweb.request.HisInfoExportVO; |
| 15 | 15 | import com.lyms.talkonlineweb.request.OrderRequest; |
| 16 | 16 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 17 | +import com.lyms.talkonlineweb.result.OrderDetailsResult; | |
| 17 | 18 | import com.lyms.talkonlineweb.result.OrderListResponse; |
| 18 | 19 | import com.lyms.talkonlineweb.service.*; |
| 19 | 20 | import com.lyms.talkonlineweb.util.*; |
| ... | ... | @@ -92,6 +93,23 @@ |
| 92 | 93 | |
| 93 | 94 | } |
| 94 | 95 | |
| 96 | + /** | |
| 97 | + * 获取续费明细 | |
| 98 | + * @return | |
| 99 | + */ | |
| 100 | + @GetMapping("/getOrderDetails") | |
| 101 | + @TokenRequired | |
| 102 | + public BaseResponse selectOrderDetails(Integer pId){ | |
| 103 | + BaseResponse baseResponse = new BaseResponse(); | |
| 104 | + //参数校验 | |
| 105 | + if (pId== null) | |
| 106 | + { | |
| 107 | + baseResponse.setErrorcode(1); | |
| 108 | + baseResponse.setErrormsg("参数错误"); | |
| 109 | + return baseResponse; | |
| 110 | + } | |
| 111 | + return BaseResponse.ok(lymsOrderService.selectOrderList(pId)); | |
| 112 | + } | |
| 95 | 113 | |
| 96 | 114 | /** |
| 97 | 115 | * 创建支付订单,并把订单提交到微信平台 |
| ... | ... | @@ -216,6 +234,13 @@ |
| 216 | 234 | |
| 217 | 235 | if(CollectionUtils.isNotEmpty(orderListResponses.getRecords())){ |
| 218 | 236 | for(OrderListResponse responses: orderListResponses.getRecords()){ |
| 237 | + if (responses.getPcid()!=null){ | |
| 238 | + List<OrderDetailsResult> detailsResults= lymsOrderService.selectOrderList(responses.getPid()); | |
| 239 | + if (CollectionUtils.isNotEmpty(detailsResults)){ | |
| 240 | + OrderDetailsResult orderDetailsResult= detailsResults.get(detailsResults.size()-1); | |
| 241 | + responses.setCnt(orderDetailsResult.getNum()/4); | |
| 242 | + } | |
| 243 | + } | |
| 219 | 244 | responses.setOrderType(responses.getPcid() != null ? 2 : 1); |
| 220 | 245 | responses.setOrderTypeName(responses.getPcid() != null ? "续费" : "初次购买"); |
| 221 | 246 | responses.setSex("1".equals(responses.getSex())?"男":"女"); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
1cc0a4a
| ... | ... | @@ -290,6 +290,8 @@ |
| 290 | 290 | pcase.setCreatedby(patient.getCreatedby()); |
| 291 | 291 | pcase.setPid(patient.getId()); |
| 292 | 292 | pcase.setCreatedtime(new Date()); |
| 293 | + pcase.setHid(patient.getHId()); | |
| 294 | + pcase.setHname(patient.getHName()); | |
| 293 | 295 | f = lymsPcaseService.saveOrUpdate(pcase); |
| 294 | 296 | |
| 295 | 297 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java
View file @
1cc0a4a
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsHisInfoMapper.java
View file @
1cc0a4a
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.talkonlineweb.domain.LymsHisInfo; |
| 4 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 5 | +import com.lyms.talkonlineweb.result.OrderDetailsResult; | |
| 5 | 6 | import org.apache.ibatis.annotations.Param; |
| 6 | 7 | |
| 7 | 8 | import java.util.Date; |
| ... | ... | @@ -13,5 +14,6 @@ |
| 13 | 14 | public interface LymsHisInfoMapper extends BaseMapper<LymsHisInfo> { |
| 14 | 15 | |
| 15 | 16 | List<LymsHisInfo> selectByOrder(@Param("endTime") Date endTime,@Param("startTime") Date startTime); |
| 17 | + List<OrderDetailsResult> selectOrderList(@Param("pid") Integer pid); | |
| 16 | 18 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/OrderDetailsResult.java
View file @
1cc0a4a
| 1 | +package com.lyms.talkonlineweb.result; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +@Data | |
| 9 | +public class OrderDetailsResult { | |
| 10 | + @TableField(value = "up_time") | |
| 11 | + private Date upTime; | |
| 12 | + private String amount; | |
| 13 | + private Integer num; | |
| 14 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/OrderListResponse.java
View file @
1cc0a4a
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java
View file @
1cc0a4a
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.talkonlineweb.domain.LymsAttention; |
| 6 | 6 | import com.lyms.talkonlineweb.domain.LymsOrder; |
| 7 | 7 | import com.lyms.talkonlineweb.request.OrderRequest; |
| 8 | +import com.lyms.talkonlineweb.result.OrderDetailsResult; | |
| 8 | 9 | import com.lyms.talkonlineweb.result.OrderListResponse; |
| 9 | 10 | import com.lyms.talkonlineweb.result.PushOrderResult; |
| 10 | 11 | |
| ... | ... | @@ -31,5 +32,6 @@ |
| 31 | 32 | List<PushOrderResult> selectPushOrder(Integer pId); |
| 32 | 33 | |
| 33 | 34 | Page<OrderListResponse> queryOrderList(Page<OrderListResponse> page, OrderRequest orderRequest); |
| 35 | + List<OrderDetailsResult> selectOrderList(Integer pId); | |
| 34 | 36 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
1cc0a4a
| ... | ... | @@ -118,7 +118,7 @@ |
| 118 | 118 | } |
| 119 | 119 | if (patient != null) { |
| 120 | 120 | List<PushOrderResult> orderList = lymsOrderService.selectPushOrder(patient.getId()); |
| 121 | - log.info("SendWeChatMsg--->orderList," + orderList.toString()); | |
| 121 | + //log.info("SendWeChatMsg--->orderList," + orderList.toString()); | |
| 122 | 122 | if (CollectionUtils.isNotEmpty(orderList)) { |
| 123 | 123 | PushOrderResult order = orderList.get(0); |
| 124 | 124 | if (!order.getDname().contains("产科")){ |
| ... | ... | @@ -510,7 +510,7 @@ |
| 510 | 510 | if (CollectionUtils.isNotEmpty(list)){ |
| 511 | 511 | LymsOrder lymsOrder= list.get(0); |
| 512 | 512 | Date date=new Date(); |
| 513 | - if (DateUtil.getDateTime(date,"yyyy-MM-dd").equals(DateUtil.getDateTime(lymsOrder.getServiceStartTime(),"yyyy-MM-dd"))){ | |
| 513 | + if (DateUtil.getDateTime(date,"yyyy-MM-dd").equals(DateUtil.getDateTime(lymsOrder.getPayTime(),"yyyy-MM-dd"))){ | |
| 514 | 514 | throw new RuntimeException("order is not empty"); |
| 515 | 515 | } |
| 516 | 516 | } |
| ... | ... | @@ -648,6 +648,7 @@ |
| 648 | 648 | } |
| 649 | 649 | patient.setIdno(patient.getIdno().toLowerCase()); |
| 650 | 650 | LymsPatient tmpP = new LymsPatient(); |
| 651 | + Integer ccnt=patient.getCcnt(); | |
| 651 | 652 | tmpP.setIdno(patient.getIdno().toLowerCase()); |
| 652 | 653 | LymsPatient patient2 = lymsPatientService.getOne(Wrappers.query(tmpP).eq("idno", patient.getIdno())); |
| 653 | 654 | if (patient2 == null) { |
| ... | ... | @@ -711,7 +712,7 @@ |
| 711 | 712 | queryWrapper.eq("pid", patient.getId()); |
| 712 | 713 | queryWrapper.eq("status", 1); |
| 713 | 714 | //queryWrapper.eq("pcid", pcase.getPcid()); |
| 714 | - queryWrapper.le("service_end_time", new Date()); | |
| 715 | + //queryWrapper.le("service_end_time", DateUtil.addDay(new Date(),30)); | |
| 715 | 716 | List<LymsOrder> list = lymsOrderService.list(queryWrapper); |
| 716 | 717 | LymsOrder lymsOrder; |
| 717 | 718 | Integer renew = 0; |
| 718 | 719 | |
| 719 | 720 | |
| ... | ... | @@ -731,12 +732,14 @@ |
| 731 | 732 | lymsOrder.setPrice(3600); |
| 732 | 733 | lymsOrder.setPayTime(new Date()); |
| 733 | 734 | if (renew == 1) { |
| 734 | - lymsOrder.setCnt(lymsOrder.getCnt()+patient.getCcnt() / 6); | |
| 735 | + lymsOrder.setCnt(lymsOrder.getCnt()+ccnt / 6); | |
| 735 | 736 | if(pcase!=null&&pcase.getPcid()!=null){ |
| 736 | 737 | lymsOrder.setPcid(pcase.getPcid()); |
| 738 | + }else { | |
| 739 | + lymsOrder.setPcid(1);//默认 | |
| 737 | 740 | } |
| 738 | 741 | } else { |
| 739 | - lymsOrder.setCnt(patient.getCcnt() / 6); | |
| 742 | + lymsOrder.setCnt(ccnt / 6); | |
| 740 | 743 | lymsOrder.setServiceStartTime(instDate); |
| 741 | 744 | lymsOrder.setCreatedtime(new Date()); |
| 742 | 745 | } |
| ... | ... | @@ -772,7 +775,7 @@ |
| 772 | 775 | Map<String, Object> map = new HashMap<>(); |
| 773 | 776 | map.put("idno", patient.getIdno().toUpperCase()); |
| 774 | 777 | map.put("name", patient.getPname()); |
| 775 | - map.put("weeks", patient.getCcnt() / 6 * 4); | |
| 778 | + map.put("weeks", ccnt / 6 * 4); | |
| 776 | 779 | map.put("renew", renew); |
| 777 | 780 | map.put("phone",patient.getEnrolmentPhone()); |
| 778 | 781 | map.put("hospitalId",pcase.getHid()); |
| ... | ... | @@ -788,7 +791,7 @@ |
| 788 | 791 | } |
| 789 | 792 | try { |
| 790 | 793 | String response = HttpUtil.post( apiPath+ Constant.PLATFORM_AUTO_OPEN_SERVICE_URL, map); |
| 791 | - log.info("/yxzh/patSer--->is",response); | |
| 794 | + //log.info("/yxzh/patSer--->is",response); | |
| 792 | 795 | lymsOrderService.saveOrUpdate(lymsOrder); |
| 793 | 796 | }catch (Exception e){ |
| 794 | 797 | log.error("/yxzh/patSer,"+e.getMessage()); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java
View file @
1cc0a4a
| ... | ... | @@ -7,11 +7,9 @@ |
| 7 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 8 | 8 | import com.lyms.talkonlineweb.domain.*; |
| 9 | 9 | import com.lyms.talkonlineweb.enums.PayStatus; |
| 10 | -import com.lyms.talkonlineweb.mapper.LymsAttentionMapper; | |
| 11 | -import com.lyms.talkonlineweb.mapper.LymsOrderMapper; | |
| 12 | -import com.lyms.talkonlineweb.mapper.LymsPatientMapper; | |
| 13 | -import com.lyms.talkonlineweb.mapper.LymsTcardMapper; | |
| 10 | +import com.lyms.talkonlineweb.mapper.*; | |
| 14 | 11 | import com.lyms.talkonlineweb.request.OrderRequest; |
| 12 | +import com.lyms.talkonlineweb.result.OrderDetailsResult; | |
| 15 | 13 | import com.lyms.talkonlineweb.result.OrderListResponse; |
| 16 | 14 | import com.lyms.talkonlineweb.result.PushOrderResult; |
| 17 | 15 | import com.lyms.talkonlineweb.service.LymsAttentionService; |
| ... | ... | @@ -27,6 +25,7 @@ |
| 27 | 25 | import org.springframework.transaction.annotation.Transactional; |
| 28 | 26 | |
| 29 | 27 | import javax.annotation.Resource; |
| 28 | +import java.util.ArrayList; | |
| 30 | 29 | import java.util.Date; |
| 31 | 30 | import java.util.List; |
| 32 | 31 | |
| ... | ... | @@ -49,6 +48,8 @@ |
| 49 | 48 | private LymsOrderMapper lymsOrderMapper; |
| 50 | 49 | @Resource |
| 51 | 50 | private LymsPcaseService lymsPcaseService; |
| 51 | + @Autowired | |
| 52 | + private LymsHisInfoMapper lymsHisInfoMapper; | |
| 52 | 53 | |
| 53 | 54 | @Override |
| 54 | 55 | @Transactional(rollbackFor = Exception.class) |
| ... | ... | @@ -154,6 +155,31 @@ |
| 154 | 155 | @Override |
| 155 | 156 | public Page<OrderListResponse> queryOrderList(Page<OrderListResponse> page, OrderRequest orderRequest) { |
| 156 | 157 | return lymsOrderMapper.queryOrderList(page,orderRequest); |
| 158 | + } | |
| 159 | + | |
| 160 | + @Override | |
| 161 | + public List<OrderDetailsResult> selectOrderList(Integer pId) { | |
| 162 | + List<OrderDetailsResult> list= lymsHisInfoMapper.selectOrderList(pId); | |
| 163 | + if (list==null || list.size()<2){ | |
| 164 | + QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>(); | |
| 165 | + queryWrapper.eq("pid",pId); | |
| 166 | + queryWrapper.eq("status",1); | |
| 167 | + List<LymsOrder> orderList= list(queryWrapper); | |
| 168 | + list=new ArrayList<>(); | |
| 169 | + if (CollectionUtils.isNotEmpty(orderList)){ | |
| 170 | + for (LymsOrder lymsOrder :orderList) { | |
| 171 | + OrderDetailsResult orderDetailsResult=new OrderDetailsResult(); | |
| 172 | + orderDetailsResult.setUpTime(lymsOrder.getPayTime()); | |
| 173 | + orderDetailsResult.setAmount(String.valueOf(lymsOrder.getAmount()/100)); | |
| 174 | + orderDetailsResult.setNum(lymsOrder.getCnt()*4); | |
| 175 | + list.add(orderDetailsResult); | |
| 176 | + } | |
| 177 | + } | |
| 178 | + return list; | |
| 179 | + }else { | |
| 180 | + return list; | |
| 181 | + } | |
| 182 | + | |
| 157 | 183 | } |
| 158 | 184 | |
| 159 | 185 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/GetPatientInfoTask.java
View file @
1cc0a4a
| ... | ... | @@ -74,7 +74,7 @@ |
| 74 | 74 | if (StringUtil.isNotEmpty(param)) { |
| 75 | 75 | //返回数据 |
| 76 | 76 | String result = HttpUtil.getData(url + "?" + param); |
| 77 | - log.info("task get qhddeyy his info result ,{}", result); | |
| 77 | + // log.info("task get qhddeyy his info result ,{}", result); | |
| 78 | 78 | if (StringUtil.isNotEmpty(result)) { |
| 79 | 79 | List<Map<String, Object>> listMap = JsonUtil.str2Obj(result, List.class); |
| 80 | 80 | for (Map<String, Object> map : listMap) { |
talkonlineweb/src/main/resources/mapper/LymsHisInfoMapper.xml
View file @
1cc0a4a
| ... | ... | @@ -41,5 +41,15 @@ |
| 41 | 41 | ((<![CDATA[o.service_end_time>=#{endTime}]]> ) or |
| 42 | 42 | (hi.num >0)) |
| 43 | 43 | </select> |
| 44 | + | |
| 45 | + <select id="selectOrderList" resultType="com.lyms.talkonlineweb.result.OrderDetailsResult"> | |
| 46 | + SELECT | |
| 47 | + hi.up_time,hi.amount,hi.num | |
| 48 | +FROM | |
| 49 | + lyms_patient p | |
| 50 | +INNER JOIN lyms_his_info hi ON hi.idCard = p.idno | |
| 51 | +where p.id=#{pid} | |
| 52 | +and hi.up_type=1 | |
| 53 | + </select> | |
| 44 | 54 | </mapper> |