|
@@ -2,12 +2,15 @@ package cn.hnthyy.thmz.controller.yf;
|
|
|
|
|
|
import cn.hnthyy.thmz.Utils.TokenUtil;
|
|
|
import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
+import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
+import cn.hnthyy.thmz.entity.his.yp.YpOutDetl;
|
|
|
import cn.hnthyy.thmz.entity.his.yp.YpOutDetlYf;
|
|
|
import cn.hnthyy.thmz.entity.his.mz.Employee;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.service.his.mz.EmployeeService;
|
|
|
import cn.hnthyy.thmz.service.his.yf.YfInventoryService;
|
|
|
+import cn.hnthyy.thmz.vo.YpBaseVo;
|
|
|
import cn.hnthyy.thmz.vo.YpBaseYfVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -49,13 +52,23 @@ public class YfInventoryController {
|
|
|
try {
|
|
|
if(StringUtils.isBlank(groupNo)){
|
|
|
resultMap.put("code", -1);
|
|
|
- resultMap.put("message", "生成失败,药房编码为空");
|
|
|
+ resultMap.put("message", "生成失败,药库或者药房编码为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryData(groupNo, infusionFlag, visibleFlag, drugText);
|
|
|
- resultMap.put("code", 0);
|
|
|
- resultMap.put("message", "生成药品盘点成功");
|
|
|
- resultMap.put("data", list);
|
|
|
+ // 暂时
|
|
|
+ if(!Constants.XYK_GROUP_NO.equals(groupNo)){
|
|
|
+ List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryData(groupNo, infusionFlag, visibleFlag, drugText);
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("message", "生成药品盘点成功");
|
|
|
+ resultMap.put("data", list);
|
|
|
+ } else {
|
|
|
+ // 西药库盘点
|
|
|
+ List<YpBaseVo> list = yfInventoryService.queryYpInventoryKfData(groupNo, infusionFlag, visibleFlag, drugText);
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("message", "生成药品盘点成功");
|
|
|
+ resultMap.put("data", list);
|
|
|
+ }
|
|
|
+
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.toString());
|
|
@@ -93,6 +106,34 @@ public class YfInventoryController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存药库盘点药品数据
|
|
|
+ * @param ypOutDetlYfs
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UserLoginToken
|
|
|
+ @RequestMapping(value = "/saveYpInventoryYkData",method = {RequestMethod.POST})
|
|
|
+ public Map<String,Object> saveYpInventoryYkData(@RequestBody List<YpOutDetlYf> ypOutDetlYfs, HttpServletRequest httpServletRequest)throws MzException {
|
|
|
+ User tokenUser = TokenUtil.getUser(httpServletRequest);
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ try {
|
|
|
+ if(ypOutDetlYfs==null || ypOutDetlYfs.size()==0){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "提交失败,药品为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ yfInventoryService.saveYpInventoryYkData(ypOutDetlYfs,tokenUser.getUserIdCode());
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("message", "提交盘点药品数据成功");
|
|
|
+ return resultMap;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.toString());
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "提交盘点药品数据失败");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取盘点记录
|
|
|
* @param beginDate
|
|
@@ -109,16 +150,23 @@ public class YfInventoryController {
|
|
|
try {
|
|
|
if(StringUtils.isBlank(groupNo)){
|
|
|
resultMap.put("code", -1);
|
|
|
- resultMap.put("message", "查询盘点记录失败,药房编码为空");
|
|
|
+ resultMap.put("message", "查询盘点记录失败,药库或者药房编码为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
if(StringUtils.isBlank(confirmFlag)){
|
|
|
confirmFlag = "";
|
|
|
}
|
|
|
- List<YpOutDetlYf> ypOutDetlYfs = yfInventoryService.queryYpInventoryRecord(beginDate, endDate, groupNo, confirmFlag);
|
|
|
- resultMap.put("code", 0);
|
|
|
- resultMap.put("data", ypOutDetlYfs);
|
|
|
- resultMap.put("message", "查询盘点记录成功");
|
|
|
+ if(!Constants.XYK_GROUP_NO.equals(groupNo)){
|
|
|
+ List<YpOutDetlYf> ypOutDetlYfs = yfInventoryService.queryYpInventoryRecord(beginDate, endDate, groupNo, confirmFlag);
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("data", ypOutDetlYfs);
|
|
|
+ resultMap.put("message", "查询盘点记录成功");
|
|
|
+ } else {
|
|
|
+ List<YpOutDetl> ypOutDetls = yfInventoryService.queryYpInventoryKfRecord(beginDate, endDate, groupNo, confirmFlag);
|
|
|
+ resultMap.put("code", 0);
|
|
|
+ resultMap.put("data", ypOutDetls);
|
|
|
+ resultMap.put("message", "查询盘点记录成功");
|
|
|
+ }
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.toString());
|
|
@@ -135,25 +183,44 @@ public class YfInventoryController {
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
@RequestMapping(value = "/getYpInventoryPrintData",method = {RequestMethod.GET})
|
|
|
- public Map<String,Object> getYpInventoryPrintData(@RequestParam("drawNo") String drawNo){
|
|
|
+ public Map<String,Object> getYpInventoryPrintData(@RequestParam("groupNo") String groupNo, @RequestParam("drawNo") String drawNo){
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
+ if(StringUtils.isBlank(groupNo)){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "获取盘点数据失败,药库或者药房为空");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
if(StringUtils.isBlank(drawNo)){
|
|
|
resultMap.put("code", -1);
|
|
|
resultMap.put("message", "获取盘点数据失败,盘点单号为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryPrintData(drawNo);
|
|
|
- if(list.size()>0){
|
|
|
- Employee cofEmployee = employeeService.queryByUserCode(list.get(0).getConfirmId());
|
|
|
- if(cofEmployee != null){
|
|
|
- resultMap.put("confirmName", cofEmployee.getEmployeeName());
|
|
|
+ if(!Constants.XYK_GROUP_NO.equals(groupNo)){
|
|
|
+ List<YpBaseYfVo> list = yfInventoryService.queryYpInventoryPrintData(drawNo);
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ Employee cofEmployee = employeeService.queryByUserCode(list.get(0).getConfirmId());
|
|
|
+ if(cofEmployee != null){
|
|
|
+ resultMap.put("confirmName", cofEmployee.getEmployeeName());
|
|
|
+ }
|
|
|
+ Employee inEmployee = employeeService.queryByUserCode(list.get(0).getInputId());
|
|
|
+ resultMap.put("inputName", inEmployee.getEmployeeName());
|
|
|
}
|
|
|
- Employee inEmployee = employeeService.queryByUserCode(list.get(0).getInputId());
|
|
|
- resultMap.put("inputName", inEmployee.getEmployeeName());
|
|
|
+
|
|
|
+ resultMap.put("data", list);
|
|
|
+ } else {
|
|
|
+ List<YpBaseVo> list = yfInventoryService.queryYpInventoryYkPrintData(drawNo);
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ Employee cofEmployee = employeeService.queryByUserCode(list.get(0).getConfirmId());
|
|
|
+ if(cofEmployee != null){
|
|
|
+ resultMap.put("confirmName", cofEmployee.getEmployeeName());
|
|
|
+ }
|
|
|
+ Employee inEmployee = employeeService.queryByUserCode(list.get(0).getInputId());
|
|
|
+ resultMap.put("inputName", inEmployee.getEmployeeName());
|
|
|
+ }
|
|
|
+ resultMap.put("data", list);
|
|
|
}
|
|
|
resultMap.put("code", 0);
|
|
|
- resultMap.put("data", list);
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.toString());
|
|
@@ -165,31 +232,52 @@ public class YfInventoryController {
|
|
|
|
|
|
/**
|
|
|
* 审核盘点记录
|
|
|
+ * @param groupNo
|
|
|
* @param drawNo
|
|
|
* @return
|
|
|
*/
|
|
|
@UserLoginToken
|
|
|
@RequestMapping(value = "/auditYpInventory",method = {RequestMethod.GET})
|
|
|
- public Map<String,Object> auditYpInventory(@RequestParam("drawNo") String drawNo,HttpServletRequest httpServletRequest)throws MzException {
|
|
|
+ public Map<String,Object> auditYpInventory(@RequestParam("groupNo") String groupNo,@RequestParam("drawNo") String drawNo,HttpServletRequest httpServletRequest)throws MzException {
|
|
|
User tokenUser = TokenUtil.getUser(httpServletRequest);
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(drawNo)){
|
|
|
+ if(StringUtils.isBlank(groupNo)){
|
|
|
resultMap.put("code", -1);
|
|
|
- resultMap.put("message", "审核盘点失败,盘点单号为空");
|
|
|
+ resultMap.put("message", "审核盘点失败,药库或者药房为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- String ypOutDetlYfConfirmFlag = yfInventoryService.getYpOutDetlYfConfirmFlag(drawNo);
|
|
|
- if(ypOutDetlYfConfirmFlag.equals("1")){
|
|
|
+ if(StringUtils.isBlank(drawNo)){
|
|
|
resultMap.put("code", -1);
|
|
|
- resultMap.put("message", "盘点单号【"+drawNo+"】已审核通过,请勿重复审核!");
|
|
|
+ resultMap.put("message", "审核盘点失败,盘点单号为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- YpOutDetlYf ypOutDetlYf = new YpOutDetlYf();
|
|
|
- ypOutDetlYf.setConfirmFlag("1");
|
|
|
- ypOutDetlYf.setDrawNo(drawNo);
|
|
|
- ypOutDetlYf.setConfirmId(tokenUser.getUserIdCode());
|
|
|
- yfInventoryService.auditYpInventory(ypOutDetlYf);
|
|
|
+ if(!Constants.XYK_GROUP_NO.equals(groupNo)){
|
|
|
+ String ypOutDetlYfConfirmFlag = yfInventoryService.getYpOutDetlYfConfirmFlag(drawNo);
|
|
|
+ if(ypOutDetlYfConfirmFlag.equals("1")){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "盘点单号【"+drawNo+"】已审核通过,请勿重复审核!");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ YpOutDetlYf ypOutDetlYf = new YpOutDetlYf();
|
|
|
+ ypOutDetlYf.setConfirmFlag("1");
|
|
|
+ ypOutDetlYf.setDrawNo(drawNo);
|
|
|
+ ypOutDetlYf.setConfirmId(tokenUser.getUserIdCode());
|
|
|
+ yfInventoryService.auditYpInventory(ypOutDetlYf);
|
|
|
+ } else {
|
|
|
+ String ypOutDetlConfirmFlag = yfInventoryService.getYpOutDetlConfirmFlag(drawNo);
|
|
|
+ if(ypOutDetlConfirmFlag.equals("1")){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "盘点单号【"+drawNo+"】已审核通过,请勿重复审核!");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ YpOutDetl ypOutDetl = new YpOutDetl();
|
|
|
+ ypOutDetl.setConfirmFlag("1");
|
|
|
+ ypOutDetl.setGroupNo(groupNo);
|
|
|
+ ypOutDetl.setDrawNo(drawNo);
|
|
|
+ ypOutDetl.setConfirmId(tokenUser.getUserIdCode());
|
|
|
+ yfInventoryService.auditYpInventoryYk(ypOutDetl);
|
|
|
+ }
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "审核盘点记录成功");
|
|
|
resultMap.put("data", drawNo);
|