|
@@ -108,9 +108,8 @@ public class YpPlanService {
|
|
|
// 计算购入总金额
|
|
|
BigDecimal totalFee = BigDecimal.ZERO;
|
|
|
for(YpPlanDetail d : list){
|
|
|
- totalFee = DecimalUtil.add(totalFee, d.getBuyAmount());
|
|
|
+ totalFee = DecimalUtil.add(totalFee, d.getBuyMoney());
|
|
|
}
|
|
|
- System.out.println("总金额:" + totalFee);
|
|
|
info.setTotalFee(totalFee);
|
|
|
UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
|
|
|
info.setApplyId(user.getCode());
|
|
@@ -118,7 +117,7 @@ public class YpPlanService {
|
|
|
int c = callSavePlanDetail(info, list);
|
|
|
} catch (IOException e) {
|
|
|
log.info("导入药品计划出错:" + e.getMessage());
|
|
|
- throw new RuntimeException(e);
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "导入药品计划出错:" + e.getMessage());
|
|
|
}
|
|
|
return ResultVoUtil.success(map);
|
|
|
}
|
|
@@ -135,15 +134,7 @@ public class YpPlanService {
|
|
|
if (null != listLs && !listLs.isEmpty()) {
|
|
|
detailDao.deleteYpPlanDetailById(info.getFileId());
|
|
|
}
|
|
|
- int sum = 0;
|
|
|
- int cs = (int) Math.ceil((double) list.size() / BATCH_SIZE);
|
|
|
- for(int i = 0; i < cs; i++ ){
|
|
|
- int start = i * BATCH_SIZE;
|
|
|
- int end = Math.min(start + BATCH_SIZE, list.size());
|
|
|
- List<YpPlanDetail> l = list.subList(start, end);
|
|
|
- sum = sum + detailDao.insertList(l);
|
|
|
- }
|
|
|
- return sum;
|
|
|
+ return countNum(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -183,46 +174,54 @@ public class YpPlanService {
|
|
|
}
|
|
|
YpPlanDetail imp = new YpPlanDetail();
|
|
|
String[] stirs = str.toString().split("_");
|
|
|
- imp.setRemark(stirs[0]);
|
|
|
- imp.setDrugName(stirs[1]);
|
|
|
- imp.setSpecification(stirs[2]);
|
|
|
- if(StringUtil.notBlank(stirs[3])){
|
|
|
- imp.setPackRetprice(new BigDecimal(stirs[3]));
|
|
|
+ if("硫酸氢氯吡格雷片(波立维)".equals(stirs[2])){
|
|
|
+ log.info("硫酸氢氯吡格雷片(波立维)购入价: " + new BigDecimal(stirs[5]));
|
|
|
}
|
|
|
+ imp.setRemark(stirs[0]);
|
|
|
+ imp.setSupplyName(stirs[1]);
|
|
|
+ imp.setDrugName(stirs[2]);
|
|
|
+ imp.setSpecification(stirs[3]);
|
|
|
if(StringUtil.notBlank(stirs[4])){
|
|
|
- imp.setBuyPrice(new BigDecimal(stirs[4]));
|
|
|
+ imp.setPackRetprice(new BigDecimal(stirs[4]));
|
|
|
+ imp.setPackRetprice1(stirs[4]);
|
|
|
}
|
|
|
if(StringUtil.notBlank(stirs[5])){
|
|
|
- imp.setAmount(new BigDecimal(stirs[5]));
|
|
|
+ imp.setBuyPrice(new BigDecimal(stirs[5]));
|
|
|
+ imp.setBuyPrice1(stirs[5]);
|
|
|
}
|
|
|
- imp.setManuName(stirs[6]);
|
|
|
- if(StringUtil.notBlank(stirs[7])){
|
|
|
- imp.setAmount3(new BigDecimal(stirs[7]));
|
|
|
+ if(StringUtil.notBlank(stirs[6])){
|
|
|
+ imp.setAmount(new BigDecimal(stirs[6]));
|
|
|
}
|
|
|
+ imp.setManuName(stirs[7]);
|
|
|
if(StringUtil.notBlank(stirs[8])){
|
|
|
- imp.setAmount7(new BigDecimal(stirs[8]));
|
|
|
+ imp.setAmount3(new BigDecimal(stirs[8]));
|
|
|
}
|
|
|
if(StringUtil.notBlank(stirs[9])){
|
|
|
- imp.setAmount14(new BigDecimal(stirs[9]));
|
|
|
+ imp.setAmount7(new BigDecimal(stirs[9]));
|
|
|
}
|
|
|
if(StringUtil.notBlank(stirs[10])){
|
|
|
- imp.setAmount30(new BigDecimal(stirs[10]));
|
|
|
+ imp.setAmount14(new BigDecimal(stirs[10]));
|
|
|
}
|
|
|
if(StringUtil.notBlank(stirs[11])){
|
|
|
- imp.setAmount60(new BigDecimal(stirs[11]));
|
|
|
+ imp.setAmount30(new BigDecimal(stirs[11]));
|
|
|
}
|
|
|
- imp.setDays(stirs[12]);
|
|
|
- if(StringUtil.notBlank(stirs[13])){
|
|
|
- imp.setBuyAmount(new BigDecimal(stirs[13]));
|
|
|
+ if(StringUtil.notBlank(stirs[12])){
|
|
|
+ imp.setAmount60(new BigDecimal(stirs[12]));
|
|
|
}
|
|
|
- imp.setUnit(stirs[14]);
|
|
|
+ imp.setDays(stirs[13]);
|
|
|
+ if(StringUtil.notBlank(stirs[14])){
|
|
|
+ imp.setBuyAmount(new BigDecimal(stirs[14]));
|
|
|
+ }
|
|
|
+ imp.setUnit(stirs[15]);
|
|
|
if(null == imp.getBuyPrice() || null == imp.getBuyAmount()){
|
|
|
imp.setBuyFee(BigDecimal.ZERO);
|
|
|
+ imp.setBuyMoney(BigDecimal.ZERO);
|
|
|
} else {
|
|
|
imp.setBuyFee(DecimalUtil.multiply(imp.getBuyPrice(), imp.getBuyAmount()));
|
|
|
+ imp.setBuyMoney(DecimalUtil.multiply(imp.getBuyPrice(), imp.getBuyAmount()));
|
|
|
}
|
|
|
- if(stirs.length == 17 && StringUtil.notBlank(stirs[16])){
|
|
|
- imp.setContent(stirs[16]);
|
|
|
+ if(stirs.length == 18 && StringUtil.notBlank(stirs[17])){
|
|
|
+ imp.setContent(stirs[17]);
|
|
|
}
|
|
|
imp.setFileId(fileId);
|
|
|
// 常量
|
|
@@ -320,6 +319,31 @@ public class YpPlanService {
|
|
|
}
|
|
|
int d = infoDao.updateYpPlanAuditById(info);
|
|
|
if(d > 0){
|
|
|
+ map.put("cg", "药品计划意见审核成功!");
|
|
|
+ return ResultVoUtil.success(map);
|
|
|
+ } else {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "药品计划意见审核失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description 药品计划审核时确认计划数量以及金额
|
|
|
+ * @Author hsh
|
|
|
+ * @param list 药品计划数量以及金额
|
|
|
+ * @return map
|
|
|
+ * @Date 2025/3/27 10:45
|
|
|
+ */
|
|
|
+ public ResultVo<Map<String, Object>> saveYpPlanDetail(List<YpPlanDetail> list){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if(null == list || list.isEmpty()){
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "药品计划明细不存在,药品计划审核失败!");
|
|
|
+ }
|
|
|
+ List<YpPlanDetail> listLs = detailDao.selectYpPlanDetailById(list.get(0).getFileId());
|
|
|
+ if (null != listLs && !listLs.isEmpty()) {
|
|
|
+ detailDao.deleteYpPlanDetailById(list.get(0).getFileId());
|
|
|
+ }
|
|
|
+ int c = countNum(list);
|
|
|
+ if(c > 0){
|
|
|
map.put("cg", "药品计划审核成功!");
|
|
|
return ResultVoUtil.success(map);
|
|
|
} else {
|
|
@@ -327,4 +351,15 @@ public class YpPlanService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private int countNum(List<YpPlanDetail> list) {
|
|
|
+ int c = 0;
|
|
|
+ int cs = (int) Math.ceil((double) list.size() / BATCH_SIZE);
|
|
|
+ for(int i = 0; i < cs; i++ ){
|
|
|
+ int start = i * BATCH_SIZE;
|
|
|
+ int end = Math.min(start + BATCH_SIZE, list.size());
|
|
|
+ List<YpPlanDetail> l = list.subList(start, end);
|
|
|
+ c = c + detailDao.insertList(l);
|
|
|
+ }
|
|
|
+ return c;
|
|
|
+ }
|
|
|
}
|