tijian_tieying/web/dccdc/Controllers/occupationExamController.cs
2025-02-20 12:14:39 +08:00

348 lines
15 KiB
C#

using dccdc.BLL;
using dccdc.Models;
using Newtonsoft.Json;
using NPOI.OpenXmlFormats.Dml;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace dccdc.Controllers
{
public class occupationExamController : Controller
{
// GET: occupationExam
public ActionResult ResultPrint()
{
ViewBag.zgzt = new SelectList(new JobsStateMaintainBll().GetAllList("", "是"), "id", "jobs_state");
ViewBag.tjlx= new SelectList(new checktypemaintainBll().GetListBybelong("职业"), "id", "check_type");
ViewBag.rylb= new SelectList(new PersonTypeMaintainBll().GetAllList("", "是"), "id", "type_name");
return View();
}
public JsonResult getQYFABySiteId(string id)
{
OccupationExamSchemeMaintainBll bll = new OccupationExamSchemeMaintainBll();
return Json(bll.GetSiteList(id));
}
public JsonResult getHGList(Models.DTO.zydytj fc)
{
var list = new BLL.ProfessionalExamRegisterBll().getZYHGList(fc);
//return Json(new { Rows = list });
//2023-11-26 xulu 修改数据量大,页面报错问题
return new JsonResult()
{
Data = new { Rows = list },
MaxJsonLength = int.MaxValue,
ContentType = "application/json"
};
}
public JsonResult getFJList(Models.DTO.zydytj fc)
{
List<ProfessionalExamRegisterModel> list = (List<ProfessionalExamRegisterModel>)new BLL.ProfessionalExamRegisterBll().getZYFJList(fc);
foreach (var item in list)
{
item.phone_path = "";
}
return Json(new { Rows = list });
}
public JsonResult getYFJList(Models.DTO.zydytj fc)
{
List<ProfessionalExamRegisterModel> list = (List<ProfessionalExamRegisterModel>)new BLL.ProfessionalExamRegisterBll().getZYYFJList(fc);
foreach (var item in list)
{
item.phone_path = "";
}
return Json(new { Rows = list });
}
[AllowAnonymous]
public JsonResult getProListByIds(string ids)
{
if (string.IsNullOrEmpty(ids))
return Json(null);
//2023-11-06 xulu 医生签名修改为电子图片
List<ProfessionalExamRegisterModel> list = new ProfessionalExamRegisterBll().getAllByIds(ids.Substring(0, ids.Length - 1));
foreach (ProfessionalExamRegisterModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation", "");
string mainUserName = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath + path) ;
model.main_user_name = mainUserName == ""? model.main_user_name: mainUserName;
}
return Json(list, JsonRequestBehavior.AllowGet);
//return Json(new ProfessionalExamRegisterBll().getAllByIds(ids.Substring(0, ids.Length - 1)), JsonRequestBehavior.AllowGet);
}
//获取复检的初始检查id
[AllowAnonymous]
public string getOriginIds(string ids)
{
if (string.IsNullOrEmpty(ids))
return "";
return new ProfessionalExamRegisterBll().getOriginIds(ids.Substring(0, ids.Length - 1));
}
//获取复检结果
[AllowAnonymous]
public JsonResult getReinspection(string physical_num_old)
{
if (string.IsNullOrEmpty(physical_num_old))
return Json(null);
return Json(new ProfessionalExamRegisterBll().getAllReinspection(physical_num_old), JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 根据id获取体检结果
/// 2024-01-24 xulu
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[AllowAnonymous]
public string getExamResultById(string id)
{
var bll = new professionalExam_project_resultBll();
List<ProfessionalExamProjectResultModel> result = bll.getPersonResult(id, "不合格");
List<Models.ExamProjectMaintainModel> projs = new DAL.ExamProjectMaintainDal().GetAllList4("");
string strResult = "";
foreach (var resultItem in result)
{
var h = projs.Where(t => t.project_id == resultItem.project_id).FirstOrDefault();
string unit = "";
if (h != null)
unit = h.unit;
strResult += resultItem.project_name + ":" + resultItem.project_result + unit + "\r\n";
}
if(string.IsNullOrEmpty(strResult))
{
strResult = "本次所检项目未见明显异常";
}
return strResult;
//return JsonConvert.SerializeObject(new occupation_reportBll().getRegisterById(id), Formatting.None);
}
[AllowAnonymous]
public JsonResult getFcTjjg(string physical_num)
{
if (string.IsNullOrEmpty(physical_num))
return Json(null);
return Json(new ProfessionalExamRegisterBll().getFcTjjg(physical_num), JsonRequestBehavior.AllowGet);
}
[AllowAnonymous]
public string getFjbhgxmList(string pid)
{
if (string.IsNullOrEmpty(pid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getFjbhgxmList(pid));
}
[AllowAnonymous]
public string getFjjyfcxmList(string physical_num_old)
{
if (string.IsNullOrEmpty(physical_num_old))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getFjjyfcxmList(physical_num_old));
}
//职业史
[AllowAnonymous]
public JsonResult getZYS(string tmh)
{
return Json(new ProfessionalExamRegisterBll().getZYS(tmh), JsonRequestBehavior.AllowGet);
}
[AllowAnonymous]
//既往病史
public JsonResult getJWBS(string tmh)
{
return Json(new ProfessionalExamRegisterBll().getJWBS(tmh), JsonRequestBehavior.AllowGet);
}
//其他的病史
[AllowAnonymous]
public JsonResult getGZS(string tmh)
{
return Json(new ProfessionalExamRegisterBll().getGZS(tmh), JsonRequestBehavior.AllowGet);
}
//获取体征的父表
[AllowAnonymous]
public string getTZPater(string person_id,string strType)
{
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getTZPater(person_id, strType));
}
//获取功能及特殊检查的父表
[AllowAnonymous]
public string getGNJTSJCPater(string person_id,string strType)
{
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getGNJTSJCPater(person_id,strType));
}
//获取化验检查的父表
[AllowAnonymous]
public string getHYJCPater(string person_id,string strType)
{
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getHYJCPater(person_id, strType));
}
/// <summary>
/// 获取体检小组
/// </summary>
/// <param name="person_id"></param>
/// <returns></returns>
[AllowAnonymous]
public string getTJXZ(string person_id)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new ProfessionalExamRegisterBll().getTJXZ(person_id));
}
//获取体检结果
[AllowAnonymous]
public JsonResult getTjjg(string person_id,string physical_num_old,string strType)
{
//2023-11-22 xulu 增加根据print_item_ids查询体检结果
List<ProfessionalExamProjectResultModel> list = new List<ProfessionalExamProjectResultModel>();
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
if (strType=="职业健康检查")
{
list = new ProfessionalExamRegisterBll().getTjjg(person_id, 1);
}
else
{
list = new ProfessionalExamRegisterBll().getTjjg(person_id, 0);
}
list = new ProfessionalExamRegisterBll().getReinspectionResult(physical_num_old,list);
return Json(list, JsonRequestBehavior.AllowGet);
}
//获取体征体检结果
[AllowAnonymous]
public JsonResult getTZTjjg(string person_id,string strType)
{
//2023-11-06 xulu 医生签名修改为电子图片
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
List<ProfessionalExamProjectResultModel> list = new ProfessionalExamRegisterBll().getTZTjjg(person_id, strType);
foreach (ProfessionalExamProjectResultModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation", "");
model.presenter = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath + path);
}
//return Json(new ProfessionalExamRegisterBll().getTZTjjg(person_id), JsonRequestBehavior.AllowGet);
return Json(list, JsonRequestBehavior.AllowGet);
}
//获取功能及特殊检查体检结果
[AllowAnonymous]
public JsonResult getGNJTSJCTjjg(string person_id,string physical_num_old,string strType)
{
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
List<ProfessionalExamProjectResultModel> list = new ProfessionalExamRegisterBll().getGNJTSJCTjjg(person_id,strType);
list = new ProfessionalExamRegisterBll().getReinspectionGNJTSJCTjjg(physical_num_old, list,strType);
//2023-11-06 xulu 医生签名修改为电子图片
foreach (ProfessionalExamProjectResultModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation", "");
model.presenter = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath + path);
}
return Json(list, JsonRequestBehavior.AllowGet);
}
//获取化验检查体检结果
[AllowAnonymous]
public JsonResult getHyTjjg(string person_id, string physical_num_old,string strType)
{
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
List<ProfessionalExamProjectResultModel> list = new ProfessionalExamRegisterBll().getHyTjjg(person_id, strType);
list = new ProfessionalExamRegisterBll().getReinspectionHyTjjg(physical_num_old, list, strType);
//2023-11-06 xulu 医生签名修改为电子图片
foreach (ProfessionalExamProjectResultModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation","");
model.presenter = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath+path);
}
return Json(list, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 根据小组名称获取groupid
/// 2023-10-11 xulu
/// </summary>
/// <param name="strNames"></param>
/// <returns></returns>
[AllowAnonymous]
public JsonResult getGroupIdByNames(string strNames)
{
return Json(new ProfessionalExamRegisterBll().getGroupIdByNames(strNames), JsonRequestBehavior.AllowGet);
}
//获取问诊的诊断医师
[AllowAnonymous]
public JsonResult getWzZdys(string person_id)
{
//2023-11-06 xulu 医生签名修改为电子图片
List<ExaminationProcessModel> list = new ProfessionalExamRegisterBll().getWzZdys(person_id);
foreach (ExaminationProcessModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation", "");
model.commit_doctor = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath + path);
//model.commit_doctor = ZWL.Common.ImgUtil.DocumentToBase64Str(model.FuJian);
}
return Json(list, JsonRequestBehavior.AllowGet);
//return Json(new ProfessionalExamRegisterBll().getWzZdys(person_id), JsonRequestBehavior.AllowGet);
}
//获取电测听的诊断医师
[AllowAnonymous]
public JsonResult getDCT_YS(string person_id)
{
//2023-11-09 zyk 医生签名修改为电子图片
List<ExaminationProcessModel> list = new ProfessionalExamRegisterBll().getDCT_YS(person_id);
foreach (ExaminationProcessModel model in list)
{
string filepath = Server.MapPath("/signation/");
string path = model.signation.Replace("signation", "");
model.commit_doctor = ZWL.Common.ImgUtil.DocumentToBase64Str(filepath + path);
//model.commit_doctor = ZWL.Common.ImgUtil.DocumentToBase64Str(model.FuJian);
}
return Json(list, JsonRequestBehavior.AllowGet);
//return Json(new ProfessionalExamRegisterBll().getWzZdys(person_id), JsonRequestBehavior.AllowGet);
}
[AllowAnonymous]
//获取听阈偏差维护表
public JsonResult getThreshold()
{
return Json(new ThresholdDeviationMaintainBll().GetAllList("","是"), JsonRequestBehavior.AllowGet);
}
public JsonResult setprint(string id)
{
return Json(new BLL.ProfessionalExamRegisterBll().setzyPrint(id));
}
/// <summary>
/// 更新登记表的print_item_ids
/// 2023-11-22 xulu
/// </summary>
/// <param name="print_ids"></param>
/// <param name="person_id"></param>
/// <returns></returns>
public JsonResult updatePrintIds(string print_ids,string person_id)
{
return Json(new BLL.ProfessionalExamRegisterBll().updatePrintIds(print_ids, person_id));
}
}
}