hz-zhhq-app-service/greenH5modul/.svn/pristine/c9/c9135fa77008da3b370989fc2f6...

113 lines
5.0 KiB
Plaintext
Raw Normal View History

2025-01-21 13:12:35 +08:00
package com.nationalelectric.greenH5;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nationalelectirc.Constant.Constant;
import com.nationalelectirc.utils.RestResult;
import com.nationalelectric.greenH5.DTO.GreenMealTicketApplyDTO;
import com.nationalelectric.greenH5.bizc.IGreenOperateLogBizc;
import com.nationalelectric.greenH5.po.GreenMinorItem;
import com.nationalelectric.greenH5.po.GreenPhysicalItem;
import com.nationalelectric.greenH5.po.GreenTotalTest;
import com.sgcc.uap.persistence.IHibernateDao;
/**
* <b>概述</b><br>
*
* <p>
* <b>功能</b><br>
*
*
* @author Administrator
*/
@Controller
@RequestMapping("/greenPhysicalItem")
public class GreenPhysicalItemController {
/**
* HibernateDao逻辑构件
*/
@Autowired
IHibernateDao hibernateDao;
@Resource
private IGreenOperateLogBizc greenOperateLogBizc;
/***
* 根据体检编号获取总检详情(第二张图;体检编号)
*/
@RequestMapping(value = "/physicalItemInfo", method = RequestMethod.POST)
public @ResponseBody RestResult getPhysicalItemInfo(@RequestBody Object requestBody) {
GreenPhysicalItem greenPhysicalItem = new ObjectMapper().convertValue(requestBody, new TypeReference<GreenPhysicalItem>() {});
try {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if(greenPhysicalItem.getTjId()!=null){
String physicalItem=greenPhysicalItem.getTjId();
//获取检查的大项目录
String greenPhysicalItemInfoSql ="SELECT b.branch_name AS branchName,i.note_id AS noteId,(SELECT count(*) FROM GREEN_MINOR_ITEM WHERE note_id=i.note_id and ill_sign=1) as count"
+" FROM GREEN_PHYSICAL_ITEM i LEFT JOIN GREEN_BRANCH b ON i.department_id = b.id LEFT JOIN GREEN_TOTAL_TEST t ON i.tj_id = t.tj_id WHERE t.tj_id = ? GROUP BY b.id";
list = hibernateDao.queryForListWithSql(greenPhysicalItemInfoSql,new Object[] {physicalItem});
//获取总检的结果
String totalTestSql="SELECT t.end_conclusion as endConclusion FROM GREEN_TOTAL_TEST t WHERE t.tj_id=?";
List<GreenTotalTest> totalTestSqlList=hibernateDao.queryForListWithSql(totalTestSql,new Object[] {physicalItem},new BeanPropertyRowMapper(GreenTotalTest.class));
String endConclusion=totalTestSqlList.get(0).getEndConclusion();
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("list", list);
map.put("endConclusion", endConclusion);
//greenOperateLogBizc.addLog(Constant.PHYSICAL, Constant.QUERY, Constant.OPERATE_SUCCESS, "查询体检列表", Constant.LOG_OPERATE, greenPhysicalItem.getUserId());
return new RestResult(Constant.SUCCESS, "请求成功!",map);
}
return new RestResult(Constant.FAILED, "体检编号为空!");
} catch (Exception e) {
//greenOperateLogBizc.addLog(Constant.PHYSICAL, Constant.QUERY, Constant.OPERATE_FAIL, "查询体检列表", Constant.LOG_ERROR, greenPhysicalItem.getUserId());
return new RestResult(Constant.FAILED,"返回异常");
}
}
/***
* 获取总检异常数量和具体项目名称
*/
@RequestMapping(value = "/physicalItemName", method = RequestMethod.POST)
public @ResponseBody RestResult getPhysicalItemName(@RequestBody Object requestBody) {
GreenMinorItem greenMinorItem = new ObjectMapper().convertValue(requestBody, new TypeReference<GreenMinorItem>() {});
try {
if(greenMinorItem.getPhysicalDate() == null && greenMinorItem.getUserId()==null){
return new RestResult(Constant.FAILED, "查询失败!");
}
String generalInspectonSql ="SELECT count(*) FROM GREEN_MINOR_ITEM i WHERE i.user_id=? and i.physical_date=? and i.ill_sign=1";
//获取总检所有检查的异常数量
int generalInspectonCount=hibernateDao.queryForIntWithSql(generalInspectonSql,new Object[] {greenMinorItem.getUserId(),greenMinorItem.getPhysicalDate()});
String minorIteSql="SELECT i.note_name as noteName,i.result as result FROM GREEN_MINOR_ITEM i WHERE i.user_id=? and i.physical_date=? and i.ill_sign=1";
//获取总检检查的具体项目
List<GreenMinorItem> minorIteList = hibernateDao.queryForListWithSql(minorIteSql,new Object[] {greenMinorItem.getUserId(),greenMinorItem.getPhysicalDate()});
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("minorIteList", minorIteList);
map.put("count", generalInspectonCount);
return new RestResult(Constant.SUCCESS, "请求成功!",map);
} catch (Exception e) {
return new RestResult(Constant.FAILED, "查询失败!");
}
}
}