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); } } 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); } } 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); 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) 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; } 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); } 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); } 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); } 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); } 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); } } 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); } }