From d47060658f33b38688b41224bb787370547e7c7d Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期一, 20 五月 2024 17:43:12 +0800 Subject: [PATCH] zjh 2024/05/20-1 --- ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerBlackMapper.java | 4 + ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerBlackServiceImpl.java | 9 ++ ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomerBlack.java | 30 ++++++ ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java | 6 + ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjCustomerBlackService.java | 1 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerBlackController.java | 105 +++++++++++++++++++++++++ ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java | 2 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java | 5 + ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java | 11 ++ ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomer.java | 3 ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictCompController.java | 42 ++++++++-- 11 files changed, 203 insertions(+), 15 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictCompController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictCompController.java index 91bf6f0..4ff09ee 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictCompController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/DictCompController.java @@ -1,23 +1,25 @@ package com.ltkj.web.controller.system; +import java.util.Date; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import cn.hutool.core.date.DateUtil; import cn.hutool.extra.pinyin.PinyinUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ltkj.framework.config.MatchUtils; +import com.ltkj.hosp.domain.TjCustomerBlack; +import com.ltkj.hosp.domain.TjReservation; +import com.ltkj.hosp.service.ITjReservationService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; @@ -39,7 +41,8 @@ public class DictCompController extends BaseController { @Resource private IDictCompService dictCompService; - + @Resource + private ITjReservationService reservationService; /** * 鑾峰彇鍗曚綅淇℃伅闆嗗悎鎺ュ彛 */ @@ -113,4 +116,25 @@ public AjaxResult remove(@PathVariable String[] drugManufacturerIds) { return toAjax(dictCompService.deleteDictCompByDrugManufacturerIds(drugManufacturerIds)); } + + + @GetMapping("/getCusTomterListByCompId") + @ApiOperation(value = "鑾峰彇鍗曚綅id浣撴浜轰俊鎭帴鍙�") + public AjaxResult getCusTomterListByCompId(@RequestParam(required = false) @ApiParam(value = "鍗曚綅id") String compId, + @RequestParam(required = false) @ApiParam(value = "鍚嶅瓧") String name, + @RequestParam(required = false) @ApiParam(value = "閮ㄩ棬id") String deptId, + @RequestParam(required = false) @ApiParam(value = "棰勭害鏃堕棿") Date reservationTime, + @RequestParam(defaultValue = "1") @ApiParam(value = "椤电爜鏁�") Integer page, + @RequestParam(defaultValue = "10") @ApiParam(value = "姣忛〉鏄剧ず鏉℃暟") Integer pageSize) { + IPage<TjReservation> pages=new Page<>(page,pageSize); + LambdaQueryWrapper<TjReservation> wq=new LambdaQueryWrapper<>(); + if(null !=compId)wq.eq(TjReservation::getCompanyId,compId); + if(null !=name)wq.eq(TjReservation::getName,name); + if(null !=deptId)wq.eq(TjReservation::getDepartment,deptId); + if(null !=reservationTime)wq.between(TjReservation::getReservationTime, DateUtil.beginOfDay(reservationTime),DateUtil.endOfDay(reservationTime)); + IPage<TjReservation> iPage = reservationService.page(pages, wq); + return AjaxResult.success(iPage); + } + + } diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerBlackController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerBlackController.java index bb2d489..fd75f5b 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerBlackController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerBlackController.java @@ -1,15 +1,116 @@ package com.ltkj.web.controller.system; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ltkj.common.core.controller.BaseController; +import com.ltkj.common.core.domain.AjaxResult; +import com.ltkj.hosp.domain.TjCustomer; +import com.ltkj.hosp.domain.TjCustomerBlack; +import com.ltkj.hosp.service.*; +import com.ltkj.system.service.ISysConfigService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; @RestController @RequestMapping("/hosp/cusBlack") @Api(tags = "PC绔� ----浣撴榛戝悕鍗曡褰曟帴鍙�") @Slf4j public class TjCustomerBlackController extends BaseController { + @Resource + private ITjCustomerService customerService; + @Resource + private TjCustomerBlackService blackService; + @Resource + private ITjOrderService tjOrderService; + @Autowired + private ISysConfigService configService; + @PostMapping("/addCustomerBlack") + @ApiOperation(value = "娣诲姞榛戝悕鍗�") + public AjaxResult addCustomerBlack(@RequestBody TjCustomerBlack customerBlack) { +// TjCustomer customer = customerService.getTjCustomerByCusIdCard(String.valueOf(customerBlack.getCusId())); + TjCustomer customer = customerService.getById(customerBlack.getCusId()); + if (null != customer) { + LambdaQueryWrapper<TjCustomerBlack>wq=new LambdaQueryWrapper<>(); + wq.eq(TjCustomerBlack::getCusId,customer.getCusId()); + wq.eq(TjCustomerBlack::getIsExpiration,"N"); + TjCustomerBlack tjCustomerBlack = blackService.getOne(wq); + if(null !=tjCustomerBlack){ + return AjaxResult.error("璇ヤ汉鍛樺凡缁忔槸榛戝悕鍗� 涓嶅彲閲嶅鍔犲叆!"); + } + customerBlack.setCusId(customer.getCusId()); + String days = customerBlack.getDays(); + if(null ==days){ + days = configService.selectConfigByKey("Blacklist"); + customerBlack.setDays(days); + } + DateTime day = DateUtil.offsetDay(new Date(), Integer.parseInt(days)); + customerBlack.setExpirationTime(day); + customerBlack.setIsExpiration("N"); + customerBlack.setCusName(customer.getCusName()); + customerBlack.setCusPhone(customer.getCusPhone()); + return AjaxResult.success(blackService.save(customerBlack)); + } + return AjaxResult.success("璇ヤ汉鍛樹笉瀛樺湪!"); + } + + @PutMapping("/putCustomerBlack") + @ApiOperation(value = "淇敼榛戝悕鍗�") + public AjaxResult putCustomerBlack(@RequestBody TjCustomerBlack customerBlack) { + + String days = customerBlack.getDays(); + if(null ==days){ + days = configService.selectConfigByKey("Blacklist"); + } + DateTime day = DateUtil.offsetDay(new Date(), Integer.parseInt(days)); + customerBlack.setExpirationTime(day); + if(day.before(new Date())){ + customerBlack.setIsExpiration("Y"); + }else { + customerBlack.setIsExpiration("N"); + } + return AjaxResult.success(blackService.updateById(customerBlack)); + } + + @DeleteMapping("/delCustomerBlack") + @ApiOperation(value = "鍒犻櫎榛戝悕鍗�") + public AjaxResult delCustomerBlack(@RequestBody TjCustomerBlack customerBlack) { + return AjaxResult.success(blackService.save(customerBlack)); + } + + + @GetMapping("/getCustomerBlack") + @ApiOperation(value = "鏌ヨ榛戝悕鍗曞垪琛�") + public AjaxResult getCustomerBlack(@RequestParam(required = false) @ApiParam(value = "瀹㈡埛濮撳悕") String name, + @RequestParam(required = false) @ApiParam(value = "瀹㈡埛鎵嬫満鍙�") String phone, + @RequestParam(defaultValue = "1") @ApiParam(value = "椤电爜鏁�") Integer page, + @RequestParam(defaultValue = "10") @ApiParam(value = "姣忛〉鏄剧ず鏉℃暟") Integer pageSize) { + + LambdaQueryWrapper<TjCustomerBlack>wq=new LambdaQueryWrapper<>(); + wq.eq(TjCustomerBlack::getIsExpiration,"N"); + if(null !=name)wq.like(TjCustomerBlack::getCusName,name); + if(null !=phone)wq.like(TjCustomerBlack::getCusPhone,phone); + IPage<TjCustomerBlack> pages=new Page<>(page,pageSize); + IPage<TjCustomerBlack> iPage = blackService.page(pages, wq); + List<TjCustomerBlack> list = iPage.getRecords(); + if(null !=list && list.size()>0){ + for (TjCustomerBlack black : list) { + TjCustomer customer = customerService.getById(black.getCusId()); + black.setCusName(customer.getCusName()); + black.setCusSex(customer.getCusSex()); + black.setTjCompName(customerService.getCompNameByCusId(String.valueOf(black.getCusId()))); + } + } + return AjaxResult.success(iPage); + } } diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java index 162502c..1be7465 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java @@ -7,6 +7,7 @@ import com.ltkj.common.enums.DataSourceType; import com.ltkj.framework.config.MatchUtils; import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; +import com.ltkj.hosp.domain.TjCustomerBlack; import com.ltkj.hosp.domain.TjReservation; import com.ltkj.hosp.mapper.TestMapper; import com.ltkj.hosp.service.*; @@ -61,6 +62,8 @@ private LtkjMiddleDetailService middleDetailService; @Resource private ITjOrderService tjOrderService; + @Resource + private TjCustomerBlackService blackService; @GetMapping("/newGetTjPat") @ApiOperation(value = "鏌ヨhis鏁版嵁搴撹繑鍥炴柊鐨勬暟鎹�") @@ -280,9 +283,15 @@ List<TjCustomer> list = tjCustomerService.selectTjCustomerList(tjCustomer); if(null !=list && list.size()>0){ for (TjCustomer customer : list) { - customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); +// customer.setCusName(MatchUtils.hideCusName(customer.getCusName())); customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone())); customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard())); + TjCustomerBlack tjCustomerBlack = blackService.isTjCustomerBlack(String.valueOf(customer.getCusId())); + if(null !=tjCustomerBlack){ + customer.setIsBlack("Y"); + }else { + customer.setIsBlack("N"); + } } } return getDataTable(list); diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomer.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomer.java index 2bc8138..7a5c387 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomer.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomer.java @@ -317,6 +317,9 @@ @TableField(exist = false) private List<TjAskWorkLog> workLogs; + @TableField(exist = false) + private String isBlack; + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomerBlack.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomerBlack.java index 8e36f2c..0720a1d 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomerBlack.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjCustomerBlack.java @@ -1,11 +1,14 @@ package com.ltkj.hosp.domain; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.ltkj.common.annotation.Excel; import com.ltkj.common.core.domain.BaseEntity; +import com.ltkj.common.excelConfig.ExcelImport; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -22,13 +25,34 @@ @TableId(type = IdType.AUTO) @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty(value = "涓婚敭") private Long id; @JsonSerialize(using = ToStringSerializer.class) - private Long cus_id; + @ApiModelProperty(value = "瀹㈡埛id") + private Long cusId; + @ApiModelProperty(value = "鍘熷洜") private String yuanyin; + @ApiModelProperty(value = "澶╂暟") private String days; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date expiration_time; + @ApiModelProperty(value = "杩囨湡鏃堕棿") + private Date expirationTime; @ApiModelProperty(value = "澶囨敞") - private String remark; + private String remarks; + @ApiModelProperty(value = "鏄惁杩囨湡") + private String isExpiration; + + private String cusName; + + @ApiModelProperty(value = "瀹㈡埛鎬у埆") + @TableField(exist = false) + private Long cusSex; + + @ApiModelProperty(value = "鑱旂郴鐢佃瘽") + private String cusPhone; + + @ApiModelProperty(value = "鎵�鍦ㄥ崟浣嶅悕绉�") + @TableField(exist = false) + private String tjCompName; + } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerBlackMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerBlackMapper.java index 4d4c08e..290e89b 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerBlackMapper.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerBlackMapper.java @@ -3,7 +3,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ltkj.hosp.domain.TjCustomerBlack; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; @Mapper public interface TjCustomerBlackMapper extends BaseMapper<TjCustomerBlack> { + + @Select("SELECT * FROM tj_customer_black a WHERE a.cus_id=#{cusId} AND a.is_expiration='N'") + TjCustomerBlack isTjCustomerBlack(String cusId); } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java index 39703f1..71975ce 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjCustomerMapper.java @@ -75,4 +75,10 @@ @Select("SELECT * FROM tj_customer WHERE cus_idcard = #{cusIdCard}") ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber); + + @Select("SELECT IFNULL(b.cn_name,'鏃�') FROM (\n" + + "\n" + + "SELECT a.firm_id cid FROM tj_order a WHERE a.user_id=#{cusId} ORDER BY a.order_id DESC LIMIT 1)" + + " aa LEFT JOIN dict_comp b ON aa.cid=b.drug_manufacturer_id") + String getCompNameByCusId(String cusId); } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java index 77fe5e6..976119b 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjCustomerService.java @@ -66,4 +66,6 @@ TjCustomer getTjCustomerByCusIdCard(String cusIdCard); ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber); + + String getCompNameByCusId(String cusId); } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjCustomerBlackService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjCustomerBlackService.java index 981aad1..e729ec9 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjCustomerBlackService.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/TjCustomerBlackService.java @@ -5,4 +5,5 @@ public interface TjCustomerBlackService extends IService<TjCustomerBlack> { + TjCustomerBlack isTjCustomerBlack(String cusId); } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerBlackServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerBlackServiceImpl.java index 287de8a..ec9a824 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerBlackServiceImpl.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerBlackServiceImpl.java @@ -6,6 +6,15 @@ import com.ltkj.hosp.service.TjCustomerBlackService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + @Service public class TjCustomerBlackServiceImpl extends ServiceImpl<TjCustomerBlackMapper, TjCustomerBlack> implements TjCustomerBlackService { + + @Resource + private TjCustomerBlackMapper mapper; + @Override + public TjCustomerBlack isTjCustomerBlack(String cusId) { + return mapper.isTjCustomerBlack(cusId); + } } diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java index 1b1be0b..5dba257 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjCustomerServiceImpl.java @@ -106,4 +106,9 @@ public ResultSet getJsonParseCustomerList(String deptId, Integer page, Integer pageSize, String cusName, String tjNumber) { return tjCustomerMapper.getJsonParseCustomerList(deptId,page,pageSize,cusName,tjNumber); } + + @Override + public String getCompNameByCusId(String cusId) { + return tjCustomerMapper.getCompNameByCusId(cusId); + } } -- Gitblit v1.8.0