From 558f9c95b21bbf21c09ee745e56b302498ea6818 Mon Sep 17 00:00:00 2001 From: changpengfei Date: Fri, 10 Sep 2021 10:06:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=B1=BB=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3;=E6=9D=A5=E8=87=AA=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=88=96=E5=8C=BB=E9=99=A2;=E6=82=A3?= =?UTF-8?q?=E8=80=85=E4=BF=A1=E6=81=AF=E7=BB=9F=E8=AE=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PatientController.java | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index b788671..f89a00f 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -1,5 +1,6 @@ package com.lyms.talkonlineweb.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.lyms.talkonlineweb.domain.*; @@ -8,22 +9,21 @@ import com.lyms.talkonlineweb.service.*; import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.JwtUtils; import lombok.extern.log4j.Log4j2; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 患者管理 */ @RestController @RequestMapping("pat") -@Log4j2 +@Slf4j public class PatientController { @Autowired @@ -53,11 +53,31 @@ public class PatientController { * @return */ @GetMapping("sltPatientLst") - public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size){ + public BaseResponse sltPatientLst(PatientInfo patientInfo, int current, int size,@RequestParam(required = false) Integer qtype){ BaseResponse baseResponse=new BaseResponse(); Page page=new Page<>(current,size); - Page patientPagePage=patientInfoService.page(page, Wrappers.query(patientInfo)); + QueryWrapper queryWrapper = Wrappers.query(patientInfo); + if (Objects.nonNull(qtype) &&qtype==1){//从小程序购买 + queryWrapper.inSql("id","SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=1"); + } + if (Objects.nonNull(qtype) && qtype==2){//从医院购买 + queryWrapper.inSql("id","SELECT t.`pid` FROM lyms_tcard t WHERE t.`fid`=2"); + } + Page patientPagePage=patientInfoService.page(page, queryWrapper); + List pLst=patientInfoService.list(queryWrapper); + int daiCnt=pLst.parallelStream().mapToInt(PatientInfo::getCcnt).sum();//待使用数量 + List pids=pLst.parallelStream().map(PatientInfo::getId).collect(Collectors.toList()); + + LymsTcard tcard=new LymsTcard(); + QueryWrapper tWrapper = Wrappers.query(tcard); + if(pids.size()==0){ + pids.add(-1); + } + tWrapper.in("pid",pids); + int sum=lymsTcardService.list(tWrapper).parallelStream().mapToInt(LymsTcard::getCnt).sum(); + + log.error("统计需要改动数据结构:daiCnt:{} sum:{}",daiCnt,sum); baseResponse.setObject(patientPagePage); return baseResponse; @@ -99,9 +119,6 @@ public class PatientController { f=lymsPcaseService.saveOrUpdate(pcase); String[] iArr=illness.split(","); - log.info(patient); - log.info(pcase); - Map param=new HashMap(); for (int i = 0; i < iArr.length; i++) { @@ -118,7 +135,7 @@ public class PatientController { ness.setId(iLst.get(0).getId()); } f=lymsIllnessService.saveOrUpdate(ness); - log.info(ness); + log.info(ness.toString()); } //需要添加医院购买卡记录 -- 1.8.3.1