This commit is contained in:
parent
ffdc8ebec7
commit
6a011af6ae
|
|
@ -89,5 +89,11 @@ public class ItemController extends BaseController {
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/getGroup")
|
||||||
|
public Result<?> getGroup() {
|
||||||
|
Integer itemId = parmsUtil.getInteger("id","item_id为空");
|
||||||
|
return success(itemService.getGroup(itemId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,4 +59,7 @@ public class ItemGroupList implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("item表主键")
|
@ApiModelProperty("item表主键")
|
||||||
private Integer itemId;
|
private Integer itemId;
|
||||||
|
|
||||||
|
@ApiModelProperty("数量")
|
||||||
|
private Integer number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -200,15 +201,32 @@ public class ItemService extends BaseService {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void saveGroup(List<ItemGroupList> list, ItemParam itemParam) {
|
public void saveGroup(List<ItemGroupList> list, ItemParam itemParam) {
|
||||||
|
if (itemParam.getName() != null&&itemParam.getName().isEmpty())
|
||||||
|
{
|
||||||
|
throw new MessageException("组套名称不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemParam.getUnit() != null&&itemParam.getUnit().isEmpty())
|
||||||
|
{
|
||||||
|
throw new MessageException("组套单位不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
ManagerUser managerUser = getManagerUser();
|
ManagerUser managerUser = getManagerUser();
|
||||||
|
|
||||||
QueryWrapper<Item> itemQueryWrapper = new QueryWrapper<>();
|
|
||||||
itemQueryWrapper.ne("del_flag", 1);
|
|
||||||
|
|
||||||
QueryWrapper<ItemGroupList> itemGroupListqueryWrapper = new QueryWrapper<>();
|
QueryWrapper<ItemGroupList> itemGroupListqueryWrapper = new QueryWrapper<>();
|
||||||
itemGroupListqueryWrapper.ne("del_flag",1);
|
itemGroupListqueryWrapper.ne("del_flag",1);
|
||||||
|
|
||||||
Item itemInfo = itemMapper.selectOne(itemQueryWrapper);
|
Integer item_id=itemParam.getId();
|
||||||
|
|
||||||
|
Item itemInfo =null;
|
||||||
|
if(item_id!=null&&item_id>0){
|
||||||
|
QueryWrapper<Item> itemQueryWrapper = new QueryWrapper<>();
|
||||||
|
itemQueryWrapper.ne("del_flag", 1);
|
||||||
|
itemQueryWrapper.eq("id", item_id);
|
||||||
|
itemInfo= itemMapper.selectOne(itemQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
if(itemInfo==null){
|
if(itemInfo==null){
|
||||||
itemInfo=new Item();
|
itemInfo=new Item();
|
||||||
|
|
@ -296,15 +314,51 @@ public class ItemService extends BaseService {
|
||||||
itemMapper.updateById(itemInfo);
|
itemMapper.updateById(itemInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getItemGroupList() {
|
public HashMap<String,Object> getGroup(int itemId) {
|
||||||
QueryWrapper<Item> itemQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<Item> itemQueryWrapper = new QueryWrapper<>();
|
||||||
itemQueryWrapper.ne("del_flag", 1);
|
itemQueryWrapper.ne("del_flag", 1);
|
||||||
itemQueryWrapper.eq("is_group",true);
|
itemQueryWrapper.eq("is_group",true);
|
||||||
|
itemQueryWrapper.eq("id",itemId);
|
||||||
|
|
||||||
|
Item itemInfo = itemMapper.selectOne(itemQueryWrapper);
|
||||||
|
|
||||||
|
if (itemInfo==null ) {
|
||||||
|
throw new MessageException("诊疗项目数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
QueryWrapper<ItemGroupList> itemGroupListqueryWrapper = new QueryWrapper<>();
|
QueryWrapper<ItemGroupList> itemGroupListqueryWrapper = new QueryWrapper<>();
|
||||||
itemGroupListqueryWrapper.ne("del_flag",1);
|
itemGroupListqueryWrapper.ne("del_flag",1);
|
||||||
|
itemGroupListqueryWrapper.eq("item_id",itemId);
|
||||||
|
|
||||||
|
List<ItemGroupList> itemGroupList = itemGroupListMapper.selectList(itemGroupListqueryWrapper);
|
||||||
|
|
||||||
|
//设置返回结果
|
||||||
|
HashMap<String,Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
|
//设置结果json中info字段
|
||||||
|
HashMap<String,Object> infoMap = new HashMap<>();
|
||||||
|
infoMap.put("name",itemInfo.getItemName());
|
||||||
|
infoMap.put("unit",itemInfo.getUnit());
|
||||||
|
infoMap.put("id",itemInfo.getId());
|
||||||
|
resultMap.put("info",infoMap);
|
||||||
|
|
||||||
|
//设置结果json中list字段
|
||||||
|
List<HashMap<String,Object>> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ItemGroupList itemGroup : itemGroupList) {
|
||||||
|
HashMap<String,Object> itemGroupMap = new HashMap<>();
|
||||||
|
itemGroupMap.put("name",itemGroup.getName());
|
||||||
|
itemGroupMap.put("unit",itemGroup.getUnit());
|
||||||
|
itemGroupMap.put("socialCode",itemGroup.getSocialCode());
|
||||||
|
itemGroupMap.put("unitPrice",itemGroup.getUnitPrice());
|
||||||
|
itemGroupMap.put("purchaseUnitPrice",itemGroup.getPurchaseUnitPrice());
|
||||||
|
itemGroupMap.put("number",itemGroup.getNumber());
|
||||||
|
itemGroupMap.put("id",itemGroup.getId());
|
||||||
|
list.add(itemGroupMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
resultMap.put("list",list);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue