You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
7.2 KiB
139 lines
7.2 KiB
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using Shentun.Peis.EntityFrameworkCore;
|
|
using Shentun.Peis.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Shentun.Peis.DbMapping
|
|
{
|
|
internal class PatientRegisterDbMapping : IEntityTypeConfiguration<PatientRegister>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PatientRegister> entity)
|
|
{
|
|
entity.HasComment("体检登记主档");
|
|
|
|
entity.Property(e => e.Id)
|
|
.ValueGeneratedNever()
|
|
.HasComment("登记流水号").IsRequired();
|
|
|
|
entity.Property(e => e.Age).HasComment("年龄");
|
|
|
|
entity.Property(e => e.CompleteFlag)
|
|
.HasDefaultValueSql("'0'::bpchar")
|
|
.HasComment("完成标志").IsRequired();
|
|
|
|
entity.Property(e => e.CustomerOrgGroupId)
|
|
.IsFixedLength()
|
|
.HasComment("分组");
|
|
|
|
entity.Property(e => e.CustomerOrgId)
|
|
.IsFixedLength()
|
|
.HasComment("单位编号");
|
|
|
|
|
|
|
|
entity.Property(e => e.MaritalStatusId)
|
|
.HasDefaultValueSql("'9'")
|
|
.HasComment("婚姻状况").IsRequired();
|
|
|
|
entity.Property(e => e.MedicalConclusionId)
|
|
.IsFixedLength()
|
|
.HasComment("体检结论");
|
|
|
|
entity.Property(e => e.MedicalPackageId)
|
|
.IsFixedLength()
|
|
.HasComment("套餐");
|
|
|
|
entity.Property(e => e.MedicalStartDate)
|
|
.HasDefaultValueSql("date(timezone('UTC-8'::text, now()))")
|
|
.HasComment("体检开始日期").IsRequired();
|
|
|
|
entity.Property(e => e.MedicalTimes).HasComment("体检次数").IsRequired();
|
|
|
|
entity.Property(e => e.MedicalTypeId)
|
|
.IsFixedLength()
|
|
.HasComment("体检类别");
|
|
|
|
|
|
|
|
entity.Property(e => e.PersonnelTypeId)
|
|
.IsFixedLength()
|
|
.HasComment("人员类别");
|
|
|
|
|
|
entity.Property(t => t.PatientRegisterNo).HasComment("条码号").IsRequired();
|
|
entity.Property(t => t.PatientId).HasComment("档案号").IsRequired();
|
|
entity.Property(t => t.PatientName).HasComment("姓名").IsRequired();
|
|
entity.Property(t => t.SexId).HasComment("性别").IsRequired().HasDefaultValueSql("'U'");
|
|
entity.Property(t => t.BirthDate).HasComment("出生日期");
|
|
entity.Property(t => t.JobCardNo).HasComment("工卡号");
|
|
entity.Property(t => t.MedicalCardNo).HasComment("体检卡号");
|
|
entity.Property(t => t.JobPost).HasComment("职务");
|
|
entity.Property(t => t.JobTitle).HasComment("职称");
|
|
entity.Property(t => t.Photo).HasComment("照片");
|
|
entity.Property(t => t.Salesman).HasComment("介绍人");
|
|
entity.Property(t => t.SexHormoneTermId).HasComment("性激素期限");
|
|
entity.Property(t => t.InterposeMeasure).HasComment("干预措施");
|
|
entity.Property(t => t.ReportPrintTimes).HasComment("体检报告打印次数").IsRequired().HasDefaultValue((short)0);
|
|
entity.Property(t => t.IsUpload).HasComment("是否上传到WEB").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.IsUploadAppoint).HasComment("是否上传预约备单到WEB").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.IsMedicalStart).HasComment("体检开始标志").IsRequired().HasDefaultValueSql("'N'");
|
|
|
|
entity.Property(t => t.IsRecoverGuide).HasComment("指引单收回").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.SummaryDate).HasComment("总检日期");
|
|
entity.Property(t => t.SummaryDoctorId).HasComment("总检医生");
|
|
entity.Property(t => t.IsAudit).HasComment("审核").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.AuditDoctorId).HasComment("审核医生");
|
|
entity.Property(t => t.AuditDate).HasComment("审核日期");
|
|
entity.Property(t => t.IsLock).HasComment("锁住").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.IsNameHide).HasComment("隐藏姓名").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.IsPhoneFollow).HasComment("电话随访").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.IsVip).HasComment("vip客户").IsRequired().HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.ThirdInfo).HasComment("附加第三方信息");
|
|
entity.Property(t => t.GuidePrintTimes).HasComment("指引单打印次数").IsRequired().HasDefaultValue((short)0);
|
|
entity.Property(t => t.Remark).HasComment("备注");
|
|
entity.Property(t => t.MedicalCenterId).HasComment("体检中心ID").IsRequired();
|
|
entity.Property(t => t.CustomerOrgRegisterId).HasComment("客户单位登记ID").HasDefaultValue(Guid.Empty);
|
|
entity.Property(t => t.AppointPatientRegisterId).HasMaxLength(40).HasComment("预约人员登记ID");
|
|
entity.Property(t => t.DeviceReportPrintTimes).HasComment("设备体检报告打印次数").IsRequired().HasDefaultValue((short)0);
|
|
entity.Property(t => t.DeviceGuidePrintTimes).HasComment("设备体检报告打印次数").IsRequired().HasDefaultValue((short)0);
|
|
entity.Property(t => t.ReportPrintOperating).HasComment("体检报告打印操作者");
|
|
entity.Property(t => t.SummaryHistoricalReview).HasComment("总检历次综述内容");
|
|
entity.Property(t => t.IsReceiveReport).HasComment("报告是否领取").HasDefaultValueSql("'N'");
|
|
entity.Property(t => t.ReportReceiveName).HasComment("报告领取人");
|
|
entity.Property(t => t.ReportReceiveDate).HasComment("报告领取时间");
|
|
entity.Property(t => t.IsPushThirdResult).HasComment("是否推送第三方结果").HasDefaultValueSql("'N'");
|
|
|
|
|
|
//entity.HasOne(d => d.CustomerOrgRegister)
|
|
// .WithMany(p => p.PatientRegisters)
|
|
// .HasForeignKey(d => d.CustomerOrgRegisterId)
|
|
// .OnDelete(DeleteBehavior.ClientSetNull)
|
|
// .HasConstraintName("fk_patient_register_org_register");
|
|
|
|
entity.HasOne(d => d.MaritalStatus)
|
|
.WithMany(p => p.PatientRegisters)
|
|
.HasForeignKey(d => d.MaritalStatusId)
|
|
.OnDelete(DeleteBehavior.ClientSetNull)
|
|
.HasConstraintName("fk_patient_register_marital_status_id");
|
|
|
|
//9527
|
|
//entity.HasOne(d => d.OrganizationUnit)
|
|
// .WithMany(p => p.PatientRegisters)
|
|
// .HasForeignKey(d => d.OrganizationUnitId)
|
|
// .OnDelete(DeleteBehavior.ClientSetNull)
|
|
// .HasConstraintName("fk_patient_register_ororganization_unit");
|
|
|
|
entity.HasOne(d => d.Patient)
|
|
.WithMany(p => p.PatientRegisters)
|
|
.HasForeignKey(d => d.PatientId)
|
|
.HasConstraintName("fk_patient_register_patient");
|
|
|
|
entity.ConfigureByConvention();
|
|
}
|
|
}
|
|
}
|