using dccdc.DAL; using dccdc.Models; using Newtonsoft.Json; using System.Web; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using ZWL.Common; using dccdc.BLL; using static dccdc.Models.DictionariesViewModel; using FastReport.Data; using dccdc.Models.DTO; using System.Data; using System.Net; using System.IO; using Aspose.Pdf.Operators; using NPOI.Util; using ZXing; using Ext.Net; namespace dccdc.Controllers { public class DictionariesController : Controller { // GET: Dictionaries public ActionResult Index() { return View(); } #region 拼音简码生成 public string Getpy(string content) { return HanZi2PinYin.ConvertToPinYin(content); } #endregion #region 获取自增ID通用(只传表名++) public string GetIdentityMaxId(string tableName, int needcount) { return new G_identityBll().GetMaxId(tableName, needcount).ToString(); } #endregion #region 户籍维护 public class Droplist { public string Value { get; set; } public string Title { get; set; } } public ActionResult HouseholdRegister() { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model2); al.Add(model1); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } public string GetHouseholdRegisterAll() { var dal = new NativeInfoMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); ; return "{\"Rows\":" + modelslistjson + "}"; } [HttpPost] public JsonResult Edit(DictionariesViewModel.HujiViewmodel viewmodel) { bool f; NativeInfoMaintainModel dtoModel = new NativeInfoMaintainModel { Natives = viewmodel.Natives, Create_Time = DateTime.Now.ToString(), Status = viewmodel.Status }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtoModel.Creator = erpUser.UserName; var bll = new NativeInfoMaintainBll(); if (viewmodel.Id == null) f = bll.Add(dtoModel); else { dtoModel.Id = Convert.ToInt32(viewmodel.Id); f = bll.Edit(dtoModel); } return Json((f) ? new { State = 1, Message = "保存成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除户籍 /// /// /// public JsonResult delHousehold(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.NativeInfoMaintainBll().delHousehold(id)); } #endregion #region 工种与行业维护 public ActionResult GzHyWhResult() { ViewData["TypeList"] = new SelectList(new TradeTypeMaintainBll().GetAllTreeList(), "id", "trade_name"); return View(); } public ActionResult GetGzHyWhResultAll(int page, int pagesize, string key) { var bll = new BLL.WorkTypeTradeMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult EditGzHyWh(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model2); al.Add(model1); var bll = new WorkTypeTradeMaintainBll(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.HyWhViewModel { TradeName = model.trade_name, Id = model.id, CreateTime = model.create_time, Creator = model.creator, Status = model.status, TradeTypeMaintainId = Convert.ToInt32(model.trade_type_maintain_id), WorkTypeMaintainId = model.work_type_maintain_id, WorkTypeName = model.work_type_name }; ViewData["TradeList"] = new SelectList(new WorkTypeMaintainBll().GetAllTreeList(), "id", "work_type_name", viewModel.WorkTypeMaintainId); ViewData["TypeList"] = new SelectList(new TradeTypeMaintainBll().GetAllTreeList(), "id", "trade_name", viewModel.TradeTypeMaintainId); ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.Status); return View(viewModel); } else { ViewData["TradeList"] = new SelectList(new WorkTypeMaintainBll().GetAllTreeList(), "id", "work_type_name"); ViewData["TypeList"] = new SelectList(new TradeTypeMaintainBll().GetAllTreeList(), "id", "trade_name"); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditGzHyWh(DictionariesViewModel.HyWhViewModel hyWhViewModel) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["TradeList"] = new SelectList(new WorkTypeMaintainBll().GetAllTreeList(), "id", "work_type_name"); ViewData["TypeList"] = new SelectList(new TradeTypeMaintainBll().GetAllTreeList(), "id", "trade_name"); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(hyWhViewModel); } WorkTypeTradeMaintainBll bll = new WorkTypeTradeMaintainBll(); WorkTypeTradeMaintainModel dtomodel = new WorkTypeTradeMaintainModel { id = hyWhViewModel.Id, create_time = DateTime.Now.ToString(), status = hyWhViewModel.Status, trade_name = hyWhViewModel.TradeName, trade_type_maintain_id = hyWhViewModel.TradeTypeMaintainId.ToString(), work_type_maintain_id = hyWhViewModel.WorkTypeMaintainId, work_type_name = hyWhViewModel.WorkTypeName }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = hyWhViewModel.Id != 0 ? bll.Edit(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除工种行业 /// /// /// public JsonResult delGzHy(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.WorkTypeTradeMaintainBll().delGzHy(id)); } #endregion #region 体检小组和前置条件维护 public ActionResult GroupqztjResult() { ViewData["TypeList"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); return View(); } /// /// 根据小组名称获取体检小组和前置条件列表 /// /// /// /// /// public ActionResult GetgroupqzResultAll(int page, int pagesize, string key) { var bll = new BLL.ExamGroupPreposeConditionMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult EditgroupqzWh(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new ExamGroupPreposeConditionMaintainBll(); if (id != "") { var model = bll.Getmodel(id); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var viewModel = AutoMapper.Mapper.Map(model); ViewData["TradeList"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name", viewModel.exam_group_maintain_id); ViewData["TypeList"] = new SelectList(new ExamPreposeConditionMaintainBll().GetAllList(), "id", "prepose_condition", viewModel.exam_prepose_condition_maintain_id); ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["TradeList"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); ViewData["TypeList"] = new SelectList(new ExamPreposeConditionMaintainBll().GetAllList(), "id", "prepose_condition"); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditgroupqzWh(DictionariesViewModel.Groupqz hyWhViewModel) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["TradeList"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); ViewData["TypeList"] = new SelectList(new ExamPreposeConditionMaintainBll().GetAllList(), "id", "prepose_condition"); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(hyWhViewModel); } ExamGroupPreposeConditionMaintainBll bll = new ExamGroupPreposeConditionMaintainBll(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(hyWhViewModel); dtotjjg.create_time = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtotjjg.creator = erpUser.UserName; //修改 var f = false; f = hyWhViewModel.id != 0 ? bll.Update(dtotjjg) : bll.Add(dtotjjg); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除体检小组前置 /// /// /// public JsonResult delGroupPre(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ExamGroupPreposeConditionMaintainBll().delGroupPre(id)); } #endregion #region 体检项目维护 public ActionResult TjxmResult() { return View(); } /// /// 获取全部体检项目 /// /// public string TjxmlxTreeJsonResult() { ExamProjectMaintainBll projectMaintainBllbll = new ExamProjectMaintainBll(); ExamGroupMaintainBll groupMaintainBll = new ExamGroupMaintainBll(); //体检项目列表 List projectal = projectMaintainBllbll.GetAllList(""); //体检小组表 List groupal = groupMaintainBll.GetAllList(""); List treevmal = new List(); foreach (var groupMaintainModel in groupal) { TreeViewModel treevm = new TreeViewModel { id = groupMaintainModel.id, text = groupMaintainModel.team_name, type = 0 }; List selAll = projectal .Where(m => m.exam_group_maintain_id == groupMaintainModel.id).ToList(); if (selAll.Any()) { List cal = new List(); foreach (var examProjectMaintainModel in selAll) { children c = new children { id = Convert.ToInt32(examProjectMaintainModel.id), text = examProjectMaintainModel.project_name, type = 1 }; cal.Add(c); } treevm.children = cal; } //如果没有儿子那么删除 根据业务处理 treevmal.Add(treevm); } //采集exam_group_maintain体检小组表 return JsonConvert.SerializeObject(treevmal); //---exam_project_maintain体检项目表 =》exam_project_result_maintain 体检项目参考值表 } /// /// 根据项目名称/小组名称获取体检项目 /// /// /// public string TjxmlxTreeJsonResultByName(string name) { ExamProjectMaintainBll projectMaintainBllbll = new ExamProjectMaintainBll(); ExamGroupMaintainBll groupMaintainBll = new ExamGroupMaintainBll(); //体检项目列表 List projectal = projectMaintainBllbll.GetAllListByName(name); //体检小组表 List groupal = groupMaintainBll.GetAllListByName(name); //体检小组未包含,体检项目包含查询内容列表 List listExcept = new List(); //返回的树结构列表 List treevmal = new List(); foreach (var groupMaintainModel in groupal) { TreeViewModel treevm = new TreeViewModel { id = groupMaintainModel.id, text = groupMaintainModel.team_name, type = 0 }; //如果体检小组中包含查询内容,则将其体检项目一并展示 List listPro = projectMaintainBllbll.GetAllBypytjxz(groupMaintainModel.id.ToString(),"","",false); if(listPro.Any()) { List cal = new List(); foreach (var examProjectMaintainModel in listPro) { children c = new children { id = Convert.ToInt32(examProjectMaintainModel.id), text = examProjectMaintainModel.project_name, type = 1 }; cal.Add(c); } treevm.children = cal; } //体检小组与体检项目中均包含查询内容,将体检项目绑定到体检小组中 List selAll = projectal .Where(m => m.exam_group_maintain_id == groupMaintainModel.id).ToList(); if (selAll.Any()) { List cal = new List(); foreach (var examProjectMaintainModel in selAll) { children c = new children { id = Convert.ToInt32(examProjectMaintainModel.id), text = examProjectMaintainModel.project_name, type = 1 }; cal.Add(c); //先将包含的项目记录 listExcept.Add(examProjectMaintainModel); } treevm.children = cal; } treevmal.Add(treevm); } //如果只有体检项目中包含查询内容,需要将其体检小组添加并展示 //获取没有添加到树结构的体检项目 listExcept = projectal.Except(listExcept).ToList(); List listExceptGroup = new List(); foreach (var pro in listExcept) { ExamGroupMaintainModel group = groupMaintainBll.GetAllList(pro.exam_group_maintain_id.ToString()).FirstOrDefault(); if(group!=null) { listExceptGroup.Add(group); } } listExceptGroup = listExceptGroup.Where((x, i) => listExceptGroup.FindIndex(z => z.id == x.id) == i).ToList(); foreach (var groupMaintainModel in listExceptGroup) { TreeViewModel treevm = new TreeViewModel { id = groupMaintainModel.id, text = groupMaintainModel.team_name, type = 0 }; List selAll = listExcept .Where(m => m.exam_group_maintain_id == groupMaintainModel.id).ToList(); if (selAll.Any()) { List cal = new List(); foreach (var examProjectMaintainModel in selAll) { children c = new children { id = Convert.ToInt32(examProjectMaintainModel.id), text = examProjectMaintainModel.project_name, type = 1 }; cal.Add(c); } treevm.children = cal; } treevmal.Add(treevm); } //采集exam_group_maintain体检小组表 return JsonConvert.SerializeObject(treevmal); } public void ShanChu(int id) { //去删除 ExamProjectMaintainBll bll = new ExamProjectMaintainBll(); bool a = bll.Delete(id); } [HttpGet] public ActionResult TjxmwhJsonResult(string id, string groupid) { ExamProjectMaintainBll bll = new ExamProjectMaintainBll(); //20230830 zyk增加 生化,血常规,尿常规。对这三种领域的检查项目增加标签,区分一下。用于数据同步 List specialConfList = new BLL.Common().getParm_Value("special_conf", "B超,心电,拍片,FEV_1,FVC,FEV_1_100,生化,血常规,尿常规", "体检项目特殊配置").Split(',').ToList(); ViewData["SpecialConf"] = new SelectList(specialConfList); if (id != null) { ExamProjectMaintainModel dto = bll.GetAllList(id).First(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var tjxmViewModel = AutoMapper.Mapper.Map(dto); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllList("", "是"), "id", "charge_project_name", tjxmViewModel.charge_project); List al = new List(); string f = "定量"; string f1 = "定性"; al.Add(f); al.Add(f1); ViewData["pdms"] = new SelectList(al); ExamPreposeConditionMaintainBll b = new ExamPreposeConditionMaintainBll(); ViewData["qzx"] = new SelectList(b.GetAllList(), "ID", "prepose_condition"); return View(tjxmViewModel); } else { var tjxmViewModel = new DictionariesViewModel.TjxmViewModel { exam_group_maintain_id = Convert.ToInt32(groupid), exam_group = new ExamGroupMaintainBll().GetAllList(groupid).First().team_name, project_id = "0" }; ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllList("", "是"), "id", "charge_project_name"); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllList("", "是"), "id", "charge_project_name", tjxmViewModel.charge_project); List al = new List(); string f = "定量"; string f1 = "定性"; al.Add(f); al.Add(f1); ViewData["pdms"] = new SelectList(al); ExamPreposeConditionMaintainBll b = new ExamPreposeConditionMaintainBll(); ViewData["qzx"] = new SelectList(b.GetAllList(), "ID", "prepose_condition"); return View(tjxmViewModel); } } public JsonResult TjjgJsonResult(int page, int pagesize, string id) { ExamProjectResultMaintainBll projectResultMaintainBll = new ExamProjectResultMaintainBll(); List al = projectResultMaintainBll.GetAllList(page, pagesize, id); int count = projectResultMaintainBll.getCount(id); string modelslistjson = JsonConvert.SerializeObject(al); return Json(new { Total = count, Rows = al }); } [HttpGet] public ActionResult Tjjg(string id, string projectid) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model2); al.Add(model1); ViewData["Categories"] = new SelectList(al, "Value", "Title"); ViewData["QualifiedList"] = new SelectList(al, "Value", "Title"); if (id != null) { ExamProjectResultMaintainBll bll = new ExamProjectResultMaintainBll(); ExamProjectResultMaintainModel model = bll.GetAllListById(id).First(); DictionariesViewModel.TjjgViewModel vm = new DictionariesViewModel.TjjgViewModel(); AutoMapper.Mapper.Initialize(x => x.CreateMap()); var tjjgViewModel = AutoMapper.Mapper.Map(model); ViewData["Categories"] = new SelectList(al, "Value", "Title", tjjgViewModel.status); ViewData["QualifiedList"] = new SelectList(al, "Value", "Title", tjjgViewModel.is_qualified); return View(tjjgViewModel); } else { var tjjgViewModel = new DictionariesViewModel.TjjgViewModel { project_id = projectid, project_name = new ExamProjectMaintainBll().GetAllListByprojectid(projectid).First().project_name }; return View(tjjgViewModel); } } [HttpPost] public ActionResult Tjjg(DictionariesViewModel.TjjgViewModel tjjgViewModel) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title", tjjgViewModel.status); ViewData["QualifiedList"] = new SelectList(al, "Value", "Title", tjjgViewModel.is_qualified); return View(tjjgViewModel); } ExamProjectResultMaintainBll bll = new ExamProjectResultMaintainBll(); ExamProjectResultMaintainModel dtomodel = new ExamProjectResultMaintainModel(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(tjjgViewModel); //修改 var f = false; f = tjjgViewModel.id != 0 ? bll.Update(dtotjjg) : bll.Add(dtotjjg); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 保存体检项目 /// /// /// [HttpPost] public ActionResult TjxmwhJsonResult(DictionariesViewModel.TjxmViewModel tjxmViewModel) { ModelState.Remove("id"); ModelState.Remove("charge_project_maintain_id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllList("", "是"), "id", "charge_project_name"); return View(tjxmViewModel); } var f = false; ExamProjectMaintainBll bll = new ExamProjectMaintainBll(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); //俩种情况 //(1)存在即修改 if (tjxmViewModel.id != null) { List list = new List(); list.Add(tjxmViewModel.project_name); f = bll.Update(AutoMapper.Mapper.Map(tjxmViewModel)); if (f) { return Json(new { State = 1, Message = "操作成功", list }); } return Json(new { State = 0, Message = "操作失败!", list }); } //(2)没有就新增 else if (tjxmViewModel.id == null) { //list存储了ID和项目名称,用来更新前端懒加载 List list = bll.Add(AutoMapper.Mapper.Map(tjxmViewModel)); if (list.Count > 0) { return Json(new { State = 1, Message = "操作成功", list }); } return Json(new { State = 0, Message = "操作失败!", list }); } return Json( new { State = 0, Message = "操作失败!" }); } #endregion #region 体检前置条件维护 public ActionResult TjqztjResult() { //exam_prepose_condition_maintain 前置条件表 return View(); } [HttpGet] public ActionResult EditTjqztj(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new ExamPreposeConditionMaintainBll(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.TjqztjViewModel() { prepose_condition = model.prepose_condition, create_time = model.create_time, creator = model.creator, status = model.status, }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditTjqztj(DictionariesViewModel.TjqztjViewModel model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } ExamPreposeConditionMaintainBll bll = new ExamPreposeConditionMaintainBll(); ExamPreposeConditionMaintainModel dtomodel = new ExamPreposeConditionMaintainModel { ID = model.ID, create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, prepose_condition = model.prepose_condition }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.ID != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public string GetTjqztjResultAll() { var dal = new ExamPreposeConditionMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); ; return "{\"Rows\":" + modelslistjson + "}"; } /// /// 根据id删除体检前置关系 /// /// /// public JsonResult delTjqz(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ExamPreposeConditionMaintainBll().delTjqz(id)); } #endregion #region 体检小组与前置关系维护(以后做) public ActionResult GroupTjqzActionResult() { return View(); } #endregion #region 目标疾病维护 public ActionResult MbjbResult() { //target_disease_maintain 目标疾病表 return View(); } /// /// 根据目标疾病名称获取目标疾病列表 /// /// /// /// /// public JsonResult GetAllMbjbList(int page, int pagesize, string key) { var bll = new BLL.TargetDiseaseMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult EditMbjb(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new TargetDiseaseMaintainBll(); if (id != "0") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.MbjbViewModel() { code = model.code, disease_name = model.disease_name, pinyin_code = model.pinyin_code, create_time = model.create_time, creator = model.creator, status = model.status, }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditMbjb(DictionariesViewModel.MbjbViewModel model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } TargetDiseaseMaintainBll bll = new TargetDiseaseMaintainBll(); TargetDiseaseMaintainModel dtomodel = new TargetDiseaseMaintainModel { id = model.id, create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, disease_name = model.disease_name, pinyin_code = model.pinyin_code, code = model.code }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除目标疾病 /// /// /// public JsonResult delMbjb(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.TargetDiseaseMaintainBll().delMbjb(id)); } #endregion #region 主检标准处理建议维护 public ActionResult ZjBzClJyResult() { return View(); } #endregion #region 总结报告职业危害维护 public ActionResult ZjbgzywhResult() { // summary_report_harm_maintain总结报告职业危害表 return View(); } public string GetZjbgzywhAllList() { var dal = new SummaryReportHarmMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); ; return "{\"Rows\":" + modelslistjson + "}"; } [HttpGet] public ActionResult EditZjbgzywh(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new SummaryReportHarmMaintainBll(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.ZjbgzywhViewModel() { harmful_factor_name = model.harmful_factor_name, harmful_factors_maintain_id = model.harmful_factors_maintain_id, name = model.name, pinyin_code = model.pinyin_code, status = model.status, creator = model.creator, create_time = model.create_time }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); ViewData["yhys"] = new SelectList(new HarmfulFactorsMaintainBll().GetAllList("", "是"), "code", "harmful_factor_name", viewModel.status); return View(viewModel); } else { ViewData["yhys"] = new SelectList(new HarmfulFactorsMaintainBll().GetAllList("", "是"), "code", "harmful_factor_name"); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditZjbgzywh(DictionariesViewModel.ZjbgzywhViewModel hyWhViewModel) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(hyWhViewModel); } SummaryReportHarmMaintainBll bll = new SummaryReportHarmMaintainBll(); SummaryReportHarmMaintainModel dtomodel = new SummaryReportHarmMaintainModel { id = hyWhViewModel.id, harmful_factors_maintain_id = hyWhViewModel.harmful_factors_maintain_id, harmful_factor_name = hyWhViewModel.harmful_factor_name, name = hyWhViewModel.name, pinyin_code = hyWhViewModel.pinyin_code, status = hyWhViewModel.status, creator = hyWhViewModel.creator, create_time = DateTime.Now.ToString() }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = hyWhViewModel.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除总结报告职业危害 /// /// /// public JsonResult delZjbgzywh(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.SummaryReportHarmMaintainBll().delZjbgzywh(id)); } #endregion #region 企业体检方案维护 public ActionResult SiteTjfnWhResult() { // enterprise_info_maintain 企业字典表 //方案表 occupation_exam_scheme_maintain 【scheme_type】企业、通用 //选择有害因素填充有害因素类别 //select distinct c.harmful_factor_type_name from (select a.id, b.harmful_factor_type_name from(select id, [harmful_factor_type_name] = CONVERT(xml, '' + REPLACE([harmful_factor_type_name], '、', '') + '') from harmful_factors_maintain where id in (5, 13, 4, 79, 11, 101, 102) )a OUTER APPLY(select harmful_factor_type_name = N.v.value('.', 'varchar(200)') from a.[harmful_factor_type_name].nodes('/root/v') N(v))b )c //获取有害因素id //select distinct c.harmful_factor_type from ( select a.id, b.harmful_factor_type from( select id, [harmful_factor_type] = CONVERT(xml,'' + REPLACE([harmful_factor_type], ',', '') + '') from harmful_factors_maintain where id in (5,13,4,79,11,101,102) )a OUTER APPLY( select harmful_factor_type = N.v.value('.', 'varchar(200)') from a.[harmful_factor_type].nodes('/root/v') N(v) )b )c return View(); } /// /// 根据公司名称、方案名称查询方案列表 /// /// /// /// /// /// public JsonResult GetSiteTjfnList(int page, int pagesize, string key,string fn) { var bll = new BLL.OccupationExamSchemeMaintainBll(); int count = bll.GetSiteCount(key,fn); List ctList = bll.GetSiteList(page, pagesize, key,fn); return Json(new { Total = count, Rows = ctList }); } public ActionResult TjfnMxResult(string id) { ViewBag.id = id; //体检方案明细表exam_project_maintain 根据occupation_exam_scheme_maintain.check_item_ids in条件查询 return View(); } public string GetTjfnMx(string id) { var bll1 = new BLL.OccupationExamSchemeMaintainBll(); var bll = new BLL.ExamProjectMaintainBll(); List ctList = bll.GetTjfnmxByIDs(bll1.GetModel(id).check_item_ids); string modelslistjson = JsonConvert.SerializeObject(ctList); ; return "{\"Rows\":" + modelslistjson + "}"; } [HttpGet] public ActionResult EditSiteTjmx(string id) { if (id != "0") { OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel model = bll.GetModel(id); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var tjxmViewModel = AutoMapper.Mapper.Map(model); ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjxmViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjxmViewModel.check_type_maintain_id); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name", tjxmViewModel.util_id); tjxmViewModel.harmful_factors_maintain_id = (!string.IsNullOrEmpty(tjxmViewModel.harmful_factors_maintain_id)) ? tjxmViewModel.harmful_factors_maintain_id.TrimEnd(',').TrimStart(',') : ""; return View(tjxmViewModel); } else { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type"); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name"); return View(); } } [HttpPost] public ActionResult EditSiteTjmx(TjfnViewModel tjfnViewModel) { ModelState.Remove("id"); if (!ModelState.IsValid) { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjfnViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjfnViewModel.jobs_state_maintain_id); return View(tjfnViewModel); } OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel dtomodel = new OccupationExamSchemeMaintainModel(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(tjfnViewModel); dtotjjg.scheme_type = "企业"; //修改 var f = false; f = tjfnViewModel.id != 0 ? bll.Update(dtotjjg) : bll.Add(dtotjjg); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public ActionResult YhysResult() { HarmfulFactorsTypeMaintainBll bll = new HarmfulFactorsTypeMaintainBll(); ViewData["yhlb"] = new SelectList(bll.GetAllTreeList(), "code", "harmful_factor_type"); return View(); } //有害因素列表 public string GetyhysList(string hylbpy, string hyyspy, string hylb) { var dal = new HarmfulFactorsMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllTreeList(hyyspy, hylbpy, hylb)); ; return "{\"Rows\":" + modelslistjson + "}"; } /// /// 根据有害因素id和在岗状态id查询体检项目(在选择有害因素后填充的体检项目) /// /// public string GettjxmByyhyszgzt(string hyysids, string zgzt) { ProjectFactorMaintainBll bll = new ProjectFactorMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(bll.GetListBytjxmgzzt(hyysids, zgzt)); return "{\"Rows\":" + modelslistjson + "}"; } /// /// 首次填充体检项目 根据occupation_exam_scheme_maintain表 体检项目ids /// /// /// public string GetFirsttjxmByyhyszgzt(string tjxmids) { ExamProjectMaintainBll bll = new ExamProjectMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(bll.GetTjfnmxByIDs(tjxmids)); ; return "{\"Rows\":" + modelslistjson + "}"; } /// /// 获取打印项目列表 /// 2023-11-22 xulu /// /// /// public string GetFirsttjxmByPrintItemIds(string print_item_ids) { string modelslistjson = JsonConvert.SerializeObject(new ExamProjectMaintainBll().GetTjfnByPrintItemIds(print_item_ids)); ; return "{\"Rows\":" + modelslistjson + "}"; } /// /// 根据体检项目查询收费项目列表 /// /// public string Getsfxm(string tjxmids) { ChargeProjectMaintainBll bll = new ChargeProjectMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(bll.GetAllListBytjxm(tjxmids)); return "{\"Rows\":" + modelslistjson + "}"; } /// /// 体检项目选择页面 /// 2023-11-15 xulu 增加性别参数 /// /// /// public ActionResult TjxmSel(string strSex) { ExamGroupMaintainBll bll = new ExamGroupMaintainBll(); //ViewData["tjxz"] = new SelectList(bll.GetAllListTrue(""), "id", // "team_name"); ViewData["tjxz"] = new SelectList(bll.GetAllListTrueOrderByCount(), "id", "team_name"); //2023-11-24 xulu 添加有害因素、在岗状态列表 ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); ViewData["yhys"] = new SelectList(new HarmfulFactorsMaintainBll().GetAllList("", "是"), "harmful_factor_type", "harmful_factor_name"); ViewData["sex"] = strSex; return View(); } /// /// 打印项目选择页面 /// 2023-11-22 xulu /// /// /// /// public ActionResult PrintxmSel(string person_id,string scheme_id,string check_item_ids) { ViewData["tjxz"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrueOrderByCount(), "id", "team_name"); ViewData["person_id"] = person_id; ViewData["scheme_id"] = scheme_id; ViewData["check_item_ids"] = check_item_ids; return View(); } /// /// 根据小组、拼音简码、名称查询体检项目 /// /// /// /// /// public string TjxmList(string tjxz, string py,string name,string strSex,string job_status_id, string yhys_id) { ExamProjectMaintainBll bll = new ExamProjectMaintainBll(); //2023-11-15 xulu 体检项目根据性别筛选 List listNew = new List(); List list = new List(); //2023-11-24 xulu 添加有害因素、在岗状态条件查询体检项目 if (!string.IsNullOrEmpty(yhys_id)) { //根据有害因素、在岗状态条件查询 list = bll.GetAllByyhys(job_status_id, yhys_id); } else { //根据小组、拼音简码、名称查询 list = bll.GetAllBypytjxz(tjxz, py, name, true); } string sex1 = strSex == "男" ? "女" : "男"; for (int i = 0; i < list.Count; i++) { if (strSex != "男" && strSex != "女") { listNew.Add(list[i]); } else if (list[i].project_alias == null) { listNew.Add(list[i]); } else if (list[i].project_alias.IndexOf(sex1) == -1) { listNew.Add(list[i]); } } string modelslistjson = JsonConvert.SerializeObject(listNew); return "{\"Rows\":" + modelslistjson + "}"; } /// /// 根据person_id或者scheme_id获取体检项目列表 /// 2023-11-22 xulu /// /// /// /// /// /// /// public string GetTjxmList(string tjxz, string py, string name, string person_id,string scheme_id,string check_item_ids) { if(string.IsNullOrEmpty(scheme_id)) { List listCheck = new ExamProjectMaintainBll().getCheckItemsByPersonId(tjxz, py, name, person_id); List listPrint = new ExamProjectMaintainBll().getPrintItemsByPersonId(person_id); return "{\"Rows\":" + JsonConvert.SerializeObject(listCheck) + ",\"tjxmListPrint\":" + JsonConvert.SerializeObject(listPrint) + "}"; } else { List listCheck = new ExamProjectMaintainBll().getCheckItemsBySchemeId(tjxz, py, name, scheme_id, check_item_ids); List listPrint = new ExamProjectMaintainBll().getPrintItemsBySchemeId(scheme_id); return "{\"Rows\":" + JsonConvert.SerializeObject(listCheck) + ",\"tjxmListPrint\":" + JsonConvert.SerializeObject(listPrint) + "}"; } } #endregion #region 通用方案维护 public ActionResult TjfnWhResult() { return View(); } public JsonResult GetTjfnList(int page, int pagesize, string key) { var bll = new BLL.OccupationExamSchemeMaintainBll(); int count = bll.GetTyCount(key); List ctList = bll.GetTyList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult EditTyTjmx(string id) { if (id != "0") { OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel model = bll.GetModel(id); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var tjxmViewModel = AutoMapper.Mapper.Map(model); ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjxmViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjxmViewModel.check_type_maintain_id); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name", tjxmViewModel.util_id); tjxmViewModel.harmful_factors_maintain_id = (!string.IsNullOrEmpty(tjxmViewModel.harmful_factors_maintain_id)) ? tjxmViewModel.harmful_factors_maintain_id.TrimEnd(',').TrimStart(',') : ""; return View(tjxmViewModel); } else { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type"); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name"); return View(); } } [HttpPost] public ActionResult EditTyTjmx(TjfnViewModel tjfnViewModel) { ModelState.Remove("id"); if (!ModelState.IsValid) { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjfnViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjfnViewModel.jobs_state_maintain_id); return View(tjfnViewModel); } OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel dtomodel = new OccupationExamSchemeMaintainModel(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(tjfnViewModel); dtotjjg.scheme_type = "通用"; //修改 var f = false; f = tjfnViewModel.id != 0 ? bll.Update(dtotjjg) : bll.Add(dtotjjg); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult TyTjdel(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.OccupationExamSchemeMaintainBll().Del(id)); } public JsonResult SchemeClone(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.OccupationExamSchemeMaintainBll().Clone(id)); } #endregion #region 体检类型维护 /// /// 体检类型维护页面 /// /// public ActionResult CheckType() { return View(); } public JsonResult getCheckTypeList(int page, int pagesize, string key) { var bll = new BLL.checktypemaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveCheckType(Models.check_type_maintainModal ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.checktypemaintainBll().save(ct, user)); } /// /// 根据id删除体检类型 /// /// /// public JsonResult delCheckType(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.checktypemaintainBll().delCheckType(id)); } #endregion #region 参数维护 public ActionResult ParamResult() { return View(); } [HttpGet] public ActionResult EditParm(string id) { var bll = new dccdc.BLL.Common(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.SystemParms() { parm_name = model.parm_name, Parm_remarks = model.Parm_remarks, Parm_value = model.Parm_value, }; return View(viewModel); } else { return View(); } } [HttpPost] public ActionResult EditParm(DictionariesViewModel.SystemParms model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } dccdc.BLL.Common c = new dccdc.BLL.Common(); SystemParmsModel dtomodel = new SystemParmsModel { Parm_remarks = model.Parm_remarks, Parm_value = model.Parm_value, parm_name = model.parm_name, id = model.id }; //修改 var f = false; f = model.id != 0 ? c.Update(dtomodel) : c.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据参数名/参数值/参数说明查询系统参数列表 /// /// /// /// /// /// /// public string GetPramList(int page, int pagesize,string strParamName,string strParamValue,string strParamRemark) { dccdc.BLL.Common c = new dccdc.BLL.Common(); //string modelslistjson = JsonConvert.SerializeObject(c.GetAllList("")); int count = c.getCount(strParamName,strParamValue,strParamRemark); var list = c.getListPage(page, pagesize,strParamName,strParamValue,strParamRemark); //return "{\"Rows\":" + modelslistjson + "}"; return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = list }); } /// /// 根据id删除系统参数 /// /// /// public JsonResult delParamResult(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new dccdc.BLL.Common().delParamResult(id)); } #endregion #region 预约人数维护 [HttpGet] public ActionResult EditAppointment() { var bll = new dccdc.BLL.Common(); string paramS = "mryyrs"; var model = bll.GetModelBy(paramS); var viewModel = new DictionariesViewModel.SystemParms() { parm_name = paramS, Parm_remarks = model.Parm_remarks, Parm_value = model.Parm_value, id = model.id }; return View(viewModel); } [HttpPost] public ActionResult EditAppointment(DictionariesViewModel.SystemParms model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } dccdc.BLL.Common c = new dccdc.BLL.Common(); SystemParmsModel dtomodel = new SystemParmsModel { Parm_remarks = "每日预约人数", Parm_value = model.Parm_value, parm_name = "mryyrs", id = model.id }; //修改 var f = model.id != 0 ? c.Update(dtomodel) : c.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } #endregion #region 1、工种维护 by:lyz date:2017-06-03 完成 /// /// 工种维护页面 /// /// public ActionResult CheckWorkType() { return View(); } public JsonResult getCheckWorkTypeList(int page, int pagesize, string key) { var bll = new BLL.checkworktypemaintainBll(); int count = bll.getCount(key); List cwtList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = cwtList }); } public JsonResult saveCheckWorkType(Models.check_work_type_maintainModal cwt) { var user = Session["loginUser"] as Models.ERPUser; if (string.IsNullOrEmpty(cwt.code)) { cwt.code = GetIdentityMaxId("work_type_maintain", 1); } cwt.pinyin_code = Getpy(cwt.work_type_name); return Json(new BLL.checkworktypemaintainBll().save(cwt, user)); } /// /// 根据id删除工种 /// /// /// public JsonResult delCheckWorkType(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new dccdc.BLL.checkworktypemaintainBll().delCheckWorkType(id)); } #endregion #region 2、行业类别维护 by:lyz date 2017-06-04 完成 public ActionResult Trade_Type() { return View(); } public JsonResult getTradeTypeList(int page, int pagesize, string key) { var bll = new BLL.TradeTypeMaintainBll(); int count = bll.getCount(key); List ttList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ttList }); } public JsonResult saveTradeType(Models.TradeTypeMaintainModel tt) { var user = Session["loginUser"] as Models.ERPUser; if (string.IsNullOrEmpty(tt.code)) { tt.code = GetIdentityMaxId("trade_type_maintain", 1); } return Json(new BLL.TradeTypeMaintainBll().save(tt, user)); } /// /// 根据id删除从业类型关系 /// /// /// public JsonResult delTradeType(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.TradeTypeMaintainBll().delTradeType(id)); } #endregion #region 3、收费项目维护 by:lyz date:2017-06-05 完成 public ActionResult ChargeProject() { return View(); } public JsonResult getChargeProjectList(int page, int pagesize, string key) { var bll = new BLL.ChargeProjectMaintainBll(); int count = bll.getCount(key); List cpList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = cpList }); } public JsonResult saveChargeProject(Models.ChargeProjectMaintainModel cp) { var user = Session["loginUser"] as Models.ERPUser; cp.pinyin_code = Getpy(cp.charge_project_name); return Json(new BLL.ChargeProjectMaintainBll().save(cp, user)); } /// /// 根据id删除收费项目 /// /// /// public JsonResult deCchargeProject(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ChargeProjectMaintainBll().deCchargeProject(id)); } #endregion #region 4、体检方案与收费项目关系维护 by:lyz date:2017-06-06 完成 public ActionResult TJfanganSFxiangmuWhResult() { return View(); } public string GetTJfanganSFxiangmuWhResultAll() { var bll = new MedicalSchemeChargeMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(bll.GetAllList("")); ; return "{\"Rows\":" + modelslistjson + "}"; } [HttpGet] public ActionResult EditTJfanganSFxiangmuWh(string id) { var bll = new MedicalSchemeChargeMaintainBll(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.TJfanganSFxiangmuWhViewModel { Id = model.id, MedicalScheme = model.medical_scheme, MedicalSchemeMaintainId = model.medical_scheme_maintain_id, ChargeProjectName = model.charge_project_name, ChargeProjectMaintainId = model.charge_project_maintain_id, Fee = model.fee }; ViewData["MedicalSchemeList"] = new SelectList(new MedicalSchemeMaintainBll().GetAllTreeList(), "id", "medical_scheme", viewModel.MedicalSchemeMaintainId); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllTreeList(), "id", "charge_project_name", viewModel.ChargeProjectMaintainId); return View(viewModel); } else { ViewData["MedicalSchemeList"] = new SelectList(new MedicalSchemeMaintainBll().GetAllTreeList(), "id", "medical_scheme"); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllTreeList(), "id", "charge_project_name"); return View(); } } [HttpPost] public ActionResult EditTJfanganSFxiangmuWh(DictionariesViewModel.TJfanganSFxiangmuWhViewModel model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["MedicalSchemeList"] = new SelectList(new MedicalSchemeMaintainBll().GetAllTreeList(), "id", "medical_scheme"); ViewData["ChargeProjectList"] = new SelectList(new ChargeProjectMaintainBll().GetAllTreeList(), "id", "charge_project_name"); return View(model); } MedicalSchemeChargeMaintainBll bll = new MedicalSchemeChargeMaintainBll(); MedicalSchemeChargeMaintainModel dtomodel = new MedicalSchemeChargeMaintainModel { id = model.Id, medical_scheme = model.MedicalScheme, medical_scheme_maintain_id = model.MedicalSchemeMaintainId, charge_project_name = model.ChargeProjectName, charge_project_maintain_id = model.ChargeProjectMaintainId, fee = model.Fee }; //修改 var f = false; if (model.Id != 0) { f = bll.Edit(dtomodel); } else { f = bll.Add(dtomodel); } return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除收费项目 /// /// /// public JsonResult delTJfanganSFxiangmuWh(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.MedicalSchemeChargeMaintainBll().delTJfanganSFxiangmuWh(id)); } #endregion #region 5、有害因素类别维护 by:lyz date:2017-06-07 完成 public ActionResult HarmfulFactorsType() { return View(); } /// /// 获取有害因素类别列表 /// /// /// /// /// public JsonResult getHarmfulFactorsTypeList(int page, int pagesize, string key) { var bll = new BLL.HarmfulFactorsTypeMaintainBll(); int count = bll.getCount(key); List hftList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = hftList }); } public JsonResult saveHarmfulFactorsType(HarmfulFactorsTypeMaintainModel hfm) { if (string.IsNullOrEmpty(hfm.code)) { hfm.code = GetIdentityMaxId("harmful_factors_type_maintain", 1); } hfm.pinyin_code = Getpy(hfm.harmful_factor_type); return Json(new BLL.HarmfulFactorsTypeMaintainBll().save(hfm)); } /// /// 根据id删除有害因素 /// /// /// public JsonResult delHarmfulFactorsType(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.HarmfulFactorsTypeMaintainBll().delHarmfulFactorsType(id)); } #endregion #region 6、有害因素维护 by:lyz 完成 public ActionResult HarmfulFactorsMaintain() { ViewData["harmful_factor_type_group"] = new SelectList(new HarmfulFactorsTypeMaintainBll().GetAllList("", ""), "code", "harmful_factor_type"); ViewData["check_type_maintain_id_group"] = new SelectList(new checktypemaintainBll().GetAllList("", ""), "id", "check_type"); return View(); } /// /// 根据有害因素名称获取有害因素列表 /// /// /// /// /// public JsonResult getHarmfulFactorsMaintainList(int page, int pagesize, string key) { var bll = new BLL.HarmfulFactorsMaintainBll(); int count = bll.getCount(key); List hfmList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = hfmList }); } public JsonResult saveHarmfulFactorsMaintainType(Models.HarmfulFactorsMaintainModel hfm) { var user = Session["loginUser"] as Models.ERPUser; hfm.pinyin_code = Getpy(hfm.harmful_factor_name); if (string.IsNullOrEmpty(hfm.code)) { hfm.code = GetIdentityMaxId("harmful_factors_maintain", 1); } return Json(new BLL.HarmfulFactorsMaintainBll().save(hfm, user)); } /// /// 根据id删除有害因素 /// /// /// public JsonResult delHarmfulFactorsMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.HarmfulFactorsMaintainBll().delHarmfulFactorsMaintain(id)); } #endregion #region 7、职业禁忌证维护 by:lyz date:2017-06-08 完成 public ActionResult ContraindicatMaintain() { return View(); } public JsonResult getContraindicatMaintainList(int page, int pagesize, string key) { var bll = new ContraindicatMaintainBll(); int count = bll.getCount(key); List cmList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = cmList }); } public JsonResult saveContraindicatMaintain(ContraindicatMaintainModel cm) { var user = Session["loginUser"] as Models.ERPUser; var bll = new ContraindicatMaintainBll(); if (string.IsNullOrEmpty(cm.code)) { cm.code = GetIdentityMaxId("contraindicat_maintain", 1); } cm.pinyin_code = Getpy(cm.contraindicat_name); return Json(bll.save(cm, user)); } /// /// 根据id删除职业禁忌证 /// /// /// public JsonResult delContraindicatMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ContraindicatMaintainBll().delContraindicatMaintain(id)); } #endregion #region 8、听阈偏差维护 by:lyz date:2017-06-09 完成 public ActionResult ThresholdDeviationMaintain() { ViewData["group"] = new SelectList(new ExamProjectMaintainBll().GetAllList(""), "id", "project_name"); return View(); } public JsonResult getThresholdDeviationMaintainList(int page, int pagesize, string key) { var bll = new BLL.ThresholdDeviationMaintainBll(); int count = bll.getCount(key); List cwtList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = cwtList }); } public JsonResult saveThresholdDeviationMaintainType(Models.ThresholdDeviationMaintainModel tdm) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.ThresholdDeviationMaintainBll().save(tdm, user)); } /// /// 根据id删除听阈偏差 /// /// /// public JsonResult delThresholdDeviationMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ThresholdDeviationMaintainBll().delThresholdDeviationMaintain(id)); } #endregion #region 9、总结报告检查及评价依据维护 by:lyz date:2017-06-10 完成 public ActionResult SummaryreportBasisMaintain() { return View(); } public JsonResult getSummaryreportBasisMaintainList(int page, int pagesize, string key) { var bll = new BLL.SummaryreportBasisMaintainBll(); int count = bll.getCount(key); List sbmList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = sbmList }); } public JsonResult saveSummaryreportBasisMaintain(Models.SummaryreportBasisMaintainModel sbm) { var user = Session["loginUser"] as Models.ERPUser; sbm.pinyin_code = Getpy(sbm.evaluation_basis); return Json(new BLL.SummaryreportBasisMaintainBll().save(sbm, user)); } /// /// 根据id删除总结报告检查及评价依据维护 /// /// /// public JsonResult delSummaryreportBasisMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.SummaryreportBasisMaintainBll().delSummaryreportBasisMaintain(id)); } #endregion #region 10、总结报告职业病诊断标准维护 by:lyz date:2017-06-11 完成 public ActionResult SummaryreportStandardMaintain() { return View(); } public JsonResult getSummaryreportStandardMaintainList(int page, int pagesize, string key) { var bll = new BLL.SummaryreportStandardMaintainBll(); int count = bll.getCount(key); List ssmList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ssmList }); } public JsonResult saveSummaryreportStandardMaintain(Models.SummaryreportStandardMaintainModel ssm) { var user = Session["loginUser"] as Models.ERPUser; ssm.pinyin_code = Getpy(ssm.standard_name); return Json(new BLL.SummaryreportStandardMaintainBll().save(ssm, user)); } /// /// 根据id删除总结报告职业病诊断标准 /// /// /// public JsonResult delSummaryreportStandardMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.SummaryreportStandardMaintainBll().delSummaryreportStandardMaintain(id)); } #endregion #region 体检小组维护 public ActionResult ExamGroupMaintain() { return View(); } public JsonResult getExamGroupMaintainList(int page, int pagesize, string key) { var bll = new BLL.ExamGroupMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveExamGroupMaintain(Models.ExamGroupMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.ExamGroupMaintainBll().save(ct, user)); } /// /// 根据id删除体检小组 /// /// /// public JsonResult delExamGroupMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ExamGroupMaintainBll().delExamGroupMaintain(id)); } #endregion #region 地区信息维护 public ActionResult AreaInfo() { return View(); } public JsonResult getAreaInfoList(int page, int pagesize, string key) { var bll = new BLL.AreaInfoMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveAreaInfo(Models.AreaInfoMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; // 转拼音 ct.pinyin_code = ZWL.Common.HanZi2PinYin.ConvertToPinYin(ct.area_name); return Json(new BLL.AreaInfoMaintainBll().save(ct, user)); } /// /// 根据id删除地区维护 /// /// /// public JsonResult delAreaInfo(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.AreaInfoMaintainBll().delAreaInfo(id)); } #endregion #region 企业信息维护 public ActionResult EnterpriceInfoMaintain() { return View(); } public string saveEnterpriceInfoMaintainModel() { string str = ""; return null; } public ActionResult weihuzhanghao(string id) { EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); EnterpriceInfoMaintainModel model = bll1.GetAllList(id).First(); return View(model); } public JsonResult savezhanghao(EnterpriceInfoMaintainModel model) { EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); EnterpriceInfoMaintainModel info = bll1.GetItem(model); if (info == null) { model = bll1.motifyObj(model); if (model != null) { return Json(new { State = 1, Message = "操作成功!" }); } else { return Json(new { State = 0, Message = "操作失败!" }); } } else { return Json(new { State = 0, Message = "用户名已存在!" }); } } public JsonResult GetEnterpriceInfoMaintainList(int page, int pagesize, string key) { var bll = new BLL.EnterpriceInfoMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult EditEnterpriceInfo(string id) { AreaInfoMaintainBll bll = new AreaInfoMaintainBll(); EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); if (id != "") { EnterpriceInfoMaintainModel dto = bll1.GetAllList(id).First(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var tjxmViewModel = AutoMapper.Mapper.Map(dto); ViewData["qy"] = new SelectList(bll.GetAllList(), "id", "area_name", tjxmViewModel.area_info_maintain_id); List al = new List { "乡镇", "城市" }; List al1 = new List { "从业", "职业", "常规", "学生", "公用" }; ViewData["cxlx"] = new SelectList(al, tjxmViewModel.city_rural_type); ViewData["gs"] = new SelectList(al1, tjxmViewModel.attribution); if (!string.IsNullOrEmpty(tjxmViewModel.school_type)) { if (tjxmViewModel.school_type.IndexOf("小学", StringComparison.Ordinal) != -1) tjxmViewModel.xx = true; if (tjxmViewModel.school_type.IndexOf("初中", StringComparison.Ordinal) != -1) tjxmViewModel.cz = true; if (tjxmViewModel.school_type.IndexOf("高中", StringComparison.Ordinal) != -1) tjxmViewModel.gz = true; } return View(tjxmViewModel); } else { ViewData["qy"] = new SelectList(bll.GetAllList(), "id", "area_name"); List al = new List { "乡镇", "城市" }; List al1 = new List { "从业", "职业", "常规", "学生", "公用" }; ViewData["cxlx"] = new SelectList(al); ViewData["gs"] = new SelectList(al1); return View(); } } [HttpPost] public ActionResult EditEnterpriceInfo(DictionariesViewModel.SitexxViewModel model) { AreaInfoMaintainBll bll = new AreaInfoMaintainBll(); EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); ModelState.Remove("id"); if (!ModelState.IsValid) { ViewData["qy"] = new SelectList(bll.GetAllList(), "id", "area_name", model.area_info_maintain_id); List al = new List { "乡镇", "城市" }; List al1 = new List { "从业", "职业", "常规", "学生", "公用" }; ViewData["cxlx"] = new SelectList(al, model.city_rural_type); ViewData["gs"] = new SelectList(al1, model.attribution); return View(model); } AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(model); dtotjjg.school_type = ((model.xx) ? "小学," : "") + ((model.cz) ? "初中," : "") + ((model.gz) ? "高中" : ""); bll1.save(dtotjjg, Session["loginUser"] as Models.ERPUser); return Json(new { State = 1, Message = "操作成功!" }); } /// /// 根据id删除企业 /// /// /// public JsonResult delEnterprise(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.EnterpriceInfoMaintainBll().delEnterprise(id)); } #endregion #region 小组位置维护 public ActionResult ExamGroupLocalMaintain() { ViewData["group"] = new SelectList(new ExamGroupMaintainBll().GetAllList(""), "id", "team_name"); return View(); } public JsonResult getExamGroupLocalMaintainList(int page, int pagesize, string key) { var bll = new BLL.ExamGroupLocalMaintainBLL(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveExamGroupLocalMaintain(Models.ExamGroupLocalMaintain ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.ExamGroupLocalMaintainBLL().save(ct, user)); } /// /// 根据id删除小组位置 /// /// /// public JsonResult delExamGroupLocal(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ExamGroupLocalMaintainBLL().delExamGroupLocal(id)); } #endregion #region 收费方式维护 public ActionResult ChargeMethodMaintain() { return View(); } public JsonResult getChargeMethodMaintainist(int page, int pagesize, string key) { var bll = new BLL.ChargeMethodMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveChargeMethodMaintain(ChargeMethodMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.ChargeMethodMaintainBll().save(ct, user)); } /// /// 根据id删除收费方式 /// /// /// public JsonResult delChargeMethod(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ChargeMethodMaintainBll().delChargeMethod(id)); } #endregion #region 体检小组与医生关系维护 public ActionResult ExamGroupDoctorMatintain() { return View(); } public JsonResult getExamGroupDoctorMatintainList(int page, int pagesize, string key) { var bll = new BLL.ExamGroupDoctorMatintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult getAllUser() { var bll = new BLL.ExamGroupDoctorMatintainBll(); List ctList = bll.getAllUser(); return Json(new { Rows = ctList }); } public JsonResult saveExamGroupDoctorMatintain(ExamGroupDoctorMatintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.ExamGroupDoctorMatintainBll().save(ct, user)); } public JsonResult delExamGroupDoctorMatintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ExamGroupDoctorMatintainBll().del(id)); } #endregion #region 从业主检结论维护 public ActionResult MainDoctorConclusionMaintain() { return View(); } public JsonResult getMainDoctorConclusionMaintainList(int page, int pagesize, string key) { var bll = new BLL.MainDoctorConclusionMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveMainDoctorConclusionMaintain(MainDoctorConclusionMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; return Json(new BLL.MainDoctorConclusionMaintainBll().save(ct, user)); } /// /// 根据id删除主检结论 /// /// /// public JsonResult delMainDoctorConclusionMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.MainDoctorConclusionMaintainBll().delMainDoctorConclusionMaintain(id)); } #endregion #region 岗位类型维护 public ActionResult JobsStateMaintain() { return View(); } public string GetTjgwlxwhResultAll() { var dal = new JobsStateMaintainDal(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("", "")); return "{\"Rows\":" + modelslistjson + "}"; } public string getJobsState() { var dal = new JobsStateMaintainDal(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("", "是")); return modelslistjson; } [HttpGet] public ActionResult EditGwlxwh(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new JobsStateMaintainDal(); if (id != "") { var model = bll.GetAllList(id, "").First(); var viewModel = new DictionariesViewModel.GWLXViewModel() { jobs_state = model.jobs_state, create_time = model.create_time, creator = model.creator, status = model.status, }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditGwlxwh(DictionariesViewModel.GWLXViewModel model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } JobsStateMaintainBll bll = new JobsStateMaintainBll(); JobsStateMaintainModel dtomodel = new JobsStateMaintainModel { id = model.id, code = model.id != 0 ? model.code : GetIdentityMaxId("jobs_state_maintain", 1), create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, jobs_state = model.jobs_state }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除岗位类型 /// /// /// public JsonResult delJobState(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.JobsStateMaintainBll().delJobState(id)); } #endregion #region 条码名称维护 public ActionResult BarCodeMaintain() { return View(); } public String GetBCMResultAll() { var dal = new BarCodeMaintainDal(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } [HttpGet] public ActionResult EditBarCodeMaintain(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new BarCodeMaintainDal(); if (id != "") { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.BarCodeMaintain() { code_name = model.code_name, is_print = model.is_print, create_time = model.create_time, creator = model.creator, status = model.status, }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditBarCodeMaintain(DictionariesViewModel.BarCodeMaintain model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } BarCodeMaintainBll bll = new BarCodeMaintainBll(); BarCodeMaintainModel dtomodel = new BarCodeMaintainModel { id = model.id, create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, code_name = model.code_name }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除条码 /// /// /// public JsonResult delBarCode(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.BarCodeMaintainBll().delBarCode(id)); } #endregion #region 条码与体检项目关系维护 public ActionResult BarCodeProjectMaintain() { return View(); } public string GetTjBCPMResultAll(string id) { var dal = new BarCodeProjectMaintainDal(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList(id)); return "{\"Rows\":" + modelslistjson + "}"; } public string TjwxxmResult(string[] data, string cxtj) { var dal = new ExamProjectMaintainDal(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList(data, cxtj)); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult addBarCodeProjectMaintain(DictionariesViewModel.BarCodeProjectMaintain model) { BarCodeProjectMaintainBll bll = new BarCodeProjectMaintainBll(); BarCodeProjectMaintainModel dtomodel = new BarCodeProjectMaintainModel { code_name = model.code_name, bar_code_maintain_id = model.bar_code_maintain_id, project = model.project, exam_project_maintain_id = model.exam_project_maintain_id, project_code = model.project_code }; var f = false; f = bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public ActionResult delBarCodeProjectMaintain(DictionariesViewModel.BarCodeProjectMaintain model) { BarCodeProjectMaintainBll bll = new BarCodeProjectMaintainBll(); BarCodeProjectMaintainModel dtomodel = new BarCodeProjectMaintainModel { code_name = model.code_name, bar_code_maintain_id = model.bar_code_maintain_id, project = model.project, exam_project_maintain_id = model.exam_project_maintain_id, project_code = model.project_code }; var f = false; f = bll.del(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } #endregion #region 职业卫生主检建议维护 public ActionResult ProfessionMainAdviceMaintain() { return View(); } public JsonResult getProfessionMainAdviceMaintainist(int page, int pagesize, string key) { var bll = new BLL.ProfessionMainAdviceMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveProfessionMainAdviceMaintain(ProfessionMainAdviceMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; ct.pinyin_code = HanZi2PinYin.ConvertToPinYin(ct.main_advice); return Json(new BLL.ProfessionMainAdviceMaintainBll().save(ct, user)); } /// /// 根据id删除职业卫生主检建议维护 /// /// /// public JsonResult delProfessionMainAdviceMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.ProfessionMainAdviceMaintainBll().delProfessionMainAdviceMaintain(id)); } #endregion #region 体检方案与体检项目维护 by:zlf date:2017-06-12 public ActionResult TjfanganYuTjxiangmu() { return View(); } public JsonResult TjfanganYuTjxiangmuAll(int page, int pagesize, string key) { var bll = new medical_scheme_project_maintainBll(); int count = bll.getCount(key); var ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public string getTeamName(string project_id) { var bll = new medical_scheme_project_maintainBll(); string result = bll.getTeamName(project_id); return result; } public ActionResult TjfanganYuTjxiangmuMessage(string id) { var bll = new medical_scheme_project_maintainBll(); if (string.IsNullOrEmpty(id)) { ViewData["project"] = new SelectList(bll.getEnableProject(), "project_id", "project_name"); ViewData["scheme"] = new SelectList(bll.getEnableScheme(), "id", "medical_scheme"); return View(); } else { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.medical_scheme_project_maintainViewModel { id = model.id, medical_scheme = model.medical_scheme, medical_scheme_maintain_id = model.medical_scheme_maintain_id, project_name = model.project_name, team_name = model.team_name, exam_project_maintain_project_id = model.exam_project_maintain_project_id }; ViewData["project"] = new SelectList(bll.getEnableProject(), "project_id", "project_name"); ViewData["scheme"] = new SelectList(bll.getEnableScheme(), "id", "medical_scheme"); return View(viewModel); } } [HttpPost] public ActionResult TjfanganYuTjxiangmuMessage(DictionariesViewModel.medical_scheme_project_maintainViewModel model) { ModelState.Remove("id"); medical_scheme_project_maintainBll bll = new medical_scheme_project_maintainBll(); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["project"] = new SelectList(bll.getEnableProject(), "project_id", "project_name"); ViewData["scheme"] = new SelectList(bll.getEnableScheme(), "id", "medical_scheme"); return View(model); } medical_scheme_project_maintainModel model2 = new medical_scheme_project_maintainModel { id = model.id, medical_scheme = model.medical_scheme, medical_scheme_maintain_id = model.medical_scheme_maintain_id, project_name = model.project_name, team_name = model.team_name, exam_project_maintain_project_id = model.exam_project_maintain_project_id }; var f = false; if (model.id == 0) { f = bll.Add(model2); } else { f = bll.Edit(model2); } return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult del(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.medical_scheme_project_maintainBll().del(id)); } #endregion #region 体检方案维护 by:zlf date:2017-06-13 public ActionResult Tjfangan() { return View(); } public string TjfanganAll() { var dal = new MedicalSchemeMaintainBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public class sfbz { public string title { get; set; } public string value { get; set; } } public ActionResult TjfanganMessage(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var sflist = new List(); var f = new sfbz { value = "0", title = "不收费" }; var ff = new sfbz { value = "1", title = "收费" }; sflist.Add(f); sflist.Add(ff); var bll = new MedicalSchemeMaintainBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); var viewModel = new DictionariesViewModel.MedicalSchemeMaintainViewModel() { code = model.code, medical_scheme = model.medical_scheme, create_time = model.create_time, creator = model.creator, status = model.status, isCharge = model.isCharge }; ViewData["sfbz"] = new SelectList(sflist, "value", "title", viewModel.isCharge); ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["sfbz"] = new SelectList(sflist, "value", "title"); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult TjfanganMessage(DictionariesViewModel.MedicalSchemeMaintainViewModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var sflist = new List(); var fff = new sfbz { value = "0", title = "不收费" }; var ff = new sfbz { value = "1", title = "收费" }; sflist.Add(fff); sflist.Add(ff); var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["sfbz"] = new SelectList(sflist, "value", "title"); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } MedicalSchemeMaintainBll bll = new MedicalSchemeMaintainBll(); MedicalSchemeMaintainModel dtomodel = new MedicalSchemeMaintainModel { id = model.id, create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, medical_scheme = model.medical_scheme, code = model.code, isCharge = model.isCharge }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除体检方案 /// /// /// public JsonResult delTjfangan(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.MedicalSchemeMaintainBll().delTjfangan(id)); } #endregion #region 科目维护 public ActionResult kemu() { return View(); } public string kemuAll() { var dal = new kemuBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult kemuMessage(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var bll = new kemuBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(list, "value", "title", model.zt); return View(model); } else { ViewData["ztD"] = new SelectList(list, "value", "title", "1"); return View(); } } [HttpPost] public ActionResult kemuMessage(kemuModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } kemuBll bll = new kemuBll(); model.addtime = DateTime.Now; //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletekemu(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.kemuBll().delete(id)); } #endregion #region 科目维护2 public ActionResult kemu2() { return View(); } public string kemu2All() { var dal = new kemu2Bll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult kemu2Message(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var bll = new kemu2Bll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(list, "value", "title", model.zt); return View(model); } else { ViewData["ztD"] = new SelectList(list, "value", "title", "1"); return View(); } } [HttpPost] public ActionResult kemu2Message(kemu2Model model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } kemu2Bll bll = new kemu2Bll(); model.addtime = DateTime.Now; //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletekemu2(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.kemu2Bll().delete(id)); } #endregion #region 科目维护3 public ActionResult kemu3() { return View(); } public string kemu3All() { var dal = new kemu3Bll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult kemu3Message(string id) { var ztD = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var typeD = new List() { new Droplist { Value = "餐补", Title = "餐补" }, new Droplist { Value = "交通补助", Title = "交通补助" }, new Droplist { Value = "住宿费", Title = "住宿费" }, new Droplist { Value = "培训费", Title = "培训费" } }; var bll = new kemu3Bll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(ztD, "value", "title", model.zt); ViewData["typeD"] = new SelectList(typeD, "value", "title", model.sort); return View(model); } else { ViewData["ztD"] = new SelectList(ztD, "value", "title", "1"); ViewData["typeD"] = new SelectList(typeD, "value", "title"); return View(); } } [HttpPost] public ActionResult kemu3Message(kemu3Model model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var ztD = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(ztD, "value", "title"); var typeD = new List() { new Droplist { Value = "餐补", Title = "餐补" }, new Droplist { Value = "交通补助", Title = "交通补助" }, new Droplist { Value = "住宿费", Title = "住宿费" }, new Droplist { Value = "培训费", Title = "培训费" } }; ViewData["typeD"] = new SelectList(typeD, "value", "title", model.sort); return View(model); } kemu3Bll bll = new kemu3Bll(); model.addtime = DateTime.Now; //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletekemu3(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.kemu3Bll().delete(id)); } #endregion #region 科目维护4 public ActionResult kemu4() { return View(); } public string kemu4All() { var dal = new kemu4Bll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult kemu4Message(string id) { var ztD = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var typeD = new List() { new Droplist { Value = "交通工具", Title = "交通工具" } }; var bll = new kemu4Bll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(ztD, "value", "title", model.zt); ViewData["typeD"] = new SelectList(typeD, "value", "title", model.sort); return View(model); } else { ViewData["ztD"] = new SelectList(ztD, "value", "title", "1"); ViewData["typeD"] = new SelectList(typeD, "value", "title"); return View(); } } [HttpPost] public ActionResult kemu4Message(kemu4Model model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var ztD = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(ztD, "value", "title"); var typeD = new List() { new Droplist { Value = "交通工具", Title = "交通工具" } }; ViewData["typeD"] = new SelectList(typeD, "value", "title", model.sort); return View(model); } kemu4Bll bll = new kemu4Bll(); model.addtime = DateTime.Now; //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletekemu4(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.kemu4Bll().delete(id)); } #endregion #region 科目维护5 public ActionResult kemu5() { var models = new kemu5Bll().GetListByKey("其他报销费用来源显示部门"); ViewBag.ids = ""; if (models.Count > 0) ViewBag.ids = models[0].content; return View(); } public string kemu5All() { //部门 //var dal = new ERPBuMenBll(); //string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); //个人 var dal = new ERPUserBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } [HttpPost] public ActionResult savekemu5(string ids) { kemu5Bll bll = new kemu5Bll(); //修改 var f = bll.Update2("其他报销费用来源显示部门",ids); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } #endregion #region 字典维护 public ActionResult dics() { return View(); } public ActionResult dicsshow(string key) { var dal = new dicsBll(); var model = dal.GetAllList("").FirstOrDefault(); return View(); } public string dicsAll() { var dal = new dicsBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult dicsMessage(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var bll = new dicsBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(list, "value", "title", model.zt); return View(model); } else { ViewData["ztD"] = new SelectList(list, "value", "title", "1"); return View(); } } [ValidateInput(false)] [HttpPost] public ActionResult dicsMessage(dicsModel model) { model.value = model.editorValue; ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } dicsBll bll = new dicsBll(); model.addtime = DateTime.Now; //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletedics(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.dicsBll().delete(id)); } #endregion #region 三种一大结算方式 public ActionResult szyd_cgfs() { return View(); } public string szyd_cgfsAll() { var dal = new szyd_cgfsBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult szyd_cgfsMessage(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var bll = new szyd_cgfsBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(list, "value", "title", model.zt); return View(model); } else { ViewData["ztD"] = new SelectList(list, "value", "title", "1"); return View(); } } [HttpPost] public ActionResult szyd_cgfsMessage(szyd_cgfsModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } szyd_cgfsBll bll = new szyd_cgfsBll(); //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deleteszyd_cgfs(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.szyd_cgfsBll().delete(id)); } #endregion #region 省市区 public ActionResult areabefore() { return View(); } public ActionResult area() { //ViewBag.areaD = new SelectList(new BLL.areaBll().GetAllList(""), "id", "name"); //ViewBag.areaD2 = areaAll(); return View(); } public string areaAll() { var dal = new areaBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult areaMessage(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); List areaD = new BLL.areaBll().GetAllList(""); areaD.Insert(0, new areaModel() { id = 0, pid = 0, name = "顶级地区", zt = 1 }); ViewBag.areaD = new SelectList(areaD, "id", "name"); var bll = new areaBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); return View(model); } else { areaModel model = new areaModel(); model.zt = 1; return View(model); } } [HttpPost] public ActionResult areaMessage(areaModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } areaBll bll = new areaBll(); //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletearea(string id) { if (new BLL.areaBll().GetChild(id).Count > 0) { return Json(new { State = 0, Message = "包含子元素 不能删除!" }); } if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.areaBll().delete(id)); } #endregion #region 小程序轮播图片 public ActionResult xcximg() { return View(); } public string xcximgAll() { var dal = new xcximgBll(); string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("")); return "{\"Rows\":" + modelslistjson + "}"; } public ActionResult xcximgMessage(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; var bll = new xcximgBll(); if (!string.IsNullOrEmpty(id)) { var model = bll.GetAllList(id).First(); ViewData["ztD"] = new SelectList(list, "value", "title", model.zt); return View(model); } else { ViewData["ztD"] = new SelectList(list, "value", "title", "1"); xcximgModel model = new xcximgModel(); return View(model); } } [HttpPost] public ActionResult xcximgMessage(xcximgModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewData["ztD"] = new SelectList(list, "value", "title"); return View(model); } xcximgBll bll = new xcximgBll(); //修改 var f = false; f = model.id != 0 ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public JsonResult deletexcximg(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.xcximgBll().delete(id)); } //上传文件 public JsonResult uploadFile() { if (Request.Files.Count > 0) { string root = "/uploadFile/xcx"; if (!Directory.Exists(Server.MapPath(root))) Directory.CreateDirectory(Server.MapPath(root)); HttpPostedFileBase file = Request.Files[0]; string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(file.FileName); string filepath = root + "/" + filename; try { file.SaveAs(Server.MapPath(filepath)); return Json(new { state = true, url = filepath }); } catch (Exception ex) { return Json(new { state = false, url = "", msg = ex.Message }); } } else { return Json(new { state = false, url = "", msg = "没有文件" }); } } #endregion #region 体检项目组合 by:zlf date:2017-06-14 public ActionResult TjfanganZuhe() { ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); return View(); } public JsonResult getEnableYhysLb(string key) { var result = new HarmfulFactorsTypeMaintainBll().getList(1, 10000, key); return Json(new { Rows = result }); } //main_suggestions(检项目组合维护_ 处理建议) public JsonResult getmain_suggestions(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new main_suggestionsBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult main_suggestionsMessage(string id, string jobsid, string harmfulid) { main_suggestionsModel model; if (string.IsNullOrEmpty(id)) { model = new main_suggestionsModel() { assessed_id = Convert.ToInt32(jobsid), harmful_id = Convert.ToInt32(harmfulid) }; } else { model = new main_suggestionsBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult main_suggestionsMessage(main_suggestionsModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } main_suggestionsBll bll = new main_suggestionsBll(); return Json(bll.save(model)); } public JsonResult delmain_suggestions(string id) { main_suggestionsBll bll = new main_suggestionsBll(); return Json(bll.delete(id)); } //summaryreport_factor_symptom(检项目组合维护_重点询问) public JsonResult getsummaryreport_factor_symptom(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new summaryreport_factor_symptomBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult summaryreport_factor_symptomMessage(string id, string jobsid, string harmfulid) { summaryreport_factor_symptomModel model; if (string.IsNullOrEmpty(id)) { model = new summaryreport_factor_symptomModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new summaryreport_factor_symptomBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult summaryreport_factor_symptomMessage(summaryreport_factor_symptomModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } summaryreport_factor_symptomBll bll = new summaryreport_factor_symptomBll(); return Json(bll.save(model)); } public JsonResult delsummaryreport_factor_symptom(string id) { summaryreport_factor_symptomBll bll = new summaryreport_factor_symptomBll(); return Json(bll.delete(id)); } //summaryreport_factor_important(检项目组合维护_重点病史) public JsonResult getsummaryreport_factor_important(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new summaryreport_factor_importantBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult summaryreport_factor_importantMessage(string id, string jobsid, string harmfulid) { summaryreport_factor_importantModel model; if (string.IsNullOrEmpty(id)) { model = new summaryreport_factor_importantModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new summaryreport_factor_importantBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult summaryreport_factor_importantMessage(summaryreport_factor_importantModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } summaryreport_factor_importantBll bll = new summaryreport_factor_importantBll(); return Json(bll.save(model)); } public JsonResult delsummaryreport_factor_important(string id) { summaryreport_factor_importantBll bll = new summaryreport_factor_importantBll(); return Json(bll.delete(id)); } //summaryreport_standard_factor(检项目组合维护_职业病诊断标准) public JsonResult getsummaryreport_standard_factor(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new summaryreport_standard_factorBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult summaryreport_standard_factorMessage(string id, string jobsid, string harmfulid) { ViewData["zybzdbz"] = new SelectList(new SummaryreportStandardMaintainBll().GetAllList("", "是"), "id", "standard_name"); summaryreport_standard_factorModel model; if (string.IsNullOrEmpty(id)) { model = new summaryreport_standard_factorModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new summaryreport_standard_factorBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult summaryreport_standard_factorMessage(summaryreport_standard_factorModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["zybzdbz"] = new SelectList(new SummaryreportStandardMaintainBll().GetAllList("", "是"), "id", "standard_name"); return View(model); } summaryreport_standard_factorBll bll = new summaryreport_standard_factorBll(); return Json(bll.save(model)); } public JsonResult delsummaryreport_standard_factor(string id) { summaryreport_standard_factorBll bll = new summaryreport_standard_factorBll(); return Json(bll.delete(id)); } public string getstandard_number(string id) { return (new SummaryreportStandardMaintainBll().GetAllList(id, "是").First().standard_number); } //notice_factor_maintain(检项目组合维护_业务提醒) public JsonResult getnotice_factor_maintain(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new notice_factor_maintainBll(); var result = dal.GetAllList(jobsid, harmfulid,null); return Json(new { Rows = result }); } public ActionResult notice_factor_maintainMessage(string id, string jobsid, string harmfulid) { ViewData["team"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); notice_factor_maintainModel model; if (string.IsNullOrEmpty(id)) { model = new notice_factor_maintainModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new notice_factor_maintainBll().GetAllList(id, "", "").First(); } return View(model); } /// /// 保存提醒内容与危害因素关联关系 /// /// /// [HttpPost] public ActionResult notice_factor_maintainMessage(notice_factor_maintainModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["team"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); return View(model); } notice_factor_maintainBll bll = new notice_factor_maintainBll(); return Json(bll.save(model)); } public JsonResult delnotice_factor_maintain(string id) { notice_factor_maintainBll bll = new notice_factor_maintainBll(); return Json(bll.delete(id)); } //target_factor_maintain(检项目组合维护_疑似职业病) public JsonResult gettarget_factor_maintain(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new target_factor_maintainBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult target_factor_maintainMessage(string id, string jobsid, string harmfulid) { ViewData["yszyb"] = new SelectList(new TargetDiseaseMaintainBll().GetAllList2(), "id", "disease_name"); target_factor_maintainModel model; if (string.IsNullOrEmpty(id)) { model = new target_factor_maintainModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new target_factor_maintainBll().GetAllList(id, "", "").First(); } return View(model); } public string getdisease_code(string id) { return (new TargetDiseaseMaintainBll().GetAllList(id).First().code); } [HttpPost] public ActionResult target_factor_maintainMessage(target_factor_maintainModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["yszyb"] = new SelectList(new TargetDiseaseMaintainBll().GetAllList2(), "id", "disease_name"); return View(model); } target_factor_maintainBll bll = new target_factor_maintainBll(); return Json(bll.save(model)); } public JsonResult deltarget_factor_maintain(string id) { target_factor_maintainBll bll = new target_factor_maintainBll(); return Json(bll.delete(id)); } //project_factor_maintain(体检项目组合维护_体检项目) public JsonResult getproject_factor_maintain(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new project_factor_maintainBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult project_factor_maintainMessage(string id, string jobsid, string harmfulid) { var al = new List() { new Droplist { Value = "是", Title = "是" }, new Droplist { Value = "否", Title = "否" } }; ViewData["ischeck"] = new SelectList(al, "Value", "Title"); ViewData["tjxm"] = new SelectList(new ExamProjectMaintainBll().GetAllList(""), "id", "project_name"); project_factor_maintainModel model; if (string.IsNullOrEmpty(id)) { model = new project_factor_maintainModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid), is_goal = "否", factor_code=new HarmfulFactorsMaintainBll().getfactor_code(harmfulid) }; } else { model = new project_factor_maintainBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult project_factor_maintainMessage(project_factor_maintainModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List() { new Droplist { Value = "是", Title = "是" }, new Droplist { Value = "否", Title = "否" } }; ViewData["ischeck"] = new SelectList(al, "Value", "Title"); ViewData["tjxm"] = new SelectList(new ExamProjectMaintainBll().GetAllList(""), "id", "project_name"); return View(model); } project_factor_maintainBll bll = new project_factor_maintainBll(); return Json(bll.save(model)); } public string getproject_id(string id) { var mode = new ExamProjectMaintainBll().GetAllList(id).First(); return (mode.project_id + "|" + mode.project_name + "|" + mode.exam_group_maintain_id + "|" + mode.exam_group); } public string getteam_name(string id) { return (new ExamProjectMaintainBll().GetAllList(id).First().exam_group); } public JsonResult delproject_factor_maintain(string id) { project_factor_maintainBll bll = new project_factor_maintainBll(); return Json(bll.delete(id)); } //contraindicat_factor_maintain(体检项目组合维护_职业禁忌) public JsonResult getcontraindicat_factor_maintain(string jobsid, string harmfulid) { if (string.IsNullOrEmpty(jobsid) || string.IsNullOrEmpty(harmfulid)) return Json(null); var dal = new contraindicat_factor_maintainBll(); var result = dal.GetAllList("", jobsid, harmfulid); return Json(new { Rows = result }); } public ActionResult contraindicat_factor_maintainMessage(string id, string jobsid, string harmfulid) { ViewData["zyjj"] = new SelectList(new ContraindicatMaintainBll().GetAllList("", "是"), "id", "contraindicat_name"); contraindicat_factor_maintainModel model; if (string.IsNullOrEmpty(id)) { model = new contraindicat_factor_maintainModel() { jobs_state_maintain_id = Convert.ToInt32(jobsid), harmful_factors_type_maintain_id = Convert.ToInt32(harmfulid) }; } else { model = new contraindicat_factor_maintainBll().GetAllList(id, "", "").First(); } return View(model); } [HttpPost] public ActionResult contraindicat_factor_maintainMessage(contraindicat_factor_maintainModel model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); ViewData["zyjj"] = new SelectList(new ContraindicatMaintainBll().GetAllList("", "是"), "id", "contraindicat_name"); return View(model); } contraindicat_factor_maintainBll bll = new contraindicat_factor_maintainBll(); return Json(bll.save(model)); } public JsonResult delcontraindicat_factor_maintain(string id) { contraindicat_factor_maintainBll bll = new contraindicat_factor_maintainBll(); return Json(bll.delete(id)); } public string getcontraindicat_code(string id) { return (new ContraindicatMaintainBll().GetAllList(id, "是").First().code); } #endregion #region 其他疾病维护 public ActionResult OtherDiseaseMaintain() { return View(); } public JsonResult getOtherDiseaseMaintainList(int page, int pagesize, string key) { var bll = new BLL.OtherDiseaseMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveOtherDiseaseMaintain(OtherDiseaseMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; ct.pinyin_code = HanZi2PinYin.ConvertToPinYin(ct.disease_name); return Json(new BLL.OtherDiseaseMaintainBll().save(ct, user)); } /// /// 根据id删除其他疾病 /// /// /// public JsonResult delOtherDisease(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.OtherDiseaseMaintainBll().delOtherDisease(id)); } #endregion #region 其他疾病维护 public ActionResult SummaryreportSuggestMaintain() { return View(); } public JsonResult getSummaryreportSuggestMaintainList(int page, int pagesize, string key) { var bll = new BLL.SummaryreportSuggestMaintainBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } public JsonResult saveSummaryreportSuggestMaintain(SummaryreportSuggestMaintainModel ct) { var user = Session["loginUser"] as Models.ERPUser; ct.pinyin_code = HanZi2PinYin.ConvertToPinYin(ct.opinion_and_suggest); return Json(new BLL.SummaryreportSuggestMaintainBll().save(ct, user)); } /// /// 根据id删除总结报告处理意见及建议 /// /// /// public JsonResult delSummaryreportSuggest(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.SummaryreportSuggestMaintainBll().delSummaryreportSuggest(id)); } #endregion #region 体检症状维护 public ActionResult SymptomsMaintain() { return View(); } public JsonResult GetSymptomsMaintainResultAll(int page, int pagesize) { var dal = new SymptomsMaintainDal(); int count = dal.getCount(""); //string modelslistjson = JsonConvert.SerializeObject(dal.GetAllList("", page, pagesize)); return Json(new { Total = count, Rows = dal.GetAllList("", page, pagesize) }); } [HttpGet] public ActionResult EditSymptomsMaintain(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new SymptomsMaintainDal(); if (id != "") { var model = bll.GetAllListN(id, "").First(); var viewModel = new DictionariesViewModel.SymptomsMaintain { code = model.code, symptoms_name = model.symptoms_name, symptoms_type = model.symptoms_type, default_status = model.default_status, pinyin_code = model.pinyin_code, create_time = model.create_time, creator = model.creator, status = model.status, }; ViewData["Categories"] = new SelectList(al, "Value", "Title", viewModel.status); return View(viewModel); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditSymptomsMaintain(DictionariesViewModel.SymptomsMaintain model) { ModelState.Remove("Id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(model); } SymptomsMaintainBll bll = new SymptomsMaintainBll(); SymptomsMaintainModel dtomodel = new SymptomsMaintainModel { id = model.id, create_time = DateTime.Now.ToString(), status = model.status, creator = model.creator, code = model.code, default_status = model.default_status, symptoms_name = model.symptoms_name, pinyin_code = model.pinyin_code }; var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) dtomodel.creator = erpUser.UserName; //修改 var f = false; f = model.id != 0 ? bll.Update(dtomodel) : bll.Add(dtomodel); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除体检症状 /// /// /// public JsonResult delSymptomsMaintain(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.SymptomsMaintainBll().delSymptomsMaintain(id)); } #endregion #region 评价主检 public ActionResult EvaluateMainCheck() { return View(); } public JsonResult getProfessionMainAdviceMaintainistAllList() { var bll = new BLL.ProfessionMainAdviceMaintainBll(); List ctList = bll.GetAllList("", "是"); return Json(new { Rows = ctList }); } public JsonResult GetProfessionalExamRegister(FormCollection data) { var dal = new ProfessionalExamRegisterDal(); Criteria model = new Criteria(); DateTime ru; //登记开始日期 DateTime.TryParse(data["startdate"].Substring(0, 15), out ru); model.startDate = ru.ToString("yyyy-MM-dd"); //登记截至日期 DateTime.TryParse(data["enddate"].Substring(0, 15), out ru); model.endDate = ru.ToString("yyyy-MM-dd"); //体检开始日期 if (data["checkstart"] != null && data["checkstart"] != "") { DateTime.TryParse(data["checkstart"].Substring(0, 15), out ru); model.checkstartDate = ru.ToString("yyyy-MM-dd"); } //体检截至日期 if (data["checkend"] != null && data["checkend"] != "") { DateTime.TryParse(data["checkend"].Substring(0, 15), out ru); model.checkendDate = ru.ToString("yyyy-MM-dd"); } //主检医生审核 model.result_status = data["zjyssh"]; model.person_name = data["person_name"]; model.physical_num = data["physical_num"]; //体检类型 model.check_type = data["exam_type"]; List list = dal.GetAllList(model); List result = new List(); foreach (var item in list) { var modelinfo = new ResgisterPJZJViewModel(); modelinfo.id = item.id; modelinfo.physical_num = item.physical_num; modelinfo.person_name = item.person_name; modelinfo.hazard_ids = item.hazard_ids; modelinfo.job_status_id = item.job_status_id.ToString(); result.Add(modelinfo); } return Json(new { Rows = result }); } //id: row.id, person_id: row.person_id, project_id: row.project_id public string getyx(int id,int person_id,string project_id) { var bll = new BLL.ExamProjectMaintainBll(); var projects= bll.GetAllListByprojectid(project_id); if(projects.Count==0) { return Newtonsoft.Json.JsonConvert.SerializeObject( new {State=0,Message="没有找到项目!"}); } if(projects[0].special_conf!="拍片") { return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "项目没有影像!" }); } List listsCC = new professionalExamProjectResultImgsBll().getCaiChaoInfo(id); //MemoryStream ims = new MemoryStream(); List imageBase64 = new List(); listsCC.ForEach(item => { //Image img = Image.FromFile(Server.MapPath(item.img_path)); //img.Save(ims, ImageFormat.Jpeg); //byte[] arr = new byte[ims.Length]; ims.Position = 0; //ims.Read(arr, 0, (int)ims.Length); if (item.img_type == "原始图片") { // 根据路径获取base64图片 imageBase64.Add(item.img_path); } }); if(imageBase64.Count==0) { return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "项目没有影像!" }); } else { return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "获取照片成功!",path=imageBase64[0] }); } } public string GetProfessionalExamResult(string id) { if (string.IsNullOrEmpty(id)) return null; var bllt = new professionalExam_project_resultBll(); var result1 = bllt.getPersonResult(id, ""); string modelslistjson = JsonConvert.SerializeObject(result1); return "{\"Rows\":" + modelslistjson + "}"; } public string GetProfessionalExamRegistOne(string id) { if (string.IsNullOrEmpty(id)) return null; var bll = new ProfessionalExamRegisterBll(); var result = bll.getOne(id); string modelslistjson = JsonConvert.SerializeObject(result); return "{\"one\":" + modelslistjson + "}"; } [HttpPost] public JsonResult SubmitProfessionalExamRegister(FormCollection data) { Models.ERPUser user = Session["loginUser"] as Models.ERPUser; ProfessionalExamRegisterModel model = new ProfessionalExamRegisterModel(); model.id = data["id"]; model.main_user_id = user.ID.ToString(); model.main_user_name = user.TrueName; model.main_review_date = DateTime.Now.ToString("yyyy-MM-dd"); model.resultids = data["resultids"]; model.otherProject = data["otherProject"]; model.fujianProject = data["fujianProject"]; model.zhiyeProject = data["zhiyeProject"]; model.yisiProject = data["yisiProject"]; model.procedure_status = data["produre_status"]; model.main_review = data["main_review"]; //?????未生效???? model.main_result = data["main_result"]; model.result_status = data["result_status"]; model.handle_advise = data["handle_advise"]; //2023-10-23 xulu 添加一般人群主检结论及建议 model.common_advise = data["common_advise"]; model.common_result = data["common_result"]; //2024-01-24 xulu 添加体检结果 model.check_result = data["check_result"]; ProfessionalExamRegisterBll bll = new ProfessionalExamRegisterBll(); bool f = bll.modify(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据physical_num_old获取复检记录 /// 2023-12-12 xulu /// /// /// public JsonResult GetfjModel(string strNum) { return Json(new { data = new BLL.ProfessionalExamRegisterBll().GetfjModel(strNum) }) ; } /// /// 根据physical_num_old删除体检记录 /// 2023-12-12 xulu /// /// /// public JsonResult deleteFJ(string strNum) { bool f = new BLL.ProfessionalExamRegisterBll().delete(strNum); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } public ActionResult PMAMT() { return View(); } public ActionResult FJTJXZ() { return View(); } public JsonResult GetAllListJYitems() { List list = new ExamGroupMaintainDal().GetAllListJY("否"); return Json(new { Rows = list }); } public JsonResult GetAllListJY() { List list = new ExamGroupMaintainDal().GetAllListJY("否"); return Json(new { Rows = list }); } public JsonResult GetGroupList(string id) { List list = new ExamGroupMaintainDal().GetGroupList(id); return Json(new { Rows = list }); } [HttpGet] public bool ReturnProfessionalExamRegister(string id) { if (string.IsNullOrEmpty(id)) return false; var bll = new ProfessionalExamRegisterBll(); var result = bll.op(id, "8", "目前未见异常,其他疾病或异常,疑似职业病,职业禁忌证", "本次所检项目未见明显异常", Session["loginUser"] as Models.ERPUser); return result; } //--意见 public ActionResult getYJ() { return View(); } public string getYJData(string personid) { if (string.IsNullOrEmpty(personid)) return null; var dal = new professionalExam_project_resultDal(); Criteria model = new Criteria(); model.person_name = personid; var result1 = dal.queryyj(model); string modelslistjson = JsonConvert.SerializeObject(result1); return "{\"Rows\":" + modelslistjson + "}"; } public string GetCheckTypeMaintain(string belong) { checktypemaintainBll bll = new checktypemaintainBll(); List list = bll.GetListBybelong(belong); string modelslistjson = JsonConvert.SerializeObject(list); return modelslistjson; } public ActionResult tingyu() { return View(); } #region 绑定电测听 public String getty(string ids) { List list = new ProfessionalExamRegisterBll().getAllByIds(ids); List listtwo = new ProfessionalExamRegisterBll().getTjjg(ids); DataTable tjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(listtwo)); List listthree = new ThresholdDeviationMaintainBll().GetAllList("", "是"); DataTable thresholdDt = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(listthree)); TingYuModel tym = GetTingyu(list[0].person_age.ToString(), list[0].sex, tjjgDt, thresholdDt); string modelslistjson = JsonConvert.SerializeObject(tym); return modelslistjson; } public TingYuModel GetTingyu(string nl, string sex, DataTable tjjg, DataTable thresholdDt) { //结果 int left500 = 0; int left1000 = 0; int left2000 = 0; int left3000 = 0; int left4000 = 0; int left6000 = 0; int right500 = 0; int right1000 = 0; int right2000 = 0; int right3000 = 0; int right4000 = 0; int right6000 = 0; //偏差值 int left500_deviation = 0; int left1000_deviation = 0; int left2000_deviation = 0; int left3000_deviation = 0; int left4000_deviation = 0; int left6000_deviation = 0; int right500_deviation = 0; int right1000_deviation = 0; int right2000_deviation = 0; int right3000_deviation = 0; int right4000_deviation = 0; int right6000_deviation = 0; //双耳高频平均听阈(dB) int srgppjty = 0; //左耳平均听阈 int left_pjty = 0; //右耳平均听阈 int right_pjty = 0; //结果 left500 = Convert.ToInt32(tjjg.Select("project_id=11324").Length > 0 ? tjjg.Select("project_id=11324")[0]["project_result"].ToString() : "0"); //左耳500Hz left1000 = Convert.ToInt32(tjjg.Select("project_id=11326").Length > 0 ? tjjg.Select("project_id=11326")[0]["project_result"].ToString() : "0"); //左耳1000Hz left2000 = Convert.ToInt32(tjjg.Select("project_id=11328").Length > 0 ? tjjg.Select("project_id=11328")[0]["project_result"].ToString() : "0"); //左耳2000Hz left3000 = Convert.ToInt32(tjjg.Select("project_id=11330").Length > 0 ? tjjg.Select("project_id=11330")[0]["project_result"].ToString() : "0"); //左耳3000Hz left4000 = Convert.ToInt32(tjjg.Select("project_id=11332").Length > 0 ? tjjg.Select("project_id=11332")[0]["project_result"].ToString() : "0"); //左耳4000Hz left6000 = Convert.ToInt32(tjjg.Select("project_id=11334").Length > 0 ? tjjg.Select("project_id=11334")[0]["project_result"].ToString() : "0"); //左耳6000Hz right500 = Convert.ToInt32(tjjg.Select("project_id=11325").Length > 0 ? tjjg.Select("project_id=11325")[0]["project_result"].ToString() : "0"); //右耳500Hz right1000 = Convert.ToInt32(tjjg.Select("project_id=11327").Length > 0 ? tjjg.Select("project_id=11327")[0]["project_result"].ToString() : "0"); //右耳1000Hz right2000 = Convert.ToInt32(tjjg.Select("project_id=11329").Length > 0 ? tjjg.Select("project_id=11329")[0]["project_result"].ToString() : "0"); //右耳2000Hz right3000 = Convert.ToInt32(tjjg.Select("project_id=11331").Length > 0 ? tjjg.Select("project_id=11331")[0]["project_result"].ToString() : "0"); //右耳3000Hz right4000 = Convert.ToInt32(tjjg.Select("project_id=11333").Length > 0 ? tjjg.Select("project_id=11333")[0]["project_result"].ToString() : "0"); //右耳4000Hz right6000 = Convert.ToInt32(tjjg.Select("project_id=11335").Length > 0 ? tjjg.Select("project_id=11335")[0]["project_result"].ToString() : "0"); //右耳6000Hz //偏差值 left500_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=424 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=424 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳500Hz left1000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=426 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=426 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳1000Hz left2000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=428 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=428 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳2000Hz left3000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=430 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=430 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳3000Hz left4000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=432 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=432 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳4000Hz left6000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=434 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=434 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //左耳6000Hz right500_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=425 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=425 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳500Hz right1000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=427 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=427 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳1000Hz right2000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=429 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=429 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳2000Hz right3000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=431 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=431 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳3000Hz right4000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=433 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=433 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳4000Hz right6000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=435 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "").Length > 0 ? thresholdDt.Select("exam_project_maintain_id=435 and sex='" + sex + "' and age_lower<=" + nl + " and age_upper>=" + nl + "")[0]["deviation_value"].ToString() : "0"); //右耳6000Hz //计算 双耳高频平均听阈(dB)=(左耳3000Hz+左耳4000Hz+左耳6000Hz + 右耳3000Hz+右耳4000Hz+右耳6000Hz)/6 //双耳高频平均听阈 = 【(85-4)+(80-4)+(85-6)+(90-4)+(85-4)+(90-6)】/6 srgppjty = ((left3000 - left3000_deviation) + (left4000 - left4000_deviation) + (left6000 - left6000_deviation) + (right3000 - right3000_deviation) + (right4000 - right4000_deviation) + (right6000 - right6000_deviation)) / 6; //计算 左耳平均听阈=(500Hz+1000Hz+2000Hz+3000Hz)/4 //单耳平均听阈 左耳:【(85 - 2)+(85 - 2)+(85 - 3)+(85 - 4)】/ 4 left_pjty = ((left500 - left500_deviation) + (left1000 - left1000_deviation) + (left2000 - left2000_deviation) + (left3000 - left3000_deviation)) / 4; //计算 右耳平均听阈=(500Hz+1000Hz+2000Hz+3000Hz)/4 //单耳平均听阈 右耳:【(90 - 2)+(90 - 2)+(90 - 3)+(90 - 4)】/ 4 right_pjty = ((right500 - right500_deviation) + (right1000 - right1000_deviation) + (right2000 - right2000_deviation) + (right3000 - right3000_deviation)) / 4; TingYuModel tym = new TingYuModel(); tym.left500 = left500; tym.left1000 = left1000; tym.left2000 = left2000; tym.left3000 = left3000; tym.left4000 = left4000; tym.left6000 = left6000; tym.right500 = right500; tym.right1000 = right1000; tym.right2000 = right2000; tym.right3000 = right3000; tym.right4000 = right4000; tym.right6000 = right6000; tym.left500_deviation = left500_deviation; tym.left1000_deviation = left1000_deviation; tym.left2000_deviation = left3000_deviation; tym.left3000_deviation = left3000_deviation; tym.left4000_deviation = left4000_deviation; tym.left6000_deviation = left6000_deviation; tym.right500_deviation = right500_deviation; tym.right1000_deviation = right1000_deviation; tym.right2000_deviation = right2000_deviation; tym.right3000_deviation = right3000_deviation; tym.right4000_deviation = right4000_deviation; tym.right6000_deviation = right6000_deviation; tym.right_pjty = right_pjty; tym.srgppjty = srgppjty; tym.left_pjty = left_pjty; return tym; } #endregion public ActionResult Outjianyi() { return View(); } public string GetOutjianyiAll(string physical_num, string harmful_id, string assessed_id) { var dal = new main_suggestionsDal(); main_suggestionsModel model = new main_suggestionsModel(); var result1 = dal.GetOutjianyiAll(physical_num, harmful_id, assessed_id); string modelslistjson = JsonConvert.SerializeObject(result1); return "{\"Rows\":" + modelslistjson + "}"; } /// /// 根据personid查询其体检小组列表 /// /// /// public ActionResult getTjxm(string id) { //ViewData["team"] = new SelectList(new ExamGroupMaintainBll().GetAllListTrue(""), "id", "team_name"); ViewData["team"] = new SelectList(new ExamGroupMaintainDal().GetGroupListByPersonId(id), "id", "team_name"); return View(Convert.ToInt32(id)); } #endregion #region 人员类别维护 public ActionResult PersonType() { return View(); } public JsonResult GetPersonType() { var list = new BLL.PersonTypeMaintainBll().GetAllList("", ""); return Json(new { Total = list.Count, Rows = list }); } public ActionResult EditPersonType(string id) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); var bll = new PersonTypeMaintainBll(); if (id != "") { var model = bll.GetAllList(id, "").First(); ViewData["Categories"] = new SelectList(al, "Value", "Title", model.status); return View(model); } else { ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(); } } [HttpPost] public ActionResult EditPersonType(Models.PersonTypeMaintainModel pt) { pt.pinyin_code = ZWL.Common.HanZi2PinYin.ConvertToPinYin(pt.type_name); ModelState.Remove("id"); if (!ModelState.IsValid) { var al = new List(); var model1 = new Droplist { Value = "否", Title = "否" }; var model2 = new Droplist { Value = "是", Title = "是" }; al.Add(model1); al.Add(model2); ViewData["Categories"] = new SelectList(al, "Value", "Title"); return View(pt); } var bll = new PersonTypeMaintainBll(); var erpUser = Session["loginUser"] as Models.ERPUser; if (erpUser != null) { pt.creator = erpUser.UserName; pt.create_time = DateTime.Now.ToString("yyyy-MM-dd"); } //修改 var f = false; f = pt.id != 0 ? bll.Update(pt) : bll.Add(pt); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } /// /// 根据id删除人员类别 /// /// /// public JsonResult delPersonType(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.PersonTypeMaintainBll().delPersonType(id)); } #endregion #region 打印机设置 public ActionResult PrinterSetting() { return View(); } #endregion #region 接种免疫条码打印 public ActionResult JZMYTMView(string id) { if (!string.IsNullOrEmpty(id)) { string[] ids = id.Split('|'); ViewBag.viewno = ids[1]; if (ids[0] != null && ids[0] != "") { var bll = new BLL.JiezhongmianyitiaomaModelBll(); List ctList = bll.getList(ids[0]); ViewData["id"] = ctList.FirstOrDefault().id; ViewData["barcode"] = ctList.FirstOrDefault().barcode; ViewData["username"] = ctList.FirstOrDefault().username; ViewData["sjh"] = ctList.FirstOrDefault().sjh; ViewData["csrq"] = ctList.FirstOrDefault().csrq.ToString("yyyy-MM-dd"); ViewData["jdid"] = ctList.FirstOrDefault().jdid; ViewData["save"] = "保存"; } } else { ViewData["csrq"] = DateTime.Now.ToString("yyyy-MM-dd"); ViewData["save"] = "打印"; } ViewBag.jdList = new SelectList(new ym_jzlcBll().getAllYMJDList(), "id", "name"); return View(); } public JsonResult getJZMYTM(string id) { ViewBag.jdList = new SelectList(new ym_jzlcBll().getAllYMJDList(), "id", "name"); var bll = new BLL.JiezhongmianyitiaomaModelBll(); List ctList = bll.getList(id); if (ctList.Count > 0) { return Json(new { obj = ctList[0] }); } else { return Json(new { obj = "" }); } } public JsonResult saveJZMYTM(FormCollection data) { Models.ERPUser user = Session["loginUser"] as Models.ERPUser; JiezhongmianyitiaomaModel model = new JiezhongmianyitiaomaModel(); model.id = 0; int rid = 0; if (int.TryParse(data["id"], out rid)) { model.id = rid; } //model.id =Convert.ToInt32(data["id"]); model.barcode = data["barcode"]; model.username = data["username"]; model.sjh = data["sjh"]; model.csrq = Convert.ToDateTime(data["csrq"]); model.jdid = Convert.ToInt32(data["jdid"]); JiezhongmianyitiaomaModelBll bll = new JiezhongmianyitiaomaModelBll(); object f = bll.save(model); return Json(new { f }); } public JsonResult delJZMYTM(string id) { Models.ERPUser user = Session["loginUser"] as Models.ERPUser; JiezhongmianyitiaomaModel model = new JiezhongmianyitiaomaModel(); model.id = 0; int rid = 0; if (int.TryParse(id, out rid)) { model.id = rid; } JiezhongmianyitiaomaModelBll bll = new JiezhongmianyitiaomaModelBll(); object f = bll.del(model); return Json(f); } public ActionResult jiezhongmianyitiaoma() { return View(); } public JsonResult getjzmytmlist(int page, int pagesize, string key) { var bll = new BLL.JiezhongmianyitiaomaModelBll(); int count = bll.getCount(key); List ctList = bll.getList(page, pagesize, key); return Json(new { Total = count, Rows = ctList }); } [HttpGet] public ActionResult editjiezhongmianyitiaoma(string id) { if (id != "0") { OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel model = bll.GetModel(id); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var tjxmViewModel = AutoMapper.Mapper.Map(model); ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjxmViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjxmViewModel.check_type_maintain_id); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name", tjxmViewModel.util_id); tjxmViewModel.harmful_factors_maintain_id = (!string.IsNullOrEmpty(tjxmViewModel.harmful_factors_maintain_id)) ? tjxmViewModel.harmful_factors_maintain_id.TrimEnd(',').TrimStart(',') : ""; return View(tjxmViewModel); } else { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type"); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); ViewData["sitelist"] = new SelectList(new EnterpriceInfoMaintainBll().GetAllList(""), "id", "enterprise_name"); return View(); } } [HttpPost] public ActionResult editjiezhongmianyitiaoma(TjfnViewModel tjfnViewModel) { ModelState.Remove("id"); if (!ModelState.IsValid) { ViewData["TypeList"] = new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type", tjfnViewModel.check_type_maintain_id); ViewData["zgzt"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state", tjfnViewModel.jobs_state_maintain_id); return View(tjfnViewModel); } OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll(); OccupationExamSchemeMaintainModel dtomodel = new OccupationExamSchemeMaintainModel(); AutoMapper.Mapper.Initialize( x => x.CreateMap()); var dtotjjg = AutoMapper.Mapper.Map(tjfnViewModel); dtotjjg.scheme_type = "通用"; //修改 var f = false; f = tjfnViewModel.id != 0 ? bll.Update(dtotjjg) : bll.Add(dtotjjg); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } #endregion #region 登陆 [AllowAnonymous] public ActionResult LoginView() { return View(); } [AllowAnonymous] public FileResult ValidateCode() { ValidateCode vc = new ValidateCode(); string code = vc.CreateValidateCode(4); Session["ValidateCode"] = code; return File(vc.CreateValidateGraphic(code), "image/jpeg"); } [AllowAnonymous] public ActionResult login(FormCollection fc) { string code = fc["yzm"]; if (Session["ValidateCode"] != null && Session["ValidateCode"].ToString().ToLower() != code.ToLower()) { ViewBag.Success = false; ViewBag.Message = "验证码错误!"; return View("LoginView"); } EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); EnterpriceInfoMaintainModel model = bll1.GetLoginMessage(fc["uname"]); if (model == null) { ViewBag.Success = false; ViewBag.Message = "用户名不存在或密码错误!"; return View("LoginView"); } if (!model.loginpwd.Equals(fc["pwd"])) { ViewBag.Success = false; ViewBag.Message = "用户名不存在或密码错误!"; return View("LoginView"); } Session["QYID"] = model.id; Session["QYLOGINUSER"] = model; return RedirectToAction("TJYUYUE"); } [AllowAnonymous] public ActionResult TJYUYUE() { try { var dlxx = Session["QYLOGINUSER"] as EnterpriceInfoMaintainModel; ViewBag.realname = dlxx.loginname; return View(); } catch (Exception e) { Session["QYLOGINUSER"] = null; return RedirectToAction("LoginView"); } } [AllowAnonymous] public JsonResult LoginOut() { Session["QYLOGINUSER"] = null; return Json(new { State = 1, Message = "退出成功!" }); } [AllowAnonymous] public ActionResult TJYYLB() { return View(); } [AllowAnonymous] public ActionResult TJYYDJ() { ViewData["ZGZT"] = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state"); return View(); } [AllowAnonymous] public ActionResult xgmm() { return View(); } [HttpPost] [AllowAnonymous] public JsonResult xgmm(string ymm, string xmm) { var gly = Session["QYLOGINUSER"] as Models.EnterpriceInfoMaintainModel; if (gly.loginpwd == ymm) { var model = new EnterpriceInfoMaintainModel(); model.loginname = gly.loginname; model.loginpwd = xmm; model.id = gly.id; EnterpriceInfoMaintainBll bll1 = new EnterpriceInfoMaintainBll(); model = bll1.motifyObj(model); if (model != null) return Json(new { State = 1, Message = "修改密码成功!" }); return Json(new { State = 0, Message = "修改密码失败!" }); } else { return Json(new { State = 0, Message = "原来密码错误!" }); } } [AllowAnonymous] public JsonResult getAllMedicalAppointment(int page, int pagesize) { MedicalAppointment model = new MedicalAppointment(); model.QYID = Convert.ToInt32(Session["QYID"].ToString()); MedicalAppointmentBll bll = new MedicalAppointmentBll(); int count = bll.getAllMedicalAppointmentcount(model); List list = bll.getAllMedicalAppointment(page, pagesize, model); return Json(new { Total = count, Rows = list }); } [AllowAnonymous] public JsonResult saveMedicalAppointment(MedicalAppointment model) { MedicalAppointmentBll bll = new MedicalAppointmentBll(); model.QYID = Convert.ToInt32(Session["QYID"].ToString()); string id = bll.Add(model); if (id != null) { return Json(new { State = 1, Message = "操作成功!" }); } else { return Json(new { State = 0, Message = "操作失败!" }); } } [AllowAnonymous] public string getYHYS() { List list = new HarmfulFactorsMaintainBll().GetAllList("", "是"); string modelslistjson = JsonConvert.SerializeObject(list); return modelslistjson; } #endregion #region 疫苗接种流程 public ActionResult ymjzlc() { ViewData["vaccine"] = new SelectList(new BLL.vaccineBll().getAllList(""), "id", "name"); ViewData["ymjd"] = new SelectList(new BLL.ym_jzlcBll().getAllYMJDList(), "id", "name"); return View(); } public String GetYmJzlc(int page, int pagesize) { var bll = new BLL.ym_jzlcBll(); int count = 0; string sql = "select * from ym_jzlc"; var list = bll.getListPager(sql, null, page, pagesize, out count); return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = list }); } [HttpGet] public ActionResult EditYmJzlc(string id) { ViewData["vaccine"] = new SelectList(new BLL.vaccineBll().getAllList(""), "id", "name"); ViewData["ymjd"] = new SelectList(new BLL.ym_jzlcBll().getAllYMJDList(), "id", "name"); var bll = new BLL.ym_jzlcBll(); if (id != "") { Models.ym_jzlc model = bll.getYmJzlcModel(id); return View(model); } else { return View(); } } [HttpPost] public ActionResult EditYmJzlc(Models.ym_jzlc model) { ModelState.Remove("id"); if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors); return View(model); } var bll = new BLL.ym_jzlcBll(); //修改 var f = (model.id != 0) ? bll.Update(model) : bll.Add(model); return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } #endregion #region 疫苗维护 public ActionResult vaccine() { return View(); } public JsonResult getvaccineList(int page, int pagesize, string name, string type) { var bll = new BLL.vaccineBll(); int count = bll.getCount(name, type); List ctList = bll.getList(page, pagesize, name, type); return Json(new { Total = count, Rows = ctList }); } public JsonResult savevaccine(Models.vaccine ct) { return Json(new BLL.vaccineBll().save(ct)); } #endregion #region 特殊企业 public ActionResult specialCompany() { return View(); } public JsonResult getspecialCompanyList(int page, int pagesize, string name) { var bll = new BLL.special_companyBll(); int count = bll.getCount(name); List ctList = bll.getList(page, pagesize, name); return Json(new { Total = count, Rows = ctList }); } public JsonResult savespecialCompany(Models.special_companyModel ct) { return Json(new BLL.special_companyBll().save(ct)); } /// /// 根据id删除特殊企业 /// /// /// public JsonResult delSpecialCompany(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new BLL.special_companyBll().delSpecialCompany(id)); } #endregion #region 辖区医疗机构维护 public ActionResult org() { return View(); } public JsonResult getorglist(int page, int pagesize, string jgmc) { DAL.ordDAL dal = new ordDAL(); int c = dal.getCount(jgmc); List list = dal.getList(page, pagesize, jgmc); return Json(new { Total = c, Rows = list }); } public ActionResult org_add(string id) { var list = new List() { new Droplist { Value = "1", Title = "正常" }, new Droplist { Value = "2", Title = "禁用" } }; ViewBag.usedlist = new SelectList(list, "value", "title"); if (!string.IsNullOrEmpty(id)) { return View(new DAL.ordDAL().getM(id)); } else { return View(); } } public JsonResult saveorg(Models.PT.org o) { return Json(new DAL.ordDAL().save(o)); } /// /// 根据id删除辖区医疗机构 /// /// /// public JsonResult delORG(string id) { if (string.IsNullOrEmpty(id)) return Json(null); return Json(new DAL.ordDAL().delORG(id)); } #endregion #region 辖区街道乡镇维护 public ActionResult town() { return View(); } public ActionResult town_add(string id) { if (!string.IsNullOrEmpty(id)) { return View(new DAL.townDal().getM(id)); } else { return View(); } } public JsonResult savetown(Models.Sz_town m) { return Json(new DAL.townDal().svae(m)); } /// /// 根据街道、乡镇名称获取辖区街道乡镇列表 /// /// /// /// /// public JsonResult gettownlist(int page, int pagesize, string townname) { DAL.townDal dal = new townDal(); int c = dal.getCount(townname); List list = dal.getList(page, pagesize, townname); return Json(new { Total = c, Rows = list }); } public JsonResult town_del(string id) { return Json(new DAL.townDal().del(id)); } #endregion #region 疫苗接种流程 //public ActionResult ymjzlc() //{ // ViewData["vaccine"] = new SelectList(new BLL.vaccineBll().getAllList(""), "id", "name"); // ViewData["ymjd"] = new SelectList(new BLL.ym_jzlcBll().getAllYMJDList(), "id", "name"); // return View(); //} //public String GetYmJzlc(int page, int pagesize) //{ // var bll = new BLL.ym_jzlcBll(); // int count = 0; // string sql = "select * from ym_jzlc"; // var list = bll.getListPager(sql, null, page, pagesize, out count); // return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = list }); //} //[HttpGet] //public ActionResult EditYmJzlc(string id) //{ // ViewData["vaccine"] = new SelectList(new BLL.vaccineBll().getAllList(""), "id", "name"); // ViewData["ymjd"] = new SelectList(new BLL.ym_jzlcBll().getAllYMJDList(), "id", "name"); // var bll = new BLL.ym_jzlcBll(); // if (id != "") // { // Models.ym_jzlc model = bll.getYmJzlcModel(id); // return View(model); // } // else // { // return View(); // } //} //[HttpPost] //public ActionResult EditYmJzlc(Models.ym_jzlc model) //{ // ModelState.Remove("id"); // if (!ModelState.IsValid) // { // var errors = ModelState.Values.SelectMany(v => v.Errors); // return View(model); // } // var bll = new BLL.ym_jzlcBll(); // //修改 // var f = (model.id != 0) ? bll.Update(model) : bll.Add(model); // return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); //} #endregion #region 数据库登记表中phone_path若为base64则转换为文件并保存其路径 public ActionResult ConvertImg2File() { //获取所有的登记数据 List list = new ProfessionalExamRegisterBll().GetDataByNamePhoneIdent(null, null, null); foreach (ProfessionalExamRegisterModel item in list) { if (item.phone_path.Length > 300) { item.phone_path = ZWL.Common.ImgUtil.ConvertImg(item.phone_path); //更新数据库数据 new ProfessionalExamRegisterBll().Update(item); } } return Json(new { State = 1, Message = "操作成功!" }); } #endregion /// /// 更新登记表中的check_item_ids (暂时) /// 2023-11-22 xulu /// /// /// /// public ActionResult updateItem(string item_id, string new_id) { try { List list = new ProfessionalExamRegisterDal().getAllByItemID(item_id); foreach(ProfessionalExamRegisterModel model in list) { string check_item_ids = model.check_item_ids; string[] arr = check_item_ids.Split(','); arr = arr.Where(val => val != item_id).ToArray(); string new_check_item_ids = String.Join(",", arr); new_check_item_ids += new_id + ","; new ProfessionalExamRegisterDal().setInfo(new_check_item_ids, model.id); } return Json(new { State = 1, Message = "操作成功!" }); } catch { return Json(new { State = 0, Message = "操作失败!" }); } } /// /// 根据方案id批量更新登记表中打印项目ids /// 2023-11-22 xulu /// /// public ActionResult UpdatePrintIds(string id,int iType) { try { new ProfessionalExamRegisterDal().UpdatePrintIds(id, iType); return Json(new { State = 1, Message = "操作成功!" }); } catch { return Json(new { State = 0, Message = "操作失败!" }); } } /// /// 重置高血压 暂时 /// 2023-12-13 xulu /// /// public ActionResult resetGXY() { try { new ProfessionalExamRegisterDal().resetGXY(); return Json(new { State = 1, Message = "操作成功!" }); } catch { return Json(new { State = 0, Message = "操作失败!" }); } } } }