|
@@ -1,9 +1,16 @@
|
|
|
package cn.hnthyy.thmz.service.impl.his.yp;
|
|
package cn.hnthyy.thmz.service.impl.his.yp;
|
|
|
|
|
|
|
|
|
|
+import cn.hnthyy.thmz.entity.his.mz.YpZdClass;
|
|
|
import cn.hnthyy.thmz.entity.his.yp.YpBase;
|
|
import cn.hnthyy.thmz.entity.his.yp.YpBase;
|
|
|
import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
|
|
import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
|
|
|
|
|
+import cn.hnthyy.thmz.entity.his.yp.YpZdDrugKind;
|
|
|
|
|
+import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
|
|
|
|
|
+import cn.hnthyy.thmz.mapper.his.mz.YpZdClassMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.yp.YpBaseMapper;
|
|
import cn.hnthyy.thmz.mapper.his.yp.YpBaseMapper;
|
|
|
import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
|
|
import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
|
|
|
|
|
+import cn.hnthyy.thmz.mapper.his.yp.YpZdDrugKindMapper;
|
|
|
|
|
+import cn.hnthyy.thmz.mapper.his.yp.YpZdUnitMapper;
|
|
|
|
|
+import cn.hnthyy.thmz.mapper.his.zd.ZdUnitCodeMapper;
|
|
|
import cn.hnthyy.thmz.service.his.yp.YpBaseService;
|
|
import cn.hnthyy.thmz.service.his.yp.YpBaseService;
|
|
|
import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService;
|
|
import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService;
|
|
|
import cn.hnthyy.thmz.vo.YpZdDictVo;
|
|
import cn.hnthyy.thmz.vo.YpZdDictVo;
|
|
@@ -13,7 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @description:
|
|
* @description:
|
|
@@ -31,10 +40,22 @@ public class YpBaseServiceImpl implements YpBaseService {
|
|
|
@SuppressWarnings("all")
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
@Autowired
|
|
|
YpZdManufactoryService ypZdManufactoryService;
|
|
YpZdManufactoryService ypZdManufactoryService;
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ YpZdClassMapper ypZdClassMapper;
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ YpZdUnitMapper ypZdUnitMapper;
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ZdUnitCodeMapper zdUnitCodeMapper;
|
|
|
|
|
+ @SuppressWarnings("all")
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ YpZdDrugKindMapper ypZdDrugKindMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Double queryStockAmount(String chargeCode, String serial, String groupNo) {
|
|
public Double queryStockAmount(String chargeCode, String serial, String groupNo) {
|
|
|
- return ypBaseMapper.selectStockAmount(chargeCode,serial,groupNo);
|
|
|
|
|
|
|
+ return ypBaseMapper.selectStockAmount(chargeCode, serial, groupNo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -45,12 +66,12 @@ public class YpBaseServiceImpl implements YpBaseService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<YpZdDictVo> queryYpZdBaseByLike(YpZdDictVo ypZdDictVo) {
|
|
public List<YpZdDictVo> queryYpZdBaseByLike(YpZdDictVo ypZdDictVo) {
|
|
|
YpBase ypBase = new YpBase();
|
|
YpBase ypBase = new YpBase();
|
|
|
- BeanUtils.copyProperties(ypZdDictVo,ypBase);
|
|
|
|
|
|
|
+ BeanUtils.copyProperties(ypZdDictVo, ypBase);
|
|
|
List<YpBase> ypBases = ypBaseMapper.selectYpBaseByLike(ypZdDictVo.getSearchText().toUpperCase(), ypBase);
|
|
List<YpBase> ypBases = ypBaseMapper.selectYpBaseByLike(ypZdDictVo.getSearchText().toUpperCase(), ypBase);
|
|
|
- List<YpZdDictVo> ypZdDictVos= new ArrayList<>();
|
|
|
|
|
|
|
+ List<YpZdDictVo> ypZdDictVos = new ArrayList<>();
|
|
|
ypBases.stream().forEach(yp -> {
|
|
ypBases.stream().forEach(yp -> {
|
|
|
YpZdDictVo vo = new YpZdDictVo();
|
|
YpZdDictVo vo = new YpZdDictVo();
|
|
|
- BeanUtils.copyProperties(yp,vo);
|
|
|
|
|
|
|
+ BeanUtils.copyProperties(yp, vo);
|
|
|
YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(yp.getChargeCode(), yp.getSerial());
|
|
YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(yp.getChargeCode(), yp.getSerial());
|
|
|
vo.setPzwh(ypZdDict.getPzwh());
|
|
vo.setPzwh(ypZdDict.getPzwh());
|
|
|
vo.setManuCode(ypZdDict.getManuCode());
|
|
vo.setManuCode(ypZdDict.getManuCode());
|
|
@@ -62,7 +83,7 @@ public class YpBaseServiceImpl implements YpBaseService {
|
|
|
vo.setName(ypZdDict.getName());
|
|
vo.setName(ypZdDict.getName());
|
|
|
vo.setJbFlag(ypZdDict.getJbFlag());
|
|
vo.setJbFlag(ypZdDict.getJbFlag());
|
|
|
vo.setDelFlag(ypZdDict.getDelFlag());
|
|
vo.setDelFlag(ypZdDict.getDelFlag());
|
|
|
- if(StringUtils.isNotBlank(ypZdDict.getManuCode())){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(ypZdDict.getManuCode())) {
|
|
|
String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());
|
|
String manufactoryName = ypZdManufactoryService.queryYpZdManufactoryByCode(ypZdDict.getManuCode());
|
|
|
vo.setManufactoryName(manufactoryName);//生产厂家
|
|
vo.setManufactoryName(manufactoryName);//生产厂家
|
|
|
}
|
|
}
|
|
@@ -80,4 +101,56 @@ public class YpBaseServiceImpl implements YpBaseService {
|
|
|
public int updateYpBase(YpBase ypBase) {
|
|
public int updateYpBase(YpBase ypBase) {
|
|
|
return ypBaseMapper.updateYpBase(ypBase);
|
|
return ypBaseMapper.updateYpBase(ypBase);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Map<String, Object>> queryDrugUseQuantitySort(Map map) {
|
|
|
|
|
+ List<Map<String, Object>> list;
|
|
|
|
|
+ String flag = map.get("flag").toString();
|
|
|
|
|
+ if (flag.equals("0")) {
|
|
|
|
|
+ list = ypBaseMapper.selectDrugUseQuantityCount(map);
|
|
|
|
|
+ } else if(flag.equals("1")){
|
|
|
|
|
+ list = ypBaseMapper.selectDrugUnusedCount(map);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ list = ypBaseMapper.selectDrugOutDetlSort(map);
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ Map<String, Object> mapMax = list.get(i);
|
|
|
|
|
+ String manuName="";
|
|
|
|
|
+ if(null != mapMax.get("manuCode")){
|
|
|
|
|
+ manuName = ypZdManufactoryService.queryYpZdManufactoryByCode(mapMax.get("manuCode").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ mapMax.put("manuName", manuName);
|
|
|
|
|
+ if (flag.equals("0")) {
|
|
|
|
|
+ for (int j = 0; j < list.size(); j++) {
|
|
|
|
|
+ Map<String, Object> mapMin = list.get(j);
|
|
|
|
|
+ if (mapMax.get("serial").toString().equals("99") && mapMax.get("code").equals(mapMin.get("code")) && mapMin.get("serial").toString().equals("01")) {
|
|
|
|
|
+ double packSize = Double.parseDouble(mapMax.get("packSize").toString());
|
|
|
|
|
+ double quantity = Double.parseDouble(mapMin.get("quantity").toString());
|
|
|
|
|
+ mapMax.put("quantity", Double.parseDouble(mapMax.get("quantity").toString()) + (packSize / quantity));
|
|
|
|
|
+ list.remove(j);
|
|
|
|
|
+ i--;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (flag.equals("2")) {
|
|
|
|
|
+ YpZdDict ypZdDict = ypZdDictMapper.selectYpZdDictByCodeAndSerial(mapMax.get("code").toString(), mapMax.get("serial").toString());
|
|
|
|
|
+ mapMax.put("name",ypZdDict.getName());
|
|
|
|
|
+ mapMax.put("specification",ypZdDict.getSpecification());
|
|
|
|
|
+ List<YpZdClass> ypZdClasses = ypZdClassMapper.selectYpZdClassesByCode(ypZdDict.getClassCode());
|
|
|
|
|
+ if(ypZdClasses.size() >0 ){
|
|
|
|
|
+ mapMax.put("class_name",ypZdClasses.get(0).getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ mapMax.put("unit_name",ypZdUnitMapper.selectNameByCode(ypZdDict.getPackUnit()));
|
|
|
|
|
+ ZdUnitCode dept = zdUnitCodeMapper.selectByCode(mapMax.get("dept_code").toString());
|
|
|
|
|
+ mapMax.put("dept_name",dept.getName());
|
|
|
|
|
+ YpZdDrugKind drugKind = ypZdDrugKindMapper.selectYpZdDrugKind(mapMax.get("drug_kind").toString());
|
|
|
|
|
+ mapMax.put("kind_name",drugKind.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (map.get("flag").toString().equals("0")) {
|
|
|
|
|
+ list.sort(Comparator.comparing(o -> -1 * Double.valueOf(o.get("quantity").toString())));
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|