Merge branch 'master' of ssh://git.jizhiweb.cn:2222/clinic-v2/server
This commit is contained in:
commit
8ed948e608
8
pom.xml
8
pom.xml
|
|
@ -85,8 +85,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 其他依赖 -->
|
<!-- 其他依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
@ -129,7 +127,11 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>5.2.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.social;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 医保目录
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-04-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("social_directory")
|
||||||
|
@ApiModel(value = "SocialDirectory对象", description = "医保目录")
|
||||||
|
public class SocialDirectoryMongodb{
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("医保目录编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("检索关键词")
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("生产企业")
|
||||||
|
private String producer;
|
||||||
|
}
|
||||||
|
|
@ -18,17 +18,20 @@ import com.syjiaer.clinic.server.mapper.inventory.*;
|
||||||
import com.syjiaer.clinic.server.mapper.manager.ManagerUserMapper;
|
import com.syjiaer.clinic.server.mapper.manager.ManagerUserMapper;
|
||||||
import com.syjiaer.clinic.server.service.BaseService;
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class InventoryPurchaseService extends BaseService {
|
public class InventoryPurchaseService extends BaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -52,6 +55,7 @@ public class InventoryPurchaseService extends BaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 创建采购订单
|
* 创建采购订单
|
||||||
* @param inventoryPurchase 采购订单
|
* @param inventoryPurchase 采购订单
|
||||||
|
|
@ -417,4 +421,43 @@ public class InventoryPurchaseService extends BaseService {
|
||||||
inventoryPurchaseMapper.update(null, updateOrder);
|
inventoryPurchaseMapper.update(null, updateOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String toExcel(List<Integer> cateIdList){
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
// 资源文件的路径
|
||||||
|
InputStream inputStream = classLoader.getResourceAsStream("excelTemplate/PurchasingTemplate.xlsx");
|
||||||
|
Workbook workbook = WorkbookFactory.create(inputStream);
|
||||||
|
|
||||||
|
// 2. 获取第一个Sheet
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// 3. 修改内容(例如在A1单元格写入新内容)
|
||||||
|
Row row = sheet.getRow(10);
|
||||||
|
if (row == null) {
|
||||||
|
row = sheet.createRow(10);
|
||||||
|
}
|
||||||
|
Cell cell = row.getCell(0);
|
||||||
|
if (cell == null) {
|
||||||
|
cell = row.createCell(0);
|
||||||
|
}
|
||||||
|
cell.setCellValue("你好");
|
||||||
|
|
||||||
|
// 4. 保存为新文件
|
||||||
|
FileOutputStream outFile = new FileOutputStream("D:\\new_excel.xlsx");
|
||||||
|
workbook.write(outFile);
|
||||||
|
|
||||||
|
// 5. 关闭流
|
||||||
|
outFile.close();
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
System.out.println("Excel文件生成成功!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,15 @@ import com.syjiaer.clinic.server.entity.social.vo.SocialDirectoryView;
|
||||||
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.social.*;
|
import com.syjiaer.clinic.server.mapper.social.*;
|
||||||
import com.syjiaer.clinic.server.service.BaseService;
|
import com.syjiaer.clinic.server.service.BaseService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.index.Index;
|
||||||
|
import org.springframework.data.mongodb.core.index.IndexInfo;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
|
import org.springframework.data.mongodb.core.query.Update;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -47,6 +55,9 @@ public class SocialDirectoryService extends BaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SocialDirectoryVersionService socialDirectoryVersionService;
|
private SocialDirectoryVersionService socialDirectoryVersionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsMapper goodsMapper;
|
private GoodsMapper goodsMapper;
|
||||||
|
|
||||||
|
|
@ -157,11 +168,53 @@ public class SocialDirectoryService extends BaseService {
|
||||||
if(list.isEmpty()){
|
if(list.isEmpty()){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
socialDirectoryMapper.insert(list, 100);
|
|
||||||
|
|
||||||
|
socialDirectoryMapper.insert(list, 100);
|
||||||
|
initMongoDb();
|
||||||
|
saveListToMongoDb(list);
|
||||||
return next_version_name;
|
return next_version_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveToMongoDb(SocialDirectory socialDirectory){
|
||||||
|
SocialDirectoryMongodb socialDirectoryMongodb = new SocialDirectoryMongodb();
|
||||||
|
BeanUtils.copyProperties(socialDirectory, socialDirectoryMongodb);
|
||||||
|
Query query = new Query(Criteria.where("code").is(socialDirectoryMongodb.getCode()));
|
||||||
|
if (mongoTemplate.exists(query, SocialDirectoryMongodb.class,"social_directory")) {
|
||||||
|
|
||||||
|
Update update = new Update();
|
||||||
|
update.set("name", socialDirectoryMongodb.getName());
|
||||||
|
update.set("keyword", socialDirectoryMongodb.getKeyword());
|
||||||
|
update.set("type", socialDirectoryMongodb.getType());
|
||||||
|
update.set("producer", socialDirectoryMongodb.getProducer());
|
||||||
|
mongoTemplate.updateFirst(query, update, SocialDirectoryMongodb.class,"social_directory");
|
||||||
|
}else{
|
||||||
|
mongoTemplate.insert(socialDirectoryMongodb, "social_directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void saveListToMongoDb(List<SocialDirectory> list){
|
||||||
|
for(SocialDirectory socialDirectory:list){
|
||||||
|
saveToMongoDb(socialDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initMongoDb(){
|
||||||
|
if (!mongoTemplate.collectionExists("social_directory")) {
|
||||||
|
System.out.println("创建了social_directory集合");
|
||||||
|
mongoTemplate.createCollection("social_directory");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IndexInfo> indexInfos = mongoTemplate.indexOps("social_directory").getIndexInfo();
|
||||||
|
//判断索引是否存在
|
||||||
|
if (indexInfos.stream().noneMatch(index -> index.getName().equals("code_uni"))) {
|
||||||
|
System.out.println("创建了code索引");
|
||||||
|
Index index = new Index().on("code", Sort.Direction.ASC).named("code_uni").unique();
|
||||||
|
mongoTemplate.indexOps("social_directory").ensureIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 搜索接口
|
* 搜索接口
|
||||||
* @param keyword 关键字
|
* @param keyword 关键字
|
||||||
|
|
@ -175,6 +228,13 @@ public class SocialDirectoryService extends BaseService {
|
||||||
* @param keyword 关键字
|
* @param keyword 关键字
|
||||||
*/
|
*/
|
||||||
public Page<SocialDirectoryView> search(String keyword, List<Integer> typeList, int pageNum, int pageSize) {
|
public Page<SocialDirectoryView> search(String keyword, List<Integer> typeList, int pageNum, int pageSize) {
|
||||||
|
|
||||||
|
//mongodb分页
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QueryWrapper<SocialDirectory> codeqw = new QueryWrapper<>();
|
QueryWrapper<SocialDirectory> codeqw = new QueryWrapper<>();
|
||||||
if (typeList.size() == 1) {
|
if (typeList.size() == 1) {
|
||||||
codeqw.eq("type", typeList.get(0));
|
codeqw.eq("type", typeList.get(0));
|
||||||
|
|
@ -310,10 +370,50 @@ public class SocialDirectoryService extends BaseService {
|
||||||
*/
|
*/
|
||||||
public List<SocialDirectoryView> fullList(List<String> codeList) {
|
public List<SocialDirectoryView> fullList(List<String> codeList) {
|
||||||
List<SocialDirectoryView> socialDirectoryViewList = new ArrayList<>();
|
List<SocialDirectoryView> socialDirectoryViewList = new ArrayList<>();
|
||||||
for (String code : codeList) {
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
SocialDirectoryView socialDirectoryView = fullInfo(code);
|
queryWrapper.in("code",codeList);
|
||||||
|
List<SocialDirectory> socialDirectoryList = socialDirectoryMapper.selectList(queryWrapper);
|
||||||
|
List<SocialDirectoryUpinfo> socialDirectoryUpinfoList = socialDirectoryUpinfoMapper.selectList(queryWrapper);
|
||||||
|
List<SocialDirectoryLimit> socialDirectoryLimitList = socialDirectoryLimitMapper.selectList(queryWrapper);
|
||||||
|
List<SocialDirectorySelf> socialDirectorySelfList = socialDirectorySelfMapper.selectList(queryWrapper);
|
||||||
|
Map<String, SocialDirectoryUpinfo> upinfoMap = socialDirectoryUpinfoList.stream()
|
||||||
|
.collect(Collectors.toMap(SocialDirectoryUpinfo::getCode, upinfo -> upinfo));
|
||||||
|
Map<String, SocialDirectoryLimit> limitMap = socialDirectoryLimitList.stream()
|
||||||
|
.collect(Collectors.toMap(SocialDirectoryLimit::getCode, limit -> limit));
|
||||||
|
Map<String, SocialDirectorySelf> selfMap = socialDirectorySelfList.stream()
|
||||||
|
.collect(Collectors.toMap(SocialDirectorySelf::getCode, self -> self));
|
||||||
|
|
||||||
|
for(SocialDirectory socialDirectory : socialDirectoryList){
|
||||||
|
SocialDirectoryView socialDirectoryView = new SocialDirectoryView();
|
||||||
|
socialDirectoryView.setJson(JSONObject.parseObject(socialDirectory.getData()));
|
||||||
|
socialDirectoryView.setData(null);
|
||||||
|
BeanUtils.copyProperties(socialDirectory, socialDirectoryView);
|
||||||
|
// 合并 SocialDirectoryUpinfo 数据
|
||||||
|
SocialDirectoryUpinfo upinfo = upinfoMap.get(socialDirectory.getCode());
|
||||||
|
if (upinfo != null) {
|
||||||
|
socialDirectoryView.setBegndate(upinfo.getBegndate());
|
||||||
|
socialDirectoryView.setEnddate(upinfo.getEnddate());
|
||||||
|
socialDirectoryView.setWubi(upinfo.getWubi());
|
||||||
|
socialDirectoryView.setPinyin(upinfo.getPinyin());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并 SocialDirectoryLimit 数据
|
||||||
|
SocialDirectoryLimit limit = limitMap.get(socialDirectory.getCode());
|
||||||
|
if (limit != null) {
|
||||||
|
socialDirectoryView.setHilistLmtpricType(limit.getHilistLmtpricType());
|
||||||
|
socialDirectoryView.setHilistPricUplmtAmt(limit.getHilistPricUplmtAmt());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并 SocialDirectorySelf 数据
|
||||||
|
SocialDirectorySelf self = selfMap.get(socialDirectory.getCode());
|
||||||
|
if (self != null) {
|
||||||
|
socialDirectoryView.setSelfpayPropType(self.getSelfpayPropType());
|
||||||
|
socialDirectoryView.setSelfpayProp(self.getSelfpayProp());
|
||||||
|
}
|
||||||
socialDirectoryViewList.add(socialDirectoryView);
|
socialDirectoryViewList.add(socialDirectoryView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return socialDirectoryViewList;
|
return socialDirectoryViewList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,22 +483,27 @@ public class SocialDirectoryService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<SocialDirectoryView> getDocList(int type, int page, int size, String keyword) {
|
public Page<SocialDirectoryView> getDocList(int type, int page, int size, String keyword) {
|
||||||
QueryWrapper<SocialDirectory> codeqw = new QueryWrapper<>();
|
|
||||||
codeqw.eq("type", type);
|
|
||||||
|
|
||||||
//模糊搜索
|
Query query = new Query();
|
||||||
|
query.addCriteria(Criteria.where("type").is(type));
|
||||||
|
|
||||||
if (!keyword.trim().isEmpty()) {
|
if (!keyword.trim().isEmpty()) {
|
||||||
codeqw.like("name", keyword);
|
query.addCriteria(new Criteria().orOperator(
|
||||||
codeqw.or().like("code", keyword);
|
Criteria.where("code").regex(keyword, "i"),
|
||||||
codeqw.or().like("keyword", keyword);
|
Criteria.where("name").regex(keyword, "i"),
|
||||||
|
Criteria.where("keyword").regex(keyword, "i"),
|
||||||
|
Criteria.where("producer").regex(keyword, "i")
|
||||||
|
));
|
||||||
|
}
|
||||||
|
long count = mongoTemplate.count(query, SocialDirectoryMongodb.class,"social_directory");
|
||||||
|
query.skip((long) (page - 1) * size).limit(size);
|
||||||
|
List<SocialDirectoryMongodb> mongodbList = mongoTemplate.find(query, SocialDirectoryMongodb.class,"social_directory");
|
||||||
|
List<String> codeList=new ArrayList<>();
|
||||||
|
for(SocialDirectoryMongodb mongodb:mongodbList){
|
||||||
|
codeList.add(mongodb.getCode());
|
||||||
}
|
}
|
||||||
// 执行查询
|
|
||||||
|
|
||||||
codeqw.select("code");
|
|
||||||
long count = socialDirectoryMapper.selectCount(codeqw);
|
|
||||||
|
|
||||||
codeqw.last("LIMIT " + size + " OFFSET " + (page - 1) * size);
|
|
||||||
List<String> codeList = listObjs(codeqw, socialDirectoryMapper, obj -> obj.toString());
|
|
||||||
Page<SocialDirectoryView> result = new Page<>();
|
Page<SocialDirectoryView> result = new Page<>();
|
||||||
if (!codeList.isEmpty()) {
|
if (!codeList.isEmpty()) {
|
||||||
List<SocialDirectoryView> list = fullList(codeList);
|
List<SocialDirectoryView> list = fullList(codeList);
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue