MCVef/Models/HospitalDBInitializer.cs

(完整代码) 4KB

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace MCVef.Models
{
    public class HospitalDBInitializer : DropCreateDatabaseAlways<HospitalModel>
    {
        protected override void Seed(HospitalModel context)
        {
            var loginUsers = new List<LoginUser>();
            loginUsers.Add(new LoginUser { LoginAccount = "2018071001", LoginPassword = "2020", UserType = "doctor", UserTypeId = 1 });
            loginUsers.Add(new LoginUser { LoginAccount = "2018071002", LoginPassword = "2020", UserType = "doctor", UserTypeId = 2 });
            loginUsers.Add(new LoginUser { LoginAccount = "2018071003", LoginPassword = "2020", UserType = "doctor", UserTypeId = 3 });
            loginUsers.Add(new LoginUser { LoginAccount = "2018071004", LoginPassword = "2020", UserType = "collector", UserTypeId = 1 });
            loginUsers.Add(new LoginUser { LoginAccount = "2018071005", LoginPassword = "2020", UserType = "register", UserTypeId = 1 });
            context.LoginUser.AddRange(loginUsers);

            var doctors = new List<Doctor>();
            doctors.Add(new Doctor { DoctorName = "李一一", DoctorDepartment = "口腔科", DoctorTitle = "主任", Gender = true, IsOnline = true, JoinDate = DateTime.Now, DoctorBirthday = new DateTime(1990, 10, 10), PhoneNumber = "17688888888" });
            doctors.Add(new Doctor { DoctorName = "王二狗", DoctorDepartment = "精神科", DoctorTitle = "主任", Gender = false, IsOnline = true, JoinDate = DateTime.Now, DoctorBirthday = new DateTime(1980, 10, 10), PhoneNumber = "13588888888" });
            doctors.Add(new Doctor { DoctorName = "黑某", DoctorDepartment = "儿科", DoctorTitle = "主任", Gender = true, IsOnline = true, JoinDate = DateTime.Now, DoctorBirthday = new DateTime(1970, 10, 10), PhoneNumber = "12388888888" });
            context.Doctor.AddRange(doctors);

            context.FeeCollector.Add(new FeeCollector() { CollectorName = "黄收费" });

            context.Register.Add(new Register() { RegisterName = "陈挂号" });

            var drugs = new List<DrugWarehouse>();
            drugs.Add(new DrugWarehouse() { DrugName = "板蓝根", DrugPrice = 30, DrugStorage = 100, DrugUnit = "包" });
            drugs.Add(new DrugWarehouse() { DrugName = "酒精", DrugPrice = 50, DrugStorage = 100, DrugUnit = "瓶" });
            drugs.Add(new DrugWarehouse() { DrugName = "小柴胡冲剂", DrugPrice = 80, DrugStorage = 100, DrugUnit = "盒" });
            drugs.Add(new DrugWarehouse() { DrugName = "灵芝", DrugPrice = 200, DrugStorage = 100, DrugUnit = "斤" });
            context.DrugWarehouse.AddRange(drugs);

            var records = new List<MedicalRecord>();
            records.Add(new MedicalRecord() { PatientName = "张病人", Gender = true, AllergyDrug = "水", CreateTime = DateTime.Now, LiveAddress = "广州市番禺区", Occupation = "程序员", PatientBirthday = new DateTime(1970, 10, 10), PatientIdentify = "440000197010102800" , PhoneNumber = "14588888888", Workplace = "广州市天河区"});
            records.Add(new MedicalRecord() { PatientName = "王病人", Gender = false, AllergyDrug = "空气", CreateTime = DateTime.Now, LiveAddress = "广州市荔湾区", Occupation = "清洁工", PatientBirthday = new DateTime(1975, 10, 10), PatientIdentify = "441111197510102800", PhoneNumber = "13788888888", Workplace = "广州市海珠区" });
            context.MedicalRecord.AddRange(records);

            var regists = new List<Regist>();
            regists.Add(new Regist() {DoctorId = 1, MedicalRecordId = 1, BillId = 1, CreateTime = DateTime.Now, PaymentType = "cash", RegistFee = 50, RegistStatus = "end", RegistType = "normal"});
            regists.Add(new Regist() { DoctorId = 1, MedicalRecordId = 1, CreateTime = DateTime.Now, PaymentType = "cash", RegistFee = 50, RegistStatus = "wait", RegistType = "normal" });
            context.Regist.AddRange(regists);

            context.Bill.Add(new Bill() { BillType = "drug", RegistId = 1, CreateTime = DateTime.Now, IsEnded = true });

            context.BillDetail.Add(new BillDetail() { BillId = 1, DrugComment = "每天三次", DrugUsage = 1, DrugWarehouseId =  1, IsPayed = true});
            context.BillDetail.Add(new BillDetail() { BillId = 1, DrugComment = "每天一次", DrugUsage = 2, DrugWarehouseId = 2, IsPayed = true });

            context.DiagnosisHistory.Add(new DiagnosisHistory() { RegistId = 1, MedicalRecordId = 1, Comment = "没啥事", CreateDate = DateTime.Now });


            //初始化数据
            base.Seed(context);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。