package cn.ksource.web.controller.wechat.uwyw;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import cn.ksource.beans.SC_WORKFLOW_CI_HEALTH;
|
import cn.ksource.core.util.ConvertUtil;
|
import cn.ksource.core.util.DateUtil;
|
import cn.ksource.core.util.ParamsMapUtil;
|
import cn.ksource.core.util.StringUtil;
|
import cn.ksource.core.web.WebUtil;
|
import cn.ksource.web.Constants;
|
import cn.ksource.web.facade.health.HealthFacade;
|
import cn.ksource.web.facade.wechat.uwyw.UHealthFacade;
|
|
@Controller
|
@RequestMapping("/uwyw/uHealth")
|
public class UHealthControler {
|
@Autowired
|
UHealthFacade uHealthFacade;
|
@Autowired
|
HealthFacade healthFacade;
|
/**
|
* 跳转到所有健康检查工单页面
|
*/
|
@RequestMapping("uHealth.html")
|
public ModelAndView ewHealth(HttpServletRequest request,HttpServletResponse response) {
|
ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealth");
|
//查询工单状态
|
Map<String, String> state = Constants.mapWORKFLOW_BASE_WFSTATE_PART;
|
List status = new ArrayList();
|
for (Map.Entry<String, String> entry : state.entrySet()) {
|
String key = entry.getKey();
|
String value = entry.getValue();
|
Map map = new HashMap();
|
map.put("state", key);
|
map.put("stateName", value);
|
status.add(map);
|
}
|
//查询健康检查所有环节
|
Map<String, String> node = Constants.healthNode;
|
List nodes = new ArrayList();
|
for (Map.Entry<String, String> entry : node.entrySet()) {
|
String key = entry.getKey();
|
String value = entry.getValue();
|
Map map = new HashMap();
|
map.put("nodeId", key);
|
map.put("nodeName", value);
|
nodes.add(map);
|
}
|
modelAndView.addObject("nodes", nodes);
|
modelAndView.addObject("status", status);
|
return modelAndView;
|
}
|
/**
|
* 查询工单列表
|
*/
|
@RequestMapping(value="uHealthData.html")
|
public ModelAndView eHealthData(HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealthData");
|
Map<String, String> params = ParamsMapUtil.getParameterMap(request);
|
List list = uHealthFacade.uHealthData(request);
|
modelAndView.addObject("orderList", list);
|
String flowstate = request.getParameter("flowstate");
|
modelAndView.addObject("flowstate", flowstate);
|
return modelAndView;
|
}
|
|
/**
|
* 查询工单总数量
|
*/
|
@RequestMapping(value="uHealthCount.html",method=RequestMethod.POST)
|
public void eHealthCount(HttpServletRequest request,HttpServletResponse response) {
|
|
int count = uHealthFacade.uHealthCount(request);
|
WebUtil.write(response, String.valueOf(count));
|
}
|
/**
|
* 健康检查工单详情
|
*/
|
@RequestMapping("uHealthInfo.html")
|
public ModelAndView ewHealthInfo(HttpServletRequest request,HttpServletResponse response) {
|
ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealthInfo");
|
//查询健康检查基本信息
|
String orderId = request.getParameter("orderId");
|
String flowId = new String();
|
if(StringUtil.notEmpty(orderId)) {
|
SC_WORKFLOW_CI_HEALTH health = new SC_WORKFLOW_CI_HEALTH(orderId).getInstanceById();
|
flowId = health.getFlow_id();
|
}
|
|
//通过工单编号查询工单基本信息
|
Map baseMsg = healthFacade.getHealthInfo(orderId);
|
|
modelAndView.addObject("baseMsg", baseMsg);
|
modelAndView.addObject("orderId", orderId);
|
modelAndView.addObject("flowId", flowId);
|
|
return modelAndView;
|
}
|
|
/**
|
* 健康检查报告
|
* @author chenlong
|
* @param model
|
* @param request
|
* @return
|
*/
|
@RequestMapping("uHealthReport.html")
|
public String ewHealthReport(Model model,HttpServletRequest request){
|
String orderId = request.getParameter("orderId");
|
String flowId = request.getParameter("orderId");
|
Map healthInfo = healthFacade.getHealthReportInfo(orderId,flowId);
|
model.addAttribute("healthInfo", healthInfo);
|
return "/business/wechat/uwyw/uHealth/uHealthReport";
|
}
|
|
/**
|
* 跳转到健康检查日历页面
|
*/
|
@RequestMapping("uHealthCheck.html")
|
public String ewHealthCheck(Model model,HttpServletRequest request) {
|
|
//查询当前年前五年和后五年
|
int year = DateUtil.getYear();
|
List years = new ArrayList();
|
for(int i=5; i>=0; i--) {
|
int preYear = year-i;
|
years.add(preYear);
|
}
|
|
for(int i=1; i<5; i++) {
|
int nextYear = year+i;
|
years.add(nextYear);
|
}
|
|
model.addAttribute("years", years);
|
|
model.addAttribute("year", DateUtil.getToday("yyyy"));
|
model.addAttribute("month", DateUtil.getToday("MM"));
|
|
List months = new ArrayList();
|
for(int i=1; i<=12; i++) {
|
if(i<10) {
|
months.add("0"+i);
|
} else {
|
months.add(i);
|
}
|
}
|
model.addAttribute("months", months);
|
return "/business/wechat/uwyw/uHealth/uHealthCheck";
|
}
|
/**
|
* 查询健康检查日历
|
*/
|
@RequestMapping("uHealthCal.html")
|
public String ewHealthCal(Model model,HttpServletRequest request,HttpServletResponse response) {
|
|
String year = request.getParameter("year");
|
String month = request.getParameter("month");
|
|
Map result = uHealthFacade.queryHealthCalandar(request);
|
List list = (List)result.get("monthDays");
|
List weekDays = (List)result.get("weekDays");
|
model.addAttribute("calandars", list);
|
model.addAttribute("weeks", weekDays);
|
|
|
Long[] dates = DateUtil.getDateFromMonth(ConvertUtil.obj2Int(year),ConvertUtil.obj2Int(month));
|
List<Map> healths = uHealthFacade.uHealthData(request);
|
model.addAttribute("orderList", healths);
|
return "/business/wechat/uwyw/uHealth/uHealthCal";
|
}
|
/**
|
* 根据日期获取所有例行维护列表
|
* @param model
|
* @param request
|
* @return
|
*/
|
@RequestMapping("uHealthByDate.html")
|
public String ewHealthByDate(Model model,HttpServletRequest request){
|
return "/business/wechat/uwyw/uHealth/uHealthByDate";
|
}
|
}
|