tijian_tieying/web/dccdc/Controllers/ResultController.cs

1002 lines
40 KiB
C#
Raw Normal View History

2025-02-20 12:14:39 +08:00
using dccdc.DAL;
using dccdc.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using ZWL.Common;
using dccdc.BLL;
using static dccdc.Models.ResultViewModels;
using System.Data;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using CYQ.Data;
using NPOI.SS.UserModel;
using System.Web.WebPages;
namespace dccdc.Controllers
{
public class ResultController : Controller
{
// GET: Dictionaries
public ActionResult Index()
{
return View();
}
public string ids;
#region
public ActionResult DanXiang(string str)
{
string[] array = str.Split(',');
ProfessionalExamRegisterModel pferm = new ProfessionalExamRegisterBll().getModel(array[0]);
var viewModel = new ResultViewModels.lishi()
{
tjbh = pferm.physical_num,
xm = pferm.person_name
};
ViewBag.sfzh = pferm.card_number;
ViewBag.xmbm = array[1];
ViewBag.pid = pferm.id;
return View(viewModel);
}
public JsonResult getDanXiang(string sfzh, string xmbm, string pid)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getDanXiang(sfzh, xmbm, pid) });
}
#endregion
#region
public ActionResult TiXing(string tmh)
{
ProfessionalExamRegisterModel pferm = new ProfessionalExamRegisterBll().getModel(tmh);
if (!string.IsNullOrEmpty(pferm.hazard_ids))
{
string hazard_ids = "";
if (pferm.hazard_ids.Length > 0)
{
string[] array = pferm.hazard_ids.Split(',');
foreach (string a in array)
{
if (a != "")
{
hazard_ids += a + ',';
}
}
hazard_ids = hazard_ids.Substring(0, hazard_ids.Length - 1);
}
ViewBag.zgzt = pferm.job_status_id;
ViewBag.yhyslbIDs = hazard_ids;
}
else
{
ViewBag.zgzt = "-1";
ViewBag.yhyslbIDs = "-1";
}
var viewModel = new ResultViewModels.lishi()
{
tjbh = pferm.physical_num,
xm = pferm.person_name
};
return View(viewModel);
}
public JsonResult getTiXing(string zgzt, string yhyslbIDs)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getTiXing(zgzt, yhyslbIDs) });
}
#endregion
#region
public ActionResult ZiLiao(string tmh)
{
ProfessionalExamRegisterModel pferm = new ProfessionalExamRegisterBll().getModel(tmh);
if (!string.IsNullOrEmpty(pferm.hazard_ids))
{
string hazard_ids = "";
if (pferm.hazard_ids.Length > 0)
{
string[] array = pferm.hazard_ids.Split(',');
if (array.Length > 0)
{
foreach (string a in array)
{
if (a != "")
{
hazard_ids += a + ',';
}
}
hazard_ids = hazard_ids.Substring(0, hazard_ids.Length - 1);
}
}
ViewBag.zgzt = pferm.job_status_id;
ViewBag.yhyslbIDs = hazard_ids;
}
else
{
ViewBag.zgzt = "-1";
ViewBag.yhyslbIDs = "-1";
}
return View();
}
/// <summary>
/// 获取职业禁忌症
/// </summary>
/// <param name="zgzt"></param>
/// <param name="yhyslbIDs"></param>
/// <returns></returns>
public JsonResult getZyjjz(string zgzt, string yhyslbIDs)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getZyjjz(zgzt, yhyslbIDs) });
}
/// <summary>
/// 获取疑似职业病
/// </summary>
/// <param name="zgzt"></param>
/// <param name="yhyslbIDs"></param>
/// <returns></returns>
public JsonResult getYszyb(string zgzt, string yhyslbIDs)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getYszyb(zgzt, yhyslbIDs) });
}
#endregion
#region
public ActionResult TJZTCX()
{
var al = new List<Droplist>();
var model1 = new Droplist
{
Value = "已采集",
Title = "已采集"
};
var model2 = new Droplist
{
Value = "已登记",
Title = "已登记"
};
var model3 = new Droplist
{
Value = "已录入检查结果",
Title = "已录入检查结果"
};
var model4 = new Droplist
{
Value = "主检医生已审核",
Title = "主检医生已审核"
};
var model5 = new Droplist
{
Value = "已打印健康证",
Title = "已打印健康证"
};
al.Add(model1);
al.Add(model2);
al.Add(model3);
al.Add(model4);
al.Add(model5);
var al1 = new List<Droplist>();
var al1model1 = new Droplist
{
Value = "男",
Title = "男"
};
var al1model2 = new Droplist
{
Value = "女",
Title = "女"
};
al1.Add(al1model1);
al1.Add(al1model2);
ViewData["xb_type_group"] = new SelectList(al1, "Value", "Title");
ViewData["tjzt"] = new SelectList(al, "Value", "Title");
var selectlist = new SelectList(new checktypemaintainBll().GetAllList("", "是"), "id", "check_type");
ViewData["check_type_maintain_group"] = selectlist;
return View();
}
/// <summary>
/// 获取体检人员状态分组信息
/// </summary>
/// <returns></returns>
public JsonResult geGroupList(Models.DTO.jglrsctj tj)
{
List<Models.DTO.tjzt> tjzt = new List<Models.DTO.tjzt>();
int ycj_count = 0;
int ydj_count = 0;
int ylrjcjg_count = 0;
int zjysysh_count = 0;
int ydyjkz_count = 0;
string ycj_nums = "";
string ydj_nums = "";
string ylrjcjg_nums = "";
string zjysysh_nums = "";
string ydyjkz_nums = "";
List<ProfessionalExamRegisterModel> perm = new BLL.ProfessionalExamRegisterBll().getPermListByGroupID(tj, Common.Global.jgid);
if (perm != null)
{
List<ProfessionalExamRegisterModel> ycj_perm = perm.Where(p => p.procedure_status == "已采集").ToList<ProfessionalExamRegisterModel>();
List<ProfessionalExamRegisterModel> ydj_perm = perm.Where(p => p.procedure_status == "已登记").ToList<ProfessionalExamRegisterModel>();
List<ProfessionalExamRegisterModel> ylrjcjg_perm = perm.Where(p => p.procedure_status == "已录入检查结果").ToList<ProfessionalExamRegisterModel>();
List<ProfessionalExamRegisterModel> zjysysh_perm = perm.Where(p => p.procedure_status == "主检医生已审核").ToList<ProfessionalExamRegisterModel>();
List<ProfessionalExamRegisterModel> ydyjkz_perm = perm.Where(p => p.procedure_status == "已打印健康证").ToList<ProfessionalExamRegisterModel>();
//整理已采集人数
if (ycj_perm != null)
{
ycj_count = ycj_perm.Count;
foreach (ProfessionalExamRegisterModel p in ycj_perm)
{
ycj_nums += p.id + ",";
}
var ycj_tjzt = new Models.DTO.tjzt
{
ztmc = "已采集",
rs = ycj_count.ToString(),
nums = ycj_nums.TrimEnd(',')
};
if (ycj_count != 0)
tjzt.Add(ycj_tjzt);
}
//整理已登记人数
if (ydj_perm != null)
{
ydj_count = ydj_perm.Count;
foreach (ProfessionalExamRegisterModel p in ydj_perm)
{
ydj_nums += p.id + ",";
}
var ydj_tjzt = new Models.DTO.tjzt
{
ztmc = "已登记",
rs = ydj_count.ToString(),
nums = ydj_nums.TrimEnd(',')
};
if (ydj_count != 0)
tjzt.Add(ydj_tjzt);
}
//整理已录入检查结果人数
if (ylrjcjg_perm != null)
{
ylrjcjg_count = ylrjcjg_perm.Count;
foreach (ProfessionalExamRegisterModel p in ylrjcjg_perm)
{
ylrjcjg_nums += p.id + ",";
}
var ylrjcjg_tjzt = new Models.DTO.tjzt
{
ztmc = "已录入检查结果",
rs = ylrjcjg_count.ToString(),
nums = ylrjcjg_nums.TrimEnd(',')
};
if (ylrjcjg_count != 0)
tjzt.Add(ylrjcjg_tjzt);
}
//整理主检医生已审核人数
if (zjysysh_perm != null)
{
zjysysh_count = zjysysh_perm.Count;
foreach (ProfessionalExamRegisterModel p in zjysysh_perm)
{
zjysysh_nums += p.id + ",";
}
var zjysysh_tjzt = new Models.DTO.tjzt
{
ztmc = "主检医生已审核",
rs = zjysysh_count.ToString(),
nums = zjysysh_nums.TrimEnd(',')
};
if (zjysysh_count != 0)
tjzt.Add(zjysysh_tjzt);
}
//整理已打印健康证人数
if (ydyjkz_perm != null)
{
ydyjkz_count = ydyjkz_perm.Count;
foreach (ProfessionalExamRegisterModel p in ydyjkz_perm)
{
ydyjkz_nums += p.id + ",";
}
var ydyjkz_tjzt = new Models.DTO.tjzt
{
ztmc = "已打印健康证",
rs = ydyjkz_count.ToString(),
nums = ydyjkz_nums.TrimEnd(',')
};
if (ydyjkz_count != 0)
tjzt.Add(ydyjkz_tjzt);
}
}
return Json(new { Rows = tjzt });
}
public JsonResult getPerList(string nums)
{
return Json(new { Rows = new BLL.ProfessionalExamRegisterBll().getPerList(nums) });
}
#endregion
#region
public ActionResult Tjxm(string id)
{
ViewBag.id = id;
return View();
}
public JsonResult getTjxm(string id)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getTjxm(id) });
}
#endregion
#region
public string Jjxp(string tmh)
{
string v = new BLL.Common().getParm_Value("jjxp", "11015", "jjxp");
return Newtonsoft.Json.JsonConvert.SerializeObject(new { msg = new BLL.ProfessionalExamRegisterBll().Jjxp(tmh, v) }); ;
}
#endregion
#region
public ActionResult LiShi(string tmh)
{
//getModel(string num)
ProfessionalExamRegisterModel pferm = new ProfessionalExamRegisterBll().getModel(tmh);
var viewModel = new ResultViewModels.lishi()
{
tjbh = pferm.physical_num,
xm = pferm.person_name
};
ViewBag.sfzh = pferm.card_number;
return View(viewModel);
}
public JsonResult getLiShi(string sfzh)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getLishi(sfzh) });
}
#endregion
#region
public ActionResult ChaLou(string id)
{
ViewBag.id = id;
ids = id;
return View();
}
public JsonResult getWJList(string id, string djrqStr, string djrqEnd)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getChaLouWJ(id, djrqStr, djrqEnd, Common.Global.jgid) });
}
public JsonResult getYJList(string id, string djrqStr, string djrqEnd)
{
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getChaLouYJ(id, djrqStr, djrqEnd, Common.Global.jgid) });
}
#endregion
#region
public class Droplist
{
public string Value { get; set; }
public string Title { get; set; }
}
/// <summary>
/// 体检结果录入页面
/// </summary>
/// <returns></returns>
public ActionResult Result_Input()
{
var al = new List<Droplist>();
var model1 = new Droplist
{
Value = "男",
Title = "男"
};
var model2 = new Droplist
{
Value = "女",
Title = "女"
};
al.Add(model1);
al.Add(model2);
ViewData["xb_type_group"] = new SelectList(al, "Value", "Title");
ViewData["check_type_maintain_group"] = new SelectList(new checktypemaintainBll().GetAllList("", "是"), "id", "check_type");
return View();
}
/// <summary>
/// 页面加载时候,根据权限获取授权项目
/// </summary>
/// <returns></returns>
public JsonResult getSqxmList()
{
string pid = "";
var erpUser = Session["loginUser"] as Models.ERPUser;
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getSQXM(erpUser, pid) });
}
/// <summary>
/// 根据体检号查询授权项目列表
/// </summary>
/// <param name="tm"></param>
/// <returns></returns>
public JsonResult getKLRXZByTm(string tm)
{
var erpUser = Session["loginUser"] as Models.ERPUser;
return Json(new { Rows = new BLL.ExamGroupDoctorMatintainBll().getSQXM(erpUser, tm) });
}
/// <summary>
/// 选择一条授权项目,获取体检人员信息
/// </summary>
/// <returns></returns>
public string getPersonList(Models.DTO.jglrsctj tj)
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Rows = new BLL.ProfessionalExamRegisterBll().getPermListByGroupID(tj, Common.Global.jgid) });
}
public string getPhoto64(string tiaoma)
{
string photo64 = new BLL.ProfessionalExamRegisterBll().getPhoto64(tiaoma);
return JsonConvert.SerializeObject(new { state = 1, data = photo64 });
}
/// <summary>
/// 上传文件
/// </summary>
/// <param name="path">默认为:CaiChaoImgs</param>
/// <returns></returns>
[HttpPost]
public string uploadfile(string path = "CaiChaoImgs")
{
var f = Request.Files[0];
string applicationPath = "file/" + path + "/" + DateTime.Now.ToString("yyMMdd") + "/";
string fileType = f.FileName.Substring(f.FileName.LastIndexOf(".") + 1);
string imgName = Guid.NewGuid().ToString() + "." + fileType;
if (!Directory.Exists(Server.MapPath("~/" + applicationPath)))
{
Directory.CreateDirectory(Server.MapPath("~/" + applicationPath));
}
// 如果类型是pdf,则转成jpg
if (fileType.ToUpper() == "PDF")
{
imgName = Guid.NewGuid().ToString() + ".jpg";
Aspose.Pdf.License l = new Aspose.Pdf.License();
l.SetLicense("");
Aspose.Pdf.Document document = new Aspose.Pdf.Document(f.InputStream);
var device = new Aspose.Pdf.Devices.JpegDevice();
FileStream fsJpg = new FileStream(Server.MapPath("~/" + applicationPath) + imgName, FileMode.OpenOrCreate);
try
{
device.Process(document.Pages[1], fsJpg);
fsJpg.Close();
}
catch (Exception ex)
{
fsJpg.Close();
System.IO.File.Delete(Server.MapPath("~/" + applicationPath) + imgName);
}
}
else
{
//新建第二个bitmap类型的bmp2变量。
f.SaveAs(Server.MapPath("~/" + applicationPath) + imgName);
}
return JsonConvert.SerializeObject(new { state = 1, msg = applicationPath + imgName });
}
[HttpPost]
public string saveResImg(ProfessionalExamProjectResultImgsModel imgInfo)
{
List<ProfessionalExamProjectResultImgsModel> list = new List<ProfessionalExamProjectResultImgsModel>();
//ProfessionalExamProjectResultImgsModel imgInfo = new ProfessionalExamProjectResultImgsModel();
imgInfo.img_type = "心电图片";
list.Add(imgInfo);
new professionalExamProjectResultImgsBll().saveResultImgs(list);
return JsonConvert.SerializeObject(new { state = 1, msg = "保存成功" });
}
/// <summary>
/// 根据分组ID和条码号获取体检结果
/// </summary>
/// <returns></returns>
public JsonResult getTjjgList(string egmId, string tmh)
{
ProfessionalExamRegisterBll bll = new BLL.ProfessionalExamRegisterBll();
List<ProfessionalExamProjectResultModel> lists = bll.getResult(egmId, tmh);
int resultId = 0;
lists.ForEach(item =>
{
if (item.special_conf == "B超" || item.special_conf == "拍片")
{
resultId = item.id;
return;
}
});
CcInfo ccInfo = new CcInfo();
if (resultId != 0)
{
List<ProfessionalExamProjectResultImgsModel> listsCC = new professionalExamProjectResultImgsBll().getCaiChaoInfo(resultId);
//MemoryStream ims = new MemoryStream();
List<string> imageBase64 = new List<string>();
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);
}
else
{
ccInfo.bgbase64 = item.img_path;
}
});
ccInfo.imageBase64 = imageBase64;
//ims.Close();
//ims.Dispose();
}
object data = new
{
data = new { Rows = lists },
CaiChaiInfo = ccInfo
};
return Json(data);
}
public string getCcImgBase64(string tmh, string specialConf)
{
ProfessionalExamRegisterBll bll = new BLL.ProfessionalExamRegisterBll();
List<ProfessionalExamProjectResultModel> lists = bll.getResult(tmh);
int resultId = 0;
foreach (var item in lists)
{
if (item.special_conf == specialConf)
{
resultId = item.id;
break;
}
}
string bgbase64 = "";
if (resultId != 0)
{
List<ProfessionalExamProjectResultImgsModel> listsCC = new professionalExamProjectResultImgsBll().getCaiChaoInfo(resultId);
MemoryStream ims = new MemoryStream();
for (int i = 0; i < listsCC.Count; i++)
{
if (listsCC[i].img_type != "原始图片")
{
Image img = Image.FromFile(Server.MapPath("~/" + listsCC[i].img_path));
img.Save(ims, ImageFormat.Jpeg);
byte[] arr = new byte[ims.Length];
ims.Position = 0;
ims.Read(arr, 0, (int)ims.Length);
// 根据路径获取base64图片
bgbase64 = Convert.ToBase64String(arr);
break;
}
}
ims.Close();
ims.Dispose();
}
return bgbase64;
}
//判断电测听项目
public JsonResult getDct(ProfessionalExamProjectResultModel tjjg)
{
//偏差值
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;
ExamProjectMaintainModel e = new ExamProjectMaintainModel();
string result = "合格";
List<ThresholdDeviationMaintainModel> tdmList = new DAL.ThresholdDeviationMaintainDal().GetAllList("", "是");
ProfessionalExamRegisterModel p = new BLL.ProfessionalExamRegisterBll().getOne(tjjg.person_id.ToString());
//2023-12-13 xulu project_id修改为project_name
switch (tjjg.project_name)
{
//case "11324"://左耳500
case "左耳500":
left500_deviation = tdmList.Find(s => s.exam_project_maintain_id == 424 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11324").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left500_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left500_deviation)
{
result = "不合格";
}
break;
//case "11326"://左耳1000
case "左耳1000":
left1000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 426 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11326").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left1000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left1000_deviation)
{
result = "不合格";
}
break;
//case "11328"://左耳2000
case "左耳2000":
left2000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 428 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11328").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left2000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left2000_deviation)
{
result = "不合格";
}
break;
//case "11330"://左耳3000
case "左耳3000":
left3000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 430 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11330").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left3000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left3000_deviation)
{
result = "不合格";
}
break;
//case "11332"://左耳4000
case "左耳4000":
left4000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 432 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11332").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left4000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left4000_deviation)
{
result = "不合格";
}
break;
//case "11334"://左耳6000
case "左耳6000":
left6000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 434 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11334").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + left6000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - left6000_deviation)
{
result = "不合格";
}
break;
//case "11325"://右耳500
case "右耳500":
right500_deviation = tdmList.Find(s => s.exam_project_maintain_id == 425 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11325").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right500_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right500_deviation)
{
result = "不合格";
}
break;
//case "11327"://右耳1000
case "右耳1000":
right1000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 427 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11327").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right1000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right1000_deviation)
{
result = "不合格";
}
break;
//case "11329"://右耳2000
case "右耳2000":
right2000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 429 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11329").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right2000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right2000_deviation)
{
result = "不合格";
}
break;
//case "11331"://右耳3000
case "右耳3000":
right3000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 431 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11331").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right3000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right3000_deviation)
{
result = "不合格";
}
break;
//case "11333"://右耳4000
case "右耳4000":
right4000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 433 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11333").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right4000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right4000_deviation)
{
result = "不合格";
}
break;
//case "11335"://右耳6000
case "右耳6000":
right6000_deviation = tdmList.Find(s => s.exam_project_maintain_id == 435 && s.sex == p.sex && s.age_lower <= p.person_age &&
s.age_upper >= p.person_age).deviation_value;
e = new ExamProjectMaintainBll().GetAllListByprojectid("11335").First();
if (Convert.ToInt32(tjjg.project_result) > Convert.ToInt32(e.max) + right6000_deviation)
{
result = "不合格";
}
if (Convert.ToInt32(tjjg.project_result) < Convert.ToInt32(e.min) - right6000_deviation)
{
result = "不合格";
}
break;
//case "11034":
//case "22818":
//case "22163"://血压
case "血压":
if (!string.IsNullOrEmpty(tjjg.project_result))
{
if (tjjg.project_result.Contains("/"))
{
result = "合格";
string[] x = tjjg.project_result.Split('/');
string[] y = tjjg.reference_value.Substring(1, tjjg.reference_value.Length - 1).ToString().Split('/');
if (Convert.ToInt32(x[0]) > Convert.ToInt32(y[0]) || Convert.ToInt32(x[0]) <= 0)
{
result = "不合格";
}
if (Convert.ToInt32(x[1]) > Convert.ToInt32(y[1]) || Convert.ToInt32(x[1]) <= 0)
{
result = "不合格";
}
}
else
{
result = "不合格";
}
}
else
{
result = "不合格";
}
break;
default:
if (tjjg.model == "定量")
{
try
{
ExamProjectMaintainModel m = new DAL.ExamProjectMaintainDal().GetAllListByprojectid(tjjg.project_id).First();
if (!string.IsNullOrEmpty(m.max) && Convert.ToDecimal(m.max) < Convert.ToDecimal(tjjg.project_result))
{
result = "不合格";
}
else if (!string.IsNullOrEmpty(m.min) && Convert.ToDecimal(m.min) > Convert.ToDecimal(tjjg.project_result))
{
result = "不合格";
}
else
{
result = "合格";
}
}
catch
{
result = "合格";
}
}
else
{
if (tjjg.project_result == tjjg.project_default)
{
result = "合格";
}
else
{
result = "不合格";
}
}
break;
}
return Json(new { result = result });
//return result;
}
/// <summary>
/// 获取项目结果参考LIST
/// </summary>
/// <returns></returns>
public JsonResult getJgckList(string project_id)
{
return Json(new { Rows = new BLL.ProfessionalExamRegisterBll().getJgckList(project_id) });
}
/// <summary>
/// 获取项目的历史结果
/// </summary>
/// <returns></returns>
public JsonResult getLsjgList(string register_date, string card_number, string project_id)
{
return Json(new { Rows = new BLL.ProfessionalExamRegisterBll().getLsjgList(register_date, card_number, project_id) });
}
#endregion
#region
/// <summary>
/// 获取项目的历史结果
/// </summary>
/// <returns></returns>
[ValidateInput(false)]
public JsonResult baocunTjjg(List<ProfessionalExamProjectResultModel> tjjglist, List<ProfessionalExamRegisterModel> personC, string is_complete, string is_entry, string pid, string egmId, CcInfo ccInfo)
{
var user = Session["loginUser"] as Models.ERPUser;
if (ccInfo != null)
{
List<ProfessionalExamProjectResultImgsModel> list = new List<ProfessionalExamProjectResultImgsModel>();
// 报告
if (!String.IsNullOrEmpty(ccInfo.bgbase64))
{
string bgbase64 = ccInfo.bgbase64;
string bgPath = bgbase64;
ProfessionalExamProjectResultImgsModel bgInfo = new ProfessionalExamProjectResultImgsModel();
bgInfo.img_type = "报告图片";
bgInfo.person_id = ccInfo.person_id;
bgInfo.project_id = ccInfo.project_id;
bgInfo.img_path = bgPath;
bgInfo.project_result_id = ccInfo.project_result_id;
list.Add(bgInfo);
}
if (null != ccInfo.imageBase64)
{
// 彩超
foreach (var item in ccInfo.imageBase64)
{
//string itemBase = item.Substring(item.IndexOf(',') + 1).Trim('\0');
string itemPath = item;
ProfessionalExamProjectResultImgsModel imgInfo = new ProfessionalExamProjectResultImgsModel();
imgInfo.img_type = "原始图片";
imgInfo.person_id = ccInfo.person_id;
imgInfo.project_id = ccInfo.project_id;
imgInfo.img_path = itemPath;
imgInfo.project_result_id = ccInfo.project_result_id;
list.Add(imgInfo);
}
}
new BLL.professionalExamProjectResultImgsBll().saveResultImgs(list);
}
return Json(new BLL.ProfessionalExamRegisterBll().baocunTjjg(tjjglist, user, personC, is_complete, pid, egmId));
}
#endregion
/// <summary>
/// 获取PACS状态
/// </summary>
/// <param name="physical_num"></param>
/// <returns></returns>
public string getpacs(string physical_num)
{
string path = new BLL.ProfessionalExamRegisterBll().getpacsstate(physical_num);
if (string.IsNullOrEmpty(path))
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "未来获取到影像信息!" });
}
else
{
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "获取影像信息成功!", filepath = path });
}
}
#region
public JsonResult chexiaoTjjg(List<ProfessionalExamProjectResultModel> tjjglist, List<ProfessionalExamRegisterModel> personC, string pid, string egmId)
{
return Json(new BLL.ProfessionalExamRegisterBll().chexiaoTjjg(tjjglist, personC, pid, egmId));
}
#endregion
#region
public JsonResult quexiangTjjg(List<ProfessionalExamProjectResultModel> tjjglist, List<ProfessionalExamRegisterModel> personC, string pid, string egmId)
{
return Json(new BLL.ProfessionalExamRegisterBll().quexiangTjjg(tjjglist, personC, pid, egmId));
}
#endregion
#region
public JsonResult mrzTjjg(List<ProfessionalExamProjectResultModel> tjjglist, List<ProfessionalExamRegisterModel> personC, string pid, string egmId)
{
return Json(new BLL.ProfessionalExamRegisterBll().mrzTjjg(tjjglist, personC, pid, egmId));
}
#endregion
#region
[ValidateInput(false)]
public JsonResult huoquTjjg(List<ProfessionalExamProjectResultModel> tjjglist, List<ProfessionalExamRegisterModel> personC, string pid, string egmId)
{
return Json(new BLL.ProfessionalExamRegisterBll().huoquTjjg(tjjglist, personC, pid, egmId));
}
#endregion
}
}