104 lines
4.9 KiB
C#
104 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Dapper;
|
|
using dccdc.Models;
|
|
|
|
namespace dccdc.DAL
|
|
{
|
|
public class zzjDal
|
|
{
|
|
public object getYYList(string id,int jgid)
|
|
{
|
|
//throw new NotImplementedException();
|
|
string sql = "select * from MedicalAppointment where IDCard=@IDCard and isnull(jgid,"+jgid+")="+jgid+" and ADate=@time and isnull(status,0)=0";
|
|
if(jgid!=49)
|
|
{
|
|
sql += " and CYFA<>3";
|
|
}
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|
{
|
|
List<Models.MedicalAppointment> list = conn.Query<Models.MedicalAppointment>(sql, new { IDCard=id,time=DateTime.Now.ToString("yyyy-MM-dd") }).ToList();
|
|
return list;
|
|
}
|
|
|
|
}
|
|
|
|
public OperationResult register(string id, string img, string csrq, string idcard,string jtzz,string xm,string regp)
|
|
{
|
|
string sql = "select * from MedicalAppointment where id=@id";
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|
{
|
|
var ma = conn.Query<MedicalAppointment>(sql, new { id = id }).FirstOrDefault();
|
|
if(ma==null)
|
|
{
|
|
return new OperationResult { State = 0, Message = "您的预约信息不存在!" };
|
|
}
|
|
if(ma.status!=0)
|
|
{
|
|
return new OperationResult { State = 0, Message = "您的预约信息已经登记不能重复登记!" };
|
|
}
|
|
else
|
|
{
|
|
string identityCard = idcard;
|
|
string birthday = identityCard.Substring(6, 4) + "-" + identityCard.Substring(10, 2) + "-" + identityCard.Substring(12, 2);
|
|
string sex = identityCard.Substring(14, 3);
|
|
|
|
var regdal = new DAL.ProfessionalExamRegisterDal();
|
|
ProfessionalExamRegisterModel regm = new ProfessionalExamRegisterModel();
|
|
regm.person_name = xm;
|
|
regm.jgid = ma.jgid==0?49:ma.jgid;
|
|
regm.sex=(int.Parse(sex)%2==0)?"女":"男";
|
|
regm.person_age = (int)(DateTime.Now - DateTime.Parse(birthday)).TotalDays / 365;
|
|
regm.birth = birthday;
|
|
regm.card_number = idcard;
|
|
regm.phone = ma.Mobile;
|
|
regm.native_info_maintain_id = 0;
|
|
regm.home_address = jtzz;
|
|
regm.category = ma.CYFAName;
|
|
regm.trade_type_maintain_id = ma.CYFA;
|
|
regm.physical_category = ma.CYFAName;
|
|
regm.medical_scheme_maintain_id = ma.CYFA;
|
|
regm.register_type = "正常登记";
|
|
regm.physical_way = "个人体检";
|
|
regm.register_date = DateTime.Now.ToString("yyyy-MM-dd");
|
|
regm.phone_path = img;
|
|
if (ma.CYFA == 3) {
|
|
regm.payment = (ma.ZFZT != 0) ? "已缴费" : "未缴费";
|
|
}
|
|
else
|
|
{
|
|
regm.payment = "已缴费" ;
|
|
}
|
|
regm.exam_type_id = ma.MType;
|
|
if (string.IsNullOrEmpty(regp))
|
|
regm.register_person = "自助机";
|
|
else
|
|
regm.register_person = regp;
|
|
if (ma.MType==1)
|
|
{
|
|
regm.exam_type = "从业人员体检";
|
|
regm.physical_type = "从业人员体检";
|
|
//var tjxmal = new medical_scheme_project_maintainDal().GetListBymedicalschememaintainid(ma.CYFA.ToString());
|
|
//var sfxmall = new MedicalSchemeChargeMaintainDal().GetListBymedicalschememaintainid(ma.CYFA.ToString());
|
|
sql = "select * from exam_project_maintain where project_id in (select exam_project_maintain_project_id from medical_scheme_project_maintain where medical_scheme_maintain_id="+ma.CYFA+") ";
|
|
var tjxmal = conn.Query<ExamProjectMaintainModel>(sql).ToList();
|
|
List<ChargeProjectMaintainModel> sfxmal = new MedicalSchemeChargeMaintainDal().GetAllListBysfxmId("",ma.CYFA);
|
|
string bm= regdal.Cydj(regm, sfxmal, tjxmal,ma.id);
|
|
sql = "update MedicalAppointment set status=1 where id=@id";
|
|
conn.Execute(sql, new { id = ma.id });
|
|
return new OperationResult { State = 1, Message = bm };
|
|
}
|
|
else
|
|
{
|
|
return new OperationResult { State = 0, Message = "目前只能处理从业人员信息!" };
|
|
}
|
|
}
|
|
}
|
|
//throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|