基于javaweb+mysql的ssm简单医院信息管理系统(java+ssm+javascript+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM简单医院信息管理系统(java+ssm+javascript+jsp+mysql)
项目介绍
管理员角色: 登录,个人资料管理,用户管理,科室管理,医生管理,患者管理,科室项目管理,患者诊疗记录管理等功能。 医生角色包含以下功能: 医生角色登录,个人资料密码修改,科室查看,医生列表,患者信息查看,科室项目查看,添加患者诊疗记录等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Sexguanli> list = sexguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Sexguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Sexguanli util, Model model) {
try{
sexguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
sexguanliMapper.deleteObject(util.getId());
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, Sexguanli util, Model model) {
List<Sexguanli> list = sexguanliMapper.getObjectList("s_0", util.getS_0());
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "User/saveOrUpdate";
}
userMapper.insertObject(util);
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "User/saveOrUpdate";
}
userMapper.updateObject(util);
}
return this.getAllUtil(request, util, model);
}
@RequestMapping(value = "/upload.do")
public String upload(@RequestParam MultipartFile[] myfiles,
HttpServletRequest request, User util, Model model)
throws IOException {
for (MultipartFile file : myfiles) {
if (!file.isEmpty()) {
String fileName = file.getOriginalFilename();
String path = request.getSession().getServletContext()
.getRealPath("image")
+ File.separator;
String uploadName = new SimpleDateFormat("yyyyMMddHHmmss")
.format(new Date()) + fileName;
File localFile = new File(path + uploadName);
file.transferTo(localFile);
util.setS_0(uploadName);
util.setS_1(fileName);
util.setS_2(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(new Date()));
}
if (0 == util.getId()) {
userMapper.insertObject(util);
} else {
userMapper.updateObject(util);
}
return this.getAllUtil(request, util, model);
}
return this.getAllUtil(request, util, model);
}
}
public class ActionEnter {
private HttpServletRequest request = null;
private String rootPath = null;
private String contextPath = null;
private String actionType = null;
private ConfigManager configManager = null;
public ActionEnter ( HttpServletRequest request, String rootPath ) {
this.request = request;
this.rootPath = rootPath;
this.actionType = request.getParameter( "action" );
this.contextPath = request.getContextPath();
this.configManager = ConfigManager.getInstance( this.rootPath, this.contextPath, request.getRequestURI() );
}
public String exec () {
String callbackName = this.request.getParameter("callback");
if ( callbackName != null ) {
if ( !validCallbackName( callbackName ) ) {
return new BaseState( false, AppInfo.ILLEGAL ).toJSONString();
}
return callbackName+"("+this.invoke()+");";
} else {
return this.invoke();
}
}
public String invoke() {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Huanzheguanli/saveOrUpdate";
}
huanzheguanliMapper.updateObject(util);
}
return this.getAllUtil(request, model);
}
}
@Controller
@RequestMapping(value = "Keshixiangmuguanli")
public class KeshixiangmuguanliController {
@Autowired
private KeshixiangmuguanliMapper keshixiangmuguanliMapper;
@Autowired
private KeshiguanliMapper keshiguanliMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "Keshixiangmuguanli/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
util = keshixiangmuguanliMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "Keshixiangmuguanli/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try {
userMapper.deleteObject(util.getId());
} catch (Exception e) {
}
}
return this.getAllUtil(request, util, model);
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, User util, Model model) {
try {
userMapper.deleteObject(util.getId());
} catch (Exception e) {
}
return this.getAllUtil(request, util, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, User util,
Model model) {
List<User> list = userMapper.getObjectList("s_0", util.getS_0());
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "User/saveOrUpdate";
}
userMapper.insertObject(util);
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "User/saveOrUpdate";
}
userMapper.updateObject(util);
}
return this.getAllUtil(request, util, model);
@Controller
@RequestMapping(value = "Keshiguanli")
public class KeshiguanliController {
@Autowired
private KeshiguanliMapper keshiguanliMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
return "Keshiguanli/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Keshiguanli util, Model model) {
util = keshiguanliMapper.selectObject(util.getId());
model.addAttribute("util", util);
return "Keshiguanli/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Keshiguanli> list = keshiguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Keshiguanli> list = keshiguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Keshiguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Keshiguanli util, Model model) {
try{
keshiguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
keshiguanliMapper.deleteObject(util.getId());
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
private YishengFileMapper yishengFileMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<Huanzheguanli> listHuanzheguanli = huanzheguanliMapper.getObjectList(null, null);
model.addAttribute("listHuanzheguanli", listHuanzheguanli);
List<Keshixiangmuguanli> listKeshixiangmuguanli = keshixiangmuguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshixiangmuguanli", listKeshixiangmuguanli);
List<YishengFile> listYishengFile = yishengFileMapper.getObjectList(null, null);
model.addAttribute("listYishengFile", listYishengFile);
return "Zhengliaojilu/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Zhengliaojilu util, Model model) {
util = zhengliaojiluMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<Huanzheguanli> listHuanzheguanli = huanzheguanliMapper.getObjectList(null, null);
model.addAttribute("listHuanzheguanli", listHuanzheguanli);
List<Keshixiangmuguanli> listKeshixiangmuguanli = keshixiangmuguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshixiangmuguanli", listKeshixiangmuguanli);
List<YishengFile> listYishengFile = yishengFileMapper.getObjectList(null, null);
model.addAttribute("listYishengFile", listYishengFile);
return "Zhengliaojilu/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Zhengliaojilu> list = zhengliaojiluMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
public String initUtil(HttpServletRequest request, Model model) {
return "Sexguanli/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Sexguanli util, Model model) {
util = sexguanliMapper.selectObject(util.getId());
model.addAttribute("util", util);
return "Sexguanli/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Sexguanli> list = sexguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Sexguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Sexguanli util, Model model) {
try{
sexguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
sexguanliMapper.deleteObject(util.getId());
}catch(Exception e){}
}
List<Keshixiangmuguanli> list = keshixiangmuguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Keshixiangmuguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
try{
keshixiangmuguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{
keshixiangmuguanliMapper.deleteObject(util.getId());
}catch(Exception e){}
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/saveOrUpdateObject.do")
public String saveOrUpdateObject(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
List<Keshixiangmuguanli> list = keshixiangmuguanliMapper.getObjectList("s_0", util.getS_0());
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "Keshixiangmuguanli/saveOrUpdate";
}
keshixiangmuguanliMapper.insertObject(util);
} else {
if (list.size() > 1) {
} else {
return this.invoke();
}
}
public String invoke() {
if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
}
if ( this.configManager == null || !this.configManager.valid() ) {
return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
}
State state = null;
int actionCode = ActionMap.getType( this.actionType );
Map<String, Object> conf = null;
switch ( actionCode ) {
case ActionMap.CONFIG:
return this.configManager.getAllConfig().toString();
case ActionMap.UPLOAD_IMAGE:
case ActionMap.UPLOAD_SCRAWL:
case ActionMap.UPLOAD_VIDEO:
case ActionMap.UPLOAD_FILE:
conf = this.configManager.getConfig( actionCode );
state = new Uploader( request, conf ).doExec();
break;
case ActionMap.CATCH_IMAGE:
conf = configManager.getConfig( actionCode );
String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
state = new ImageHunter( conf ).capture( list );
break;
case ActionMap.LIST_IMAGE:
if (list.size() > 1) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "YishengFile/saveOrUpdate";
}
yishengFileMapper.updateObject(util);
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/upload.do")
public String upload(@RequestParam MultipartFile[] myfiles, HttpServletRequest request, YishengFile util, Model model) throws IOException{
for (MultipartFile file : myfiles) {
if (!file.isEmpty()) {
String fileName = file.getOriginalFilename();
String path = request.getSession().getServletContext()
.getRealPath("upload")
+ File.separator;
String uploadName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())
+ fileName;
File localFile = new File(path + uploadName);
file.transferTo(localFile);
util.setS_0(uploadName);
util.setS_1(fileName);
util.setS_2(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
}else{
List<YishengFile> list = yishengFileMapper.getObjectList("s_3", util.getS_3());
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
if (0 == util.getId()) {
if (list.size() > 0) {
model.addAttribute("util", util);
model.addAttribute("errMsg", "该信息已存在!");
return "YishengFile/saveOrUpdate";
}
util.setS_0("None");
util.setS_1("None");
util.setS_2(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
} else {
if (list.size() > 1) {
model.addAttribute("util", util);
return "Keshixiangmuguanli/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
util = keshixiangmuguanliMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "Keshixiangmuguanli/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Keshixiangmuguanli> list = keshixiangmuguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Keshixiangmuguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
try{
keshixiangmuguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
huanzheguanliMapper.updateObject(util);
}
return this.getAllUtil(request, model);
}
}
@Controller
@RequestMapping(value = "Keshixiangmuguanli")
public class KeshixiangmuguanliController {
@Autowired
private KeshixiangmuguanliMapper keshixiangmuguanliMapper;
@Autowired
private KeshiguanliMapper keshiguanliMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "Keshixiangmuguanli/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, Keshixiangmuguanli util, Model model) {
util = keshixiangmuguanliMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "Keshixiangmuguanli/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, YishengFile util, Model model) {
util = yishengFileMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "YishengFile/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<YishengFile> list = yishengFileMapper.getObjectList(field, fieldValue);
List<YishengFile> listYishengFile = new ArrayList<YishengFile>();
HttpSession session = request.getSession();
int user_id = (Integer) session.getAttribute("user_id");
String user_type = (String) session.getAttribute("user_type");
for (YishengFile temp : list) {
if (user_id == temp.getUser().getId()) {
listYishengFile.add(temp);
}
}
if (!"admin".equals(user_type)) {
//list = listYishengFile;
}
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "YishengFile/find";
}
File localFile = new File(path + uploadName);
file.transferTo(localFile);
util.setS_0(uploadName);
util.setS_1(fileName);
util.setS_2(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(new Date()));
}
if (0 == util.getId()) {
userMapper.insertObject(util);
} else {
userMapper.updateObject(util);
}
return this.getAllUtil(request, util, model);
}
return this.getAllUtil(request, util, model);
}
}
@Controller
@RequestMapping(value = "YishengFile")
public class YishengFileController {
@Autowired
private YishengFileMapper yishengFileMapper;
@Controller
@RequestMapping(value = "YishengFile")
public class YishengFileController {
@Autowired
private YishengFileMapper yishengFileMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private KeshiguanliMapper keshiguanliMapper;
@RequestMapping(value = "/initUtil.do")
public String initUtil(HttpServletRequest request, Model model) {
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "YishengFile/saveOrUpdate";
}
@RequestMapping(value = "/selectUtil.do")
public String selectUtil(HttpServletRequest request, YishengFile util, Model model) {
util = yishengFileMapper.selectObject(util.getId());
model.addAttribute("util", util);
List<User> listUser = userMapper.getObjectList(null, null);
model.addAttribute("listUser", listUser);
List<Keshiguanli> listKeshiguanli = keshiguanliMapper.getObjectList(null, null);
model.addAttribute("listKeshiguanli", listKeshiguanli);
return "YishengFile/saveOrUpdate";
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/getAllUtil.do")
public String getAllUtil(HttpServletRequest request, Model model) {
String field = request.getParameter("field");
String fieldValue = request.getParameter("fieldValue");
try {
fieldValue = new String(fieldValue.getBytes("iso-8859-1"), "utf-8");
} catch (Exception e) {}
String pageNo = request.getParameter("pageModel.currentPageNo");
int currentPageNo = 1;
try{
currentPageNo = Integer.parseInt(pageNo);
}catch(Exception e){
}
List<Keshiguanli> list = keshiguanliMapper.getObjectList(field, fieldValue);
PageModel pageModel = new PageModel();
pageModel = pageModel.getUtilByController(list, currentPageNo);
model.addAttribute("pageModel", pageModel);
model.addAttribute("fieldValue", fieldValue);
model.addAttribute("field", field);
return "Keshiguanli/find";
}
@RequestMapping(value = "/deleteUtil.do")
public String deleteUtil(HttpServletRequest request, Keshiguanli util, Model model) {
try{
keshiguanliMapper.deleteObject(util.getId());
}catch(Exception e){
}
return this.getAllUtil(request, model);
}
@RequestMapping(value = "/deleteManyUtil.do")
public String deleteManyUtil(HttpServletRequest request, User util,
Model model) {
String ids[] = request.getParameterValues("id");
for (String id : ids) {
util = new User();
util.setId(Integer.parseInt(id));
try{