2025 lines
87 KiB
C#
2025 lines
87 KiB
C#
using Furion.DistributedIDGenerator;
|
|
using Microsoft.Extensions.Hosting;
|
|
using MiniExcelLibs;
|
|
using Nirvana.Common;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using YBDevice.Entity;
|
|
using YBDevice.Entity.DataModel.ThirdOpen;
|
|
|
|
namespace YBDevice.CreateDB
|
|
{
|
|
public class DbMigratorHostedService : BackgroundService
|
|
{
|
|
private readonly ISqlSugarRepository<YB_ChildrenPrescription> repository;
|
|
private readonly SqlSugarClient Db;
|
|
private const bool IsCreateTable = true;
|
|
public DbMigratorHostedService(ISqlSugarRepository<YB_ChildrenPrescription> sqlSugarRepository)
|
|
{
|
|
repository = sqlSugarRepository;
|
|
Db = repository.Context;
|
|
}
|
|
|
|
public override Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
Console.WriteLine("开始迁移数据库!");
|
|
return base.StartAsync(cancellationToken);
|
|
}
|
|
/// <summary>
|
|
/// 开始执行迁移
|
|
/// </summary>
|
|
/// <param name="stoppingToken"></param>
|
|
/// <returns></returns>
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
await Create(false, 50,
|
|
// typeof(YB_Account),
|
|
// typeof(YB_BannerEqu),
|
|
// typeof(YB_FamilyData),
|
|
// typeof(YB_FamilyRealData),
|
|
// typeof(YB_LXBodyType),
|
|
// typeof(YB_LXBodyQA),
|
|
// typeof(YB_LXBodyAns),
|
|
// typeof(YB_LXBodyGuide),
|
|
// typeof(YB_LXBodyResult),
|
|
// typeof(YB_DeviceAlloc),
|
|
// typeof(YB_SecInfoType),
|
|
// typeof(YB_Order),
|
|
// typeof(YB_RegUser),
|
|
// typeof(YB_UserEqu),
|
|
// typeof(YB_UserWX),
|
|
// typeof(YB_UserLastData),
|
|
// typeof(YB_nResult),
|
|
// typeof(YB_nMeasureResult),
|
|
// typeof(YB_nResultAdd),
|
|
// typeof(YB_nUserResult),
|
|
// typeof(YB_NoticeLogger),
|
|
// typeof(YB_DeviceType),
|
|
// typeof(YB_DeviceTypeExt),
|
|
// typeof(YB_DeviceTypeApp),
|
|
// typeof(YB_nBodyMeasure),
|
|
// typeof(YB_PrintCode),
|
|
// typeof(YB_PrintCodeEqu),
|
|
// typeof(YB_nSecInfo),
|
|
// typeof(YB_nSecInfoAppId),
|
|
// typeof(YB_nSecInfoContent),
|
|
// typeof(YB_nMenu),
|
|
// typeof(YB_nMenuAction),
|
|
// typeof(YB_nRole),
|
|
// typeof(YB_nRoleAction),
|
|
// typeof(YB_nRoleMenu),
|
|
// typeof(YB_MiniProgramSubscribeMessageTpl),
|
|
// typeof(YB_UserSubscribeMessage),
|
|
// typeof(YB_WXCustomService),
|
|
// typeof(YB_ChildrenPrescription),
|
|
// typeof(YB_ChildPrescriptionByAge),
|
|
typeof(YB_ChildPhysique),
|
|
typeof(YB_ChildPhysiqueResult),
|
|
typeof(YB_ChildPhysiqueResultDetail),
|
|
typeof(YB_ChildBodyQA),
|
|
typeof(YB_ChildBodyDetail),
|
|
typeof(YB_UserChildBody),
|
|
// typeof(YB_NewHeightStand),
|
|
// typeof(YB_NewWeightStand),
|
|
// typeof(YB_BmiStand),
|
|
// typeof(YB_HeadStand),
|
|
// typeof(T_RegUser),
|
|
//typeof(T_Result),
|
|
//typeof(T_UserWX),
|
|
//typeof(T_Family),
|
|
//typeof(T_FamilyData),
|
|
//typeof(YB_AuditLogger)
|
|
typeof(AB_HeightStand),
|
|
typeof(AB_WeightStand),
|
|
typeof(AB_Prescription),
|
|
typeof(AB_PrescriptionByAge)
|
|
);
|
|
}
|
|
|
|
public override Task StopAsync(CancellationToken cancellationToken)
|
|
{
|
|
Console.WriteLine("迁移完成!");
|
|
return base.StopAsync(cancellationToken);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建数据库
|
|
/// </summary>
|
|
/// <param name="Backup"></param>
|
|
/// <param name="StringDefaultLength"></param>
|
|
/// <param name="types">表名,params关键字表示可以使用任意数量的type类型参数</param>
|
|
private async Task Create(bool Backup = false, int StringDefaultLength = 50, params Type[] types)
|
|
{
|
|
if (IsCreateTable)
|
|
{
|
|
Db.CodeFirst.SetStringDefaultLength(StringDefaultLength);
|
|
Db.DbMaintenance.CreateDatabase();
|
|
if (Backup)
|
|
{
|
|
Db.CodeFirst.BackupTable().InitTables(types);
|
|
}
|
|
else
|
|
{
|
|
Db.CodeFirst.InitTables(types);
|
|
}
|
|
}
|
|
#region 初始化种子
|
|
if (Db.DbMaintenance.IsAnyTable("YB_LXBodyType") && await Db.Queryable<YB_LXBodyType>().CountAsync() == 0)
|
|
{
|
|
List<YB_LXBodyType> list = new List<YB_LXBodyType>();
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-6ef8-4ff2-8fb5-fab7a89af4f3"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "平和型",
|
|
IsPH = 1
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-7cbf-4d85-8c74-5b844f3f2dd3"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "气虚型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-82f0-402e-8686-2830c8964813"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "阳虚型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-8920-4193-8f58-eba41dcfc407"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "阴虚型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-8f41-4449-8a22-bce63f83dc7a"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "痰湿型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-955b-44ad-8b7d-04c7fcd5e49b"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "湿热型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-9b1a-46ac-8aa1-b1da911444aa"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "血瘀型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-a0a3-4802-83b1-dbd50895b0aa"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "气郁型",
|
|
IsPH = 0
|
|
});
|
|
list.Add(new YB_LXBodyType
|
|
{
|
|
Id = Guid.Parse("08d94d78-a563-4419-8810-1cf41f606b17"),
|
|
CreateTime = DateTime.Now,
|
|
Name = "特禀型",
|
|
IsPH = 0
|
|
});
|
|
Db.Insertable(list).ExecuteCommand();
|
|
}
|
|
if (Db.DbMaintenance.IsAnyTable("YB_LXBodyQA") && await Db.Queryable<YB_LXBodyQA>().CountAsync() == 0)
|
|
{
|
|
List<YB_LXBodyQA> list = new List<YB_LXBodyQA>();
|
|
int isrequired = 0;
|
|
List<string> titlelist = new List<string>() {
|
|
"您精力充沛吗","您容易疲惫吗","您说话声音低弱无力吗","您赶到闷闷不乐、情绪低沉吗",
|
|
"您比一般人耐受不了寒冷(冬天的寒冷,夏天的冷空调、电扇)吗","您能适应外界自然和社会环境的变化吗",
|
|
"您容易失眠吗","您容易忘事(健忘)吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
if (i == 1 || i == 2 || i == 3 || i == 4 || i == 6 || i == 7)
|
|
{
|
|
isrequired = 1;
|
|
}
|
|
else
|
|
{
|
|
isrequired = 0;
|
|
}
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-6ef8-4ff2-8fb5-fab7a89af4f3"),
|
|
IsSex = 0
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您容易疲乏吗","您容易气短(呼吸短促,接不上气)吗","您容易心慌吗","您容易头晕或站起时晕眩吗",
|
|
"您比别人容易患感冒吗",
|
|
"您喜欢安静、懒得说话吗","您说话声音无力吗","您活动量稍大就容易出虚汗吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-7cbf-4d85-8c74-5b844f3f2dd3"),
|
|
IsSex = 0
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您手脚发凉吗","您胃脘部、背部或腰膝部怕冷吗","您感到怕冷、衣服比别人穿的多吗","您比一般人耐受不了寒冷(冬天的寒冷,夏天的冷空调、电扇等)吗",
|
|
"您比别人容易患感冒吗",
|
|
"您吃(喝)凉的东西会感到不舒服或怕吃(喝)凉东西吗","您受凉或吃(喝)凉的东西后,容易腹泻(拉肚子)吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-82f0-402e-8686-2830c8964813"),
|
|
IsSex = 0
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您感到手脚心发热吗","您感觉身体、脸上发热吗","您皮肤或口唇干吗","您口唇的颜色比一般人红吗",
|
|
"您容易便秘或大便干燥吗",
|
|
"您面部两颧潮红或偏红吗","您感到眼睛干涩吗","您感到口干舌燥,总想喝水吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-8920-4193-8f58-eba41dcfc407"),
|
|
IsSex = 0
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您感到胸闷或腹部胀满吗","您感到身体沉重不轻松或不爽快吗","您腹部肥满松软吗","您有额部油脂分泌多的现象吗",
|
|
"您上眼睑比别人肿(轻微隆起的现象)吗",
|
|
"您嘴里有黏黏的感觉吗","您受平时痰多,特别是咽喉部总感到有痰堵着吗","您舌苔厚腻或有舌苔厚厚的感觉吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-8f41-4449-8a22-bce63f83dc7a"),
|
|
IsSex = 0
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您面部或鼻部有油腻感或有油光发亮吗","您容易生痤疮或疮疖吗","您感到口苦或嘴里有异味吗","您大便粘滞不爽、解不尽的感觉吗",
|
|
"您小便时尿道有发热感、尿色浓吗",
|
|
"您带下色黄(白带颜色发黄)吗(限女性回答)","您的阴囊部位潮湿吗(限男性回答)"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-955b-44ad-8b7d-04c7fcd5e49b"),
|
|
IsSex = i == 5 ? 1 : (i == 6 ? 2 : 0)
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您的皮肤在不知不觉中会出现青紫瘀斑(皮下出血)吗","您两颧部有细微红丝吗","您身体上有哪里疼痛吗","您面色晦暗或容易出现褐斑吗",
|
|
"您容易有黑眼圈吗",
|
|
"您容易忘事或健忘吗","您口唇颜色偏暗吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-9b1a-46ac-8aa1-b1da911444aa")
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您感到闷闷不乐吗","您容易精神紧张、焦虑不安吗","您多愁善感、感情脆弱吗","您容易感到害怕或受到惊吓吗",
|
|
"您胁肋部或乳房胀痛吗",
|
|
"您无缘无故叹气吗","您咽喉部有异物感,且吐之不出、咽之不下吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-a0a3-4802-83b1-dbd50895b0aa")
|
|
});
|
|
}
|
|
titlelist = new List<string>() {
|
|
"您没有感冒时也会打喷嚏吗","您没有感冒时也会鼻塞、流鼻涕吗","您有因季节变化、温度变化或异味等原因而咳喘的现象吗","您容易过敏(对药物、食物、气味、花粉、季节交替、气候变化时)吗",
|
|
"您的皮肤容易起荨麻疹(风团、风疹块、风疙瘩)吗",
|
|
"您的皮肤因过敏出现过紫癜(紫红色淤点、瘀斑)吗","您的皮肤一抓就红,并出现抓痕吗"
|
|
};
|
|
for (var i = 0; i < titlelist.Count; i++)
|
|
{
|
|
isrequired = 0;
|
|
list.Add(new YB_LXBodyQA
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
SomeValue = 3,
|
|
SortCode = i + 1,
|
|
AlWaysValue = 5,
|
|
CreateTime = DateTime.Now,
|
|
LittleValue = 2,
|
|
NoneValue = 1,
|
|
OftenValue = 4,
|
|
Title = titlelist[i],
|
|
IsRequired = isrequired,
|
|
TypeId = Guid.Parse("08d94d78-a563-4419-8810-1cf41f606b17")
|
|
});
|
|
}
|
|
Db.Insertable(list).ExecuteCommand();
|
|
}
|
|
|
|
if (Db.DbMaintenance.IsAnyTable("YB_LXBodyGuide") && await Db.Queryable<YB_LXBodyGuide>().CountAsync() == 0)
|
|
{
|
|
List<YB_LXBodyGuide> list = new List<YB_LXBodyGuide>();
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d81-0483-4c3e-8879-409841ee07c1"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "不爱得病",
|
|
Feature = "睡眠好、性格开朗,社会和自然适应能力强",
|
|
Health = "多吃五谷杂粮、蔬菜瓜果,少食过于油腻及辛辣之物。吃得不要过饱,也不能过饥,不吃冷也不吃得过热",
|
|
People = "男性多于女性。年龄越大,平和体质的人越少",
|
|
TypeId = Guid.Parse("08d94d78-6ef8-4ff2-8fb5-fab7a89af4f3")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d7e-3ee7-4932-85db-95d436c286b5"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "容易感冒,生病后抗病能力弱且难以痊愈,还易患内脏下垂比如胃下垂等。",
|
|
Feature = "说话没劲,经常出虚汗,容易呼吸短促,经常疲乏无力,这就是气虚体质。这种人一般性格内向,情绪不稳定,比较胆小,不爱冒险。",
|
|
Health = "多吃有益气健脾作用的食物,如大枣、山药、黄豆、白扁豆、鸡肉、泥鳅、香菇、大枣、桂圆、蜂蜜等。少食具有耗气作用的食物,如槟榔、空心菜、生萝卜等。",
|
|
People = "气虚体质者多分布在没有工作的人、学生和长期从事体力劳动的人。",
|
|
TypeId = Guid.Parse("08d94d78-7cbf-4d85-8c74-5b844f3f2dd3")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d78-82f0-402e-8686-2830c8964813"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "水肿、腹泻等",
|
|
Feature = "手脚发凉,不敢吃凉的东西。性格多沉静、内向",
|
|
Health = "多吃甘温益气的食物,比如牛羊狗肉、葱、姜、蒜、花椒、鳝鱼、辣椒、胡椒等。少食生冷寒凉食物如黄瓜、藕、梨、西瓜等",
|
|
People = "东北地区多见,可能与东北寒燥的天气有关,女性明显多于男性。长期偏嗜寒凉食物也会形成这种体质",
|
|
TypeId = Guid.Parse("08D94D78-82F0-402E-8686-2830C8964813")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d80-fe57-47f1-80ee-5a951f6bd57e"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "易患咳嗽、干燥综合征、甲亢等",
|
|
Feature = "怕热,经常感到手脚心发热,面颊潮红或偏红,皮肤干燥,口干舌燥,容易失眠,经常大便干结,外向好动,性情急躁",
|
|
Health = "多吃甘凉滋润的食物,比如核桃、银耳、瘦猪肉、鸭肉、绿豆、冬瓜、芝麻、百合等。少食羊肉、狗肉、韭菜、辣椒、葱、蒜、葵花子等性温燥烈的食物",
|
|
People = "在多风、干燥、强紫外线辐射的地区容易产生这种体质的人。",
|
|
TypeId = Guid.Parse("08d94d78-8920-4193-8f58-eba41dcfc407")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d80-fa89-41b1-871c-62ffb4e84e08"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "易患冠心病、高血压、高脂血症、糖尿病等疾病",
|
|
Feature = "腹部松软肥胖,皮肤出油,汗多,眼睛浮肿,容易困倦。性格温和稳重善于忍耐",
|
|
Health = "饮食清淡为原则,少食肥肉及甜、黏、油腻的食物,可多食荷叶、葱、蒜、海藻、海带、冬瓜、萝卜、金橘、芥末等食物",
|
|
People = "喜欢吃甜腻食物、不爱运动爱睡觉、生活安逸的中老年人多",
|
|
TypeId = Guid.Parse("08d94d78-8f41-4449-8a22-bce63f83dc7a")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d80-f6ac-4633-8e7a-17dfcc067628"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "疮疖、黄疸等病",
|
|
Feature = "脸部和鼻尖总是油光发亮,还容易生粉刺、疮疖,一开口就能闻到异味,容易大便黏滞不爽,小便发黄,性格多急躁易怒",
|
|
Health = "饮食清淡,多吃甘寒、甘平的食物,如薏米、苦丁茶、绿豆、空心菜、苋菜、芹菜、黄瓜、冬瓜、藕、西瓜等,少食辛温助热的食物,应戒除烟酒",
|
|
People = "喜欢吃煎炸烧烤等食物或嗜好烟酒的人群",
|
|
TypeId = Guid.Parse("08d94d78-955b-44ad-8b7d-04c7fcd5e49b")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d80-f35a-4ec8-8726-8b5ea3f08c8d"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "出血、中风、冠心病等",
|
|
Feature = "刷牙时牙龈容易出血,眼睛经常有红丝,皮肤常干燥、粗糙,常常出现疼痛,容易烦躁,健忘,性情急躁",
|
|
Health = "",
|
|
People = "南方人、脑力工作者,女性多见",
|
|
TypeId = Guid.Parse("08d94d78-9b1a-46ac-8aa1-b1da911444aa")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d80-ee5d-4627-804c-ecc68252a73f"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "失眠、抑郁症、神经官能症等",
|
|
Feature = "多愁善感、忧郁脆弱。身体比较瘦,经常闷闷不乐,无缘无故地叹气,容易心慌、失眠",
|
|
Health = "多吃小麦、蒿子杆、葱、蒜、海带、海藻、萝卜、山楂等具有行气、解郁、消食、醒神作用的黄花、玫瑰花茶等食物",
|
|
People = "该体质的人多是年轻人,而且女性明显多于男性",
|
|
TypeId = Guid.Parse("08d94d78-a0a3-4802-83b1-dbd50895b0aa")
|
|
});
|
|
list.Add(new YB_LXBodyGuide
|
|
{
|
|
Id = Guid.Parse("08d94d81-1486-4cd2-8892-3f636587a02e"),
|
|
CreateTime = DateTime.Now,
|
|
Sick = "药物过敏、花粉症、哮喘等过敏性疾病",
|
|
Feature = "对花粉或某种食物、植物过敏",
|
|
Health = "",
|
|
People = "",
|
|
TypeId = Guid.Parse("08d94d78-a563-4419-8810-1cf41f606b17")
|
|
});
|
|
Db.Insertable(list).ExecuteCommand();
|
|
}
|
|
|
|
if (Db.DbMaintenance.IsAnyTable("YB_DeviceTypeExt") && await Db.Queryable<YB_DeviceTypeExt>().CountAsync() == 0)
|
|
{
|
|
var list = new List<YB_DeviceTypeExt>() {
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=1,
|
|
RId=1,
|
|
Status = StatusType.Enabled,
|
|
AppId = "",
|
|
Name="HD01",
|
|
HeadImg="/images/device/PCD01-BT.png",
|
|
Content="1,3,6"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=2,
|
|
RId=2,
|
|
Status=StatusType.Enabled,
|
|
AppId="",
|
|
Name="H018",
|
|
HeadImg="/images/device/PCH018PRO.png",
|
|
Content="2"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=3,
|
|
RId=1,
|
|
Status=StatusType.Disabled,
|
|
AppId="",
|
|
Name="HD01",
|
|
HeadImg="/images/device/PCD01-BT.png",
|
|
Content="1,3,6"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=4,
|
|
RId=4,
|
|
Status=StatusType.Enabled,
|
|
AppId="",
|
|
Name="L01",
|
|
HeadImg="/images/device/L01.jpg",
|
|
Content="4,5"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=5,
|
|
RId=4,
|
|
Status=StatusType.Disabled,
|
|
AppId="",
|
|
Name="L01",
|
|
HeadImg="/images/device/L01.jpg",
|
|
Content="4,5"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=6,
|
|
RId=1,
|
|
Status=StatusType.Disabled,
|
|
AppId="",
|
|
Name="HD01",
|
|
HeadImg="/images/device/PCD01-BT.png",
|
|
Content="1,3,6"
|
|
},
|
|
new YB_DeviceTypeExt
|
|
{
|
|
Id=7,
|
|
RId=7,
|
|
Status=StatusType.Disabled,
|
|
AppId="",
|
|
Name="F01PRO",
|
|
HeadImg="/images/device/L01.jpg",
|
|
Content="7"
|
|
},
|
|
};
|
|
Db.Insertable(list).ExecuteCommand();
|
|
}
|
|
|
|
if (Db.DbMaintenance.IsAnyTable("YB_nMenu") && await Db.Queryable<YB_nMenu>().CountAsync() == 0)
|
|
{
|
|
var list = new List<YB_nMenu> {
|
|
new YB_nMenu {
|
|
Id = Guid.Parse("08D99602-1E4C-4113-8A0E-85529A833791"),
|
|
Name="设备管理",
|
|
SortCode = 2,
|
|
CreateTime=DateTime.Now,
|
|
Status = StatusType.Enabled,
|
|
Icon="custom-icon-shebei",
|
|
ParentId = Guid.Empty,
|
|
Remark="设备管理",
|
|
Url="/Device/Index",
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad87-ddfd-4daa-8ea9-ca6bd48ae005"),
|
|
Name="微信管理",
|
|
Url="/",
|
|
Icon="custom-icon-weixin",
|
|
SortCode=2,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-1c43-4646-8101-f0cd82e08395"),
|
|
Name="小程序管理",
|
|
Url="/MiniProgram/Index",
|
|
Icon="custom-icon-weixin",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad87-ddfd-4daa-8ea9-ca6bd48ae005"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-8a9d-4836-8f40-c5559a8416a5"),
|
|
Name="公众号管理",
|
|
Url="/Official/Index",
|
|
Icon="custom-icon-weixin",
|
|
SortCode=2,
|
|
ParentId=Guid.Parse("08d9ad87-ddfd-4daa-8ea9-ca6bd48ae005"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-9978-44b3-8149-2248bffe7dc2"),
|
|
Name="用户管理",
|
|
Url="/RegUser/Index",
|
|
Icon="custom-icon-fensi",
|
|
SortCode=4,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-c1a5-44ce-8bd0-3e28a6163739"),
|
|
Name="订单管理",
|
|
Url="/Order/Index",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=4,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-d2a2-44a3-86dd-7eb363006188"),
|
|
Name="测量记录",
|
|
Url="/Result/Index",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=5,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad88-ec9c-4cb8-8dc0-0fe83b0d34f2"),
|
|
Name="广告管理",
|
|
Url="/",
|
|
Icon="custom-icon-material",
|
|
SortCode=6,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-0222-4e03-83fc-0499e94db7e1"),
|
|
Name="科普资讯",
|
|
Url="/Info/Index",
|
|
Icon="custom-icon-material",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad88-ec9c-4cb8-8dc0-0fe83b0d34f2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-1783-47ac-8a3b-2c43dcdcf903"),
|
|
Name="图片广告",
|
|
Url="/banner/Index",
|
|
Icon="custom-icon-guanggao1",
|
|
SortCode=2,
|
|
ParentId=Guid.Parse("08d9ad88-ec9c-4cb8-8dc0-0fe83b0d34f2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8b-5fdc-4ada-8d54-7c7e3364c8e7"),
|
|
Name="科普类型",
|
|
Url="/Info/Type",
|
|
Icon="custom-icon-icon",
|
|
SortCode=3,
|
|
ParentId=Guid.Parse("08d9ad88-ec9c-4cb8-8dc0-0fe83b0d34f2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-39f5-4b83-87c8-93433fe18eea"),
|
|
Name="客户管理",
|
|
Url="/Business/Index",
|
|
Icon="custom-icon-kehu",
|
|
SortCode=7,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-4636-452b-8d49-577320596c08"),
|
|
Name="出货管理",
|
|
Url="/",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=7,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-6281-4a82-8f16-a3edb7726830"),
|
|
Name="出货列表",
|
|
Url="/OutProduct/Index",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad89-4636-452b-8d49-577320596c08"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-73f8-4b20-8ea4-129662da8d7d"),
|
|
Name="物流管理",
|
|
Url="/OutProduct/Express",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=2,
|
|
ParentId=Guid.Parse("08d9ad89-4636-452b-8d49-577320596c08"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad89-e485-42c3-8170-67d2e0f847b6"),
|
|
Name="统计报表",
|
|
Url="/",
|
|
Icon="custom-icon-tongji",
|
|
SortCode=8,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-31b1-4998-82c5-6e6a0421f290"),
|
|
Name="用户画像",
|
|
Url="/Profile/Index",
|
|
Icon="custom-icon-fensi",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad89-e485-42c3-8170-67d2e0f847b6"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-350e-4f80-8a36-eeebfb769ab9"),
|
|
Name="测量统计",
|
|
Url="/Report/Index",
|
|
Icon="custom-icon-tongji",
|
|
SortCode=2,
|
|
ParentId=Guid.Parse("08d9ad89-e485-42c3-8170-67d2e0f847b6"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-3bc1-4255-85b0-1ddba8313971"),
|
|
Name="系统配置",
|
|
Url="/",
|
|
Icon="custom-icon-xitong",
|
|
SortCode=9,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-5f3c-4689-8b09-71cf2c33fff9"),
|
|
Name="设备类型",
|
|
Url="/Device/Type",
|
|
Icon="custom-icon-icon",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad8a-3bc1-4255-85b0-1ddba8313971"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-7a54-4d11-83d7-7af6d75d00f5"),
|
|
Name="版本管理",
|
|
Url="/",
|
|
Icon="custom-icon-qrcode",
|
|
SortCode=10,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-913f-4eb6-810c-d65b7bd97ee0"),
|
|
Name="代码管理",
|
|
Url="/Code/Template",
|
|
Icon="custom-icon-qrcode",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad8a-7a54-4d11-83d7-7af6d75d00f5"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-a0e0-4dda-8cdf-e6d7169694d2"),
|
|
Name="系统管理",
|
|
Url="/",
|
|
Icon="custom-icon-xitong",
|
|
SortCode=10,
|
|
ParentId=Guid.Empty,
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8b-ad5d-4646-855d-7dee71eacdf9"),
|
|
Name="菜单管理",
|
|
Url="/menu/index",
|
|
Icon="custom-icon-menu",
|
|
SortCode=1,
|
|
ParentId=Guid.Parse("08d9ad8a-a0e0-4dda-8cdf-e6d7169694d2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=1
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-c50a-445e-834c-b9e785aef04f"),
|
|
Name="角色管理",
|
|
Url="/role/index",
|
|
Icon="custom-icon-jiaose",
|
|
SortCode=2,
|
|
ParentId=Guid.Parse("08d9ad8a-a0e0-4dda-8cdf-e6d7169694d2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=0
|
|
},new YB_nMenu{
|
|
Id = Guid.Parse("08d9ad8a-d870-42fe-80f1-e661433a3ba6"),
|
|
Name="按钮管理",
|
|
Url="/Menu/Button",
|
|
Icon="custom-icon-dingdan",
|
|
SortCode=3,
|
|
ParentId=Guid.Parse("08d9ad8a-a0e0-4dda-8cdf-e6d7169694d2"),
|
|
Remark="",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now,
|
|
IsSuper=1
|
|
} };
|
|
Db.Insertable(list).ExecuteCommand();
|
|
}
|
|
|
|
if (Db.DbMaintenance.IsAnyTable("YB_nRole") && await Db.Queryable<YB_nRole>().CountAsync() == 0)
|
|
{
|
|
List<YB_nRole> menulist = new List<YB_nRole> {
|
|
new YB_nRole
|
|
{
|
|
Id = Guid.Parse("08D93C45-E693-430D-8675-6DC7F86132AA"),
|
|
Name="管理员",
|
|
Code="admin",
|
|
Remark="管理员",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now
|
|
},new YB_nRole
|
|
{
|
|
Id = Guid.Parse("08D93BAC-E4BB-403E-8DE3-7E9AC647B5F4"),
|
|
Name="代理商",
|
|
Code="agent",
|
|
Remark="代理商",
|
|
Status=StatusType.Enabled,
|
|
CreateTime=DateTime.Now
|
|
}
|
|
};
|
|
Db.Insertable(menulist).ExecuteCommand();
|
|
}
|
|
#endregion
|
|
|
|
#region 儿童处方种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_ChildrenPrescription") && await Db.Queryable<YB_ChildrenPrescription>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "儿童处方.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath);
|
|
var list = query.ToList();
|
|
var insertlist1 = new List<YB_ChildPrescriptionByAge>();
|
|
var nowtime = DateTime.Now;
|
|
var tlist = new List<YB_ChildrenPrescription>();
|
|
var Nutrition = list[2];
|
|
var sport = list[3];
|
|
var sport0_1 = list[4];
|
|
var sport1_3 = list[5];
|
|
var sport3_7 = list[6];
|
|
var sport8_16 = list[7];
|
|
var sleep = list[8];
|
|
var sleep0_3 = list[9];
|
|
var sleep4_11 = list[10];
|
|
var sleep1_2 = list[11];
|
|
var sleep3_5 = list[12];
|
|
var sleep6_13 = list[13];
|
|
var sleep14_17 = list[14];
|
|
var mood = list[15];
|
|
var mood0_1 = list[16];
|
|
var mood1_3 = list[17];
|
|
var mood3_7 = list[18];
|
|
var mood8_12 = list[19];
|
|
var mood13_16 = list[20];
|
|
#region 全年龄
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.C,
|
|
Nutrition = Nutrition.C,
|
|
Level = 1,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.D,
|
|
Nutrition = Nutrition.D,
|
|
Level = 2,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.E,
|
|
Nutrition = Nutrition.E,
|
|
Level = 3,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.F,
|
|
Nutrition = Nutrition.F,
|
|
Level = 4,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.G,
|
|
Nutrition = Nutrition.G,
|
|
Level = 5,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.H,
|
|
Nutrition = Nutrition.H,
|
|
Level = 1,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.I,
|
|
Nutrition = Nutrition.I,
|
|
Level = 2,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.J,
|
|
Nutrition = Nutrition.J,
|
|
Level = 3,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.K,
|
|
Nutrition = Nutrition.K,
|
|
Level = 4,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.L,
|
|
Nutrition = Nutrition.L,
|
|
Level = 1,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.M,
|
|
Nutrition = Nutrition.M,
|
|
Level = 2,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
tlist.Add(new YB_ChildrenPrescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.N,
|
|
Nutrition = Nutrition.N,
|
|
Level = 3,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
#endregion
|
|
#region 运动分年龄
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 1,
|
|
MinAge = 0,
|
|
MaxAge = 1 * 12,
|
|
Content = sport0_1.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 1,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 3 * 12,
|
|
Content = sport1_3.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 1,
|
|
MinAge = 3 * 12,
|
|
MaxAge = 8 * 12,
|
|
Content = sport3_7.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 1,
|
|
MinAge = 8 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = sport8_16.C
|
|
});
|
|
#endregion
|
|
|
|
#region 睡眠分年龄
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = -1,
|
|
MaxAge = -1,
|
|
Content = sleep.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 0,
|
|
MaxAge = 4,
|
|
Content = sleep0_3.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 4,
|
|
MaxAge = 12,
|
|
Content = sleep4_11.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 2 * 12,
|
|
Content = sleep1_2.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 2 * 12,
|
|
MaxAge = 6 * 12,
|
|
Content = sleep3_5.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 6 * 12,
|
|
MaxAge = 13 * 12,
|
|
Content = sleep6_13.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 2,
|
|
MinAge = 13 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = sleep14_17.C
|
|
});
|
|
#endregion
|
|
#region 情绪分年龄
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = -1,
|
|
MaxAge = -1,
|
|
Content = mood.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = 0,
|
|
MaxAge = 1 * 12,
|
|
Content = mood0_1.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 3 * 12,
|
|
Content = mood1_3.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = 3 * 12,
|
|
MaxAge = 8 * 12,
|
|
Content = mood3_7.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = 8 * 12,
|
|
MaxAge = 12 * 12,
|
|
Content = mood8_12.C
|
|
});
|
|
insertlist1.Add(new YB_ChildPrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = 3,
|
|
MinAge = 12 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = mood13_16.C
|
|
});
|
|
#endregion
|
|
|
|
await Db.Insertable(tlist).ExecuteCommandAsync();
|
|
await Db.Insertable(insertlist1).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 儿童体质种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_ChildPhysique") && await Db.Queryable<YB_ChildPhysique>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "儿童体质.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath);
|
|
int type = 1;
|
|
List<YB_ChildPhysique> insertlist = new List<YB_ChildPhysique>();
|
|
int sort = 1;
|
|
for (var i = 1; i < query.Count(); i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
var keys = row.Keys.ToArray();
|
|
for (var j = 0; j < keys.Length; j++)
|
|
{
|
|
object val;
|
|
if (row.TryGetValue(keys[j], out val))
|
|
{
|
|
if (val != null)
|
|
{
|
|
string text = val.ToString();
|
|
int value = 1;
|
|
if (text.IndexOf("0") == 0)
|
|
{
|
|
value = 0;
|
|
text = text.Substring(1, text.Length - 1);
|
|
}
|
|
insertlist.Add(new YB_ChildPhysique
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Text = text,
|
|
Type = type,
|
|
Value = value,
|
|
Sort = sort
|
|
});
|
|
}
|
|
}
|
|
type++;
|
|
}
|
|
type = 1;
|
|
sort++;
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 0-18岁身高标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_NewHeightStand") && await Db.Queryable<YB_NewHeightStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "0~18岁身高体重BMI头围数据及分段.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "height");
|
|
var list = query.ToList();
|
|
var insertlist = new List<YB_NewHeightStand>();
|
|
for (var i = 5; i < query.Count() - 2; i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("C", out object nf3);
|
|
row.TryGetValue("D", out object nf2);
|
|
row.TryGetValue("F", out object nf1);
|
|
row.TryGetValue("G", out object nb);
|
|
row.TryGetValue("H", out object nz1);
|
|
row.TryGetValue("I", out object nz2);
|
|
row.TryGetValue("J", out object nz3);
|
|
|
|
row.TryGetValue("M", out object vf3);
|
|
row.TryGetValue("N", out object vf2);
|
|
row.TryGetValue("O", out object vf1);
|
|
row.TryGetValue("P", out object vb);
|
|
row.TryGetValue("Q", out object vz1);
|
|
row.TryGetValue("R", out object vz2);
|
|
row.TryGetValue("S", out object vz3);
|
|
string mstr = month.ToString();
|
|
decimal m = mstr.Contains("周") ? (mstr.Substring(0, mstr.Length - 1).ToDecimal() / 4.0m).ToDecimal(2) : (mstr.Contains("月") ? mstr.Substring(0, mstr.Length - 1).ToDecimal(2) : month.ToDecimal(2));
|
|
if (mstr.Contains("周") && (m == 1m || m == 2m || m == 3m))
|
|
{
|
|
m = m - 0.1m;
|
|
}
|
|
insertlist.Add(new YB_NewHeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
insertlist.Add(new YB_NewHeightStand
|
|
{
|
|
f3sd = vf3.ToDecimal(1),
|
|
f2sd = vf2.ToDecimal(1),
|
|
f1sd = vf1.ToDecimal(1),
|
|
median = vb.ToDecimal(1),
|
|
z1sd = vz1.ToDecimal(1),
|
|
z2sd = vz2.ToDecimal(1),
|
|
z3sd = vz3.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 0-18岁体重标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_NewWeightStand") && await Db.Queryable<YB_NewWeightStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "0~18岁身高体重BMI头围数据及分段.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "weight");
|
|
var list = query.ToList();
|
|
var insertlist = new List<YB_NewWeightStand>();
|
|
for (var i = 5; i < list.Count() - 2; i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("D", out object nf3);
|
|
row.TryGetValue("F", out object nf2);
|
|
row.TryGetValue("H", out object nf1);
|
|
row.TryGetValue("I", out object nb);
|
|
row.TryGetValue("J", out object nz1);
|
|
row.TryGetValue("L", out object nz2);
|
|
row.TryGetValue("N", out object nz3);
|
|
|
|
row.TryGetValue("Q", out object vf3);
|
|
row.TryGetValue("S", out object vf2);
|
|
row.TryGetValue("U", out object vf1);
|
|
row.TryGetValue("V", out object vb);
|
|
row.TryGetValue("W", out object vz1);
|
|
row.TryGetValue("Y", out object vz2);
|
|
row.TryGetValue("AA", out object vz3);
|
|
string mstr = month.ToString();
|
|
decimal m = mstr.Contains("周") ? (mstr.Substring(0, mstr.Length - 1).ToDecimal() / 4.0m).ToDecimal(2) : (mstr.Contains("月") ? mstr.Substring(0, mstr.Length - 1).ToDecimal(2) : month.ToDecimal(2));
|
|
if (mstr.Contains("周") && (m == 1m || m == 2m || m == 3m))
|
|
{
|
|
m = m - 0.1m;
|
|
}
|
|
insertlist.Add(new YB_NewWeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
insertlist.Add(new YB_NewWeightStand
|
|
{
|
|
f3sd = vf3.ToDecimal(1),
|
|
f2sd = vf2.ToDecimal(1),
|
|
f1sd = vf1.ToDecimal(1),
|
|
median = vb.ToDecimal(1),
|
|
z1sd = vz1.ToDecimal(1),
|
|
z2sd = vz2.ToDecimal(1),
|
|
z3sd = vz3.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 0-18岁BMI标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_BmiStand") && await Db.Queryable<YB_BmiStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "0~18岁身高体重BMI头围数据及分段.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "bmi");
|
|
var list = query.ToList();
|
|
var insertlist = new List<YB_BmiStand>();
|
|
for (var i = 3; i < list.Count() - 2; i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("A", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object nf1);
|
|
row.TryGetValue("C", out object nb);
|
|
row.TryGetValue("D", out object nz1);
|
|
row.TryGetValue("E", out object nz2);
|
|
row.TryGetValue("F", out object vf1);
|
|
row.TryGetValue("G", out object vb);
|
|
row.TryGetValue("H", out object vz1);
|
|
row.TryGetValue("I", out object vz2);
|
|
string mstr = month.ToString();
|
|
decimal m = 0;
|
|
if (mstr.Contains("~"))
|
|
{
|
|
var arr = mstr.Split('~');
|
|
m = arr[0].ToDecimal(1);
|
|
}
|
|
else
|
|
{
|
|
m = mstr.ToDecimal(1) + 0.5m;
|
|
}
|
|
insertlist.Add(new YB_BmiStand
|
|
{
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m * 12
|
|
});
|
|
insertlist.Add(new YB_BmiStand
|
|
{
|
|
f1sd = vf1.ToDecimal(1),
|
|
median = vb.ToDecimal(1),
|
|
z1sd = vz1.ToDecimal(1),
|
|
z2sd = vz2.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m * 12
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 0-7岁儿童头围标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("YB_HeadStand") && await Db.Queryable<YB_HeadStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "0~18岁身高体重BMI头围数据及分段.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "head");
|
|
var list = query.ToList();
|
|
var insertlist = new List<YB_HeadStand>();
|
|
for (var i = 2; i < list.Count() - 2; i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("C", out object nf3);
|
|
row.TryGetValue("D", out object nf2);
|
|
row.TryGetValue("E", out object nf1);
|
|
row.TryGetValue("F", out object nb);
|
|
row.TryGetValue("G", out object nz1);
|
|
row.TryGetValue("H", out object nz2);
|
|
row.TryGetValue("I", out object nz3);
|
|
|
|
row.TryGetValue("J", out object vf3);
|
|
row.TryGetValue("K", out object vf2);
|
|
row.TryGetValue("L", out object vf1);
|
|
row.TryGetValue("M", out object vb);
|
|
row.TryGetValue("N", out object vz1);
|
|
row.TryGetValue("O", out object vz2);
|
|
row.TryGetValue("P", out object vz3);
|
|
decimal m = month.ToDecimal(0);
|
|
insertlist.Add(new YB_HeadStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
insertlist.Add(new YB_HeadStand
|
|
{
|
|
f3sd = vf3.ToDecimal(1),
|
|
f2sd = vf2.ToDecimal(1),
|
|
f1sd = vf1.ToDecimal(1),
|
|
median = vb.ToDecimal(1),
|
|
z1sd = vz1.ToDecimal(1),
|
|
z2sd = vz2.ToDecimal(1),
|
|
z3sd = vz3.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 安邦0-18岁身高标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("AB_HeightStand") && await Db.Queryable<AB_HeightStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "【安邦数据】0-18岁儿童青少年身高百分位数值表(1).xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "男-身高");
|
|
var insertlist = new List<AB_HeightStand>();
|
|
for (var i = 4; i < query.Count(); i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("A", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object nf3);
|
|
row.TryGetValue("C", out object nf2);
|
|
row.TryGetValue("D", out object nf1);
|
|
row.TryGetValue("E", out object nb);
|
|
row.TryGetValue("F", out object nz1);
|
|
row.TryGetValue("G", out object nz2);
|
|
row.TryGetValue("H", out object nz3);
|
|
string mstr = month.ToString();
|
|
decimal m = AnalyMonthByAb(mstr);
|
|
insertlist.Add(new AB_HeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
|
|
query = await MiniExcel.QueryAsync(filepath, sheetName: "女-身高");
|
|
for (var i = 4; i < query.Count(); i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("A", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object nf3);
|
|
row.TryGetValue("C", out object nf2);
|
|
row.TryGetValue("D", out object nf1);
|
|
row.TryGetValue("E", out object nb);
|
|
row.TryGetValue("F", out object nz1);
|
|
row.TryGetValue("G", out object nz2);
|
|
row.TryGetValue("H", out object nz3);
|
|
string mstr = month.ToString();
|
|
decimal m = AnalyMonthByAb(mstr);
|
|
insertlist.Add(new AB_HeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 安邦0-18岁体重标准种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("AB_WeightStand") && await Db.Queryable<AB_WeightStand>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "【安邦数据】0-18岁儿童青少年身高百分位数值表(1).xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath, sheetName: "男-体重");
|
|
var insertlist = new List<AB_WeightStand>();
|
|
for (var i = 4; i < query.Count(); i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("A", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object nf3);
|
|
row.TryGetValue("C", out object nf2);
|
|
row.TryGetValue("D", out object nf1);
|
|
row.TryGetValue("E", out object nb);
|
|
row.TryGetValue("F", out object nz1);
|
|
row.TryGetValue("G", out object nz2);
|
|
row.TryGetValue("H", out object nz3);
|
|
string mstr = month.ToString();
|
|
decimal m = AnalyMonthByAb(mstr);
|
|
insertlist.Add(new AB_WeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.Male,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
|
|
query = await MiniExcel.QueryAsync(filepath, sheetName: "女-体重");
|
|
for (var i = 4; i < query.Count(); i++)
|
|
{
|
|
var row = query.ElementAt(i) as IDictionary<string, object>;
|
|
if (row == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("A", out object month);
|
|
if (month == null)
|
|
{
|
|
continue;
|
|
}
|
|
row.TryGetValue("B", out object nf3);
|
|
row.TryGetValue("C", out object nf2);
|
|
row.TryGetValue("D", out object nf1);
|
|
row.TryGetValue("E", out object nb);
|
|
row.TryGetValue("F", out object nz1);
|
|
row.TryGetValue("G", out object nz2);
|
|
row.TryGetValue("H", out object nz3);
|
|
string mstr = month.ToString();
|
|
decimal m = AnalyMonthByAb(mstr);
|
|
insertlist.Add(new AB_WeightStand
|
|
{
|
|
f3sd = nf3.ToDecimal(1),
|
|
f2sd = nf2.ToDecimal(1),
|
|
f1sd = nf1.ToDecimal(1),
|
|
median = nb.ToDecimal(1),
|
|
z1sd = nz1.ToDecimal(1),
|
|
z2sd = nz2.ToDecimal(1),
|
|
z3sd = nz3.ToDecimal(1),
|
|
Sex = GenderType.FeMale,
|
|
Id = IDGen.NextID(),
|
|
Month = m
|
|
});
|
|
}
|
|
await Db.Insertable(insertlist).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
|
|
#region 安邦儿童处方种子初始化
|
|
if (Db.DbMaintenance.IsAnyTable("AB_Prescription") && await Db.Queryable<AB_Prescription>().CountAsync() == 0)
|
|
{
|
|
//获取项目主目录
|
|
var path = Path.GetFullPath("../../..");
|
|
string filepath = Path.Combine(path, "安邦-处方分年龄.xlsx");
|
|
var query = await MiniExcel.QueryAsync(filepath);
|
|
var list = query.ToList();
|
|
var insertlist1 = new List<AB_PrescriptionByAge>();
|
|
var nowtime = DateTime.Now;
|
|
var tlist = new List<AB_Prescription>();
|
|
var Nutrition = list[2];
|
|
var sport = list[3];
|
|
var sport0_1 = list[4];
|
|
var sport1_3 = list[5];
|
|
var sport3_7 = list[6];
|
|
var sport8_16 = list[7];
|
|
var sleep = list[8];
|
|
var sleep0_3 = list[9];
|
|
var sleep4_11 = list[10];
|
|
var sleep1_2 = list[11];
|
|
var sleep3_5 = list[12];
|
|
var sleep6_13 = list[13];
|
|
var sleep14_17 = list[14];
|
|
var mood = list[15];
|
|
var mood0_1 = list[16];
|
|
var mood1_3 = list[17];
|
|
var mood3_7 = list[18];
|
|
var mood8_12 = list[19];
|
|
var mood13_16 = list[20];
|
|
#region 全年龄
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.C,
|
|
Nutrition = Nutrition.C,
|
|
Level = 1,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.D,
|
|
Nutrition = Nutrition.D,
|
|
Level = 2,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.E,
|
|
Nutrition = Nutrition.E,
|
|
Level = 3,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.F,
|
|
Nutrition = Nutrition.F,
|
|
Level = 4,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.G,
|
|
Nutrition = Nutrition.G,
|
|
Level = 5,
|
|
Type = PrescriptionType.Height
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.H,
|
|
Nutrition = Nutrition.H,
|
|
Level = 1,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.I,
|
|
Nutrition = Nutrition.I,
|
|
Level = 2,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.J,
|
|
Nutrition = Nutrition.J,
|
|
Level = 3,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.K,
|
|
Nutrition = Nutrition.K,
|
|
Level = 4,
|
|
Type = PrescriptionType.BMI
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.L,
|
|
Nutrition = Nutrition.L,
|
|
Level = 1,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.M,
|
|
Nutrition = Nutrition.M,
|
|
Level = 2,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
tlist.Add(new AB_Prescription
|
|
{
|
|
Id = IDGen.NextID(),
|
|
CreateTime = nowtime,
|
|
Sport = sport.N,
|
|
Nutrition = Nutrition.N,
|
|
Level = 3,
|
|
Type = PrescriptionType.Weight
|
|
});
|
|
#endregion
|
|
#region 运动分年龄
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sport,
|
|
MinAge = 0,
|
|
MaxAge = 1 * 12,
|
|
Content = sport0_1.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sport,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 3 * 12,
|
|
Content = sport1_3.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sport,
|
|
MinAge = 3 * 12,
|
|
MaxAge = 8 * 12,
|
|
Content = sport3_7.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sport,
|
|
MinAge = 8 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = sport8_16.C
|
|
});
|
|
#endregion
|
|
|
|
#region 睡眠分年龄
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = -1,
|
|
MaxAge = -1,
|
|
Content = sleep.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 0,
|
|
MaxAge = 4,
|
|
Content = sleep0_3.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 4,
|
|
MaxAge = 12,
|
|
Content = sleep4_11.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 2 * 12,
|
|
Content = sleep1_2.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 2 * 12,
|
|
MaxAge = 6 * 12,
|
|
Content = sleep3_5.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 6 * 12,
|
|
MaxAge = 13 * 12,
|
|
Content = sleep6_13.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Sleep,
|
|
MinAge = 13 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = sleep14_17.C
|
|
});
|
|
#endregion
|
|
#region 情绪分年龄
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = -1,
|
|
MaxAge = -1,
|
|
Content = mood.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = 0,
|
|
MaxAge = 1 * 12,
|
|
Content = mood0_1.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = 1 * 12,
|
|
MaxAge = 3 * 12,
|
|
Content = mood1_3.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = 3 * 12,
|
|
MaxAge = 8 * 12,
|
|
Content = mood3_7.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = 8 * 12,
|
|
MaxAge = 12 * 12,
|
|
Content = mood8_12.C
|
|
});
|
|
insertlist1.Add(new AB_PrescriptionByAge
|
|
{
|
|
Id = IDGen.NextID(),
|
|
Type = PrescriptionAdviceType.Mood,
|
|
MinAge = 12 * 12,
|
|
MaxAge = 17 * 12,
|
|
Content = mood13_16.C
|
|
});
|
|
#endregion
|
|
|
|
await Db.Insertable(tlist).ExecuteCommandAsync();
|
|
await Db.Insertable(insertlist1).ExecuteCommandAsync();
|
|
}
|
|
#endregion
|
|
await new ImportZYTZ().InsertQAAsync(Db);
|
|
await new ImportZYTZ().InsertBodyAsync(Db);
|
|
}
|
|
/// <summary>
|
|
/// 安邦月龄解析
|
|
/// </summary>
|
|
/// <param name="month"></param>
|
|
/// <returns></returns>
|
|
private decimal AnalyMonthByAb(string month)
|
|
{
|
|
if (month.Contains("出生"))
|
|
{
|
|
return 0;
|
|
}
|
|
if (month.Contains("月") && month.Contains("岁"))
|
|
{
|
|
month = month.Replace("月", "");
|
|
string[] arr = month.Split('岁');
|
|
return arr[0].ToDecimal(2) * 12 + arr[1].ToDecimal(2);
|
|
}
|
|
if (month.Contains("月"))
|
|
{
|
|
month = month.Replace("月", "");
|
|
return month.ToDecimal(2);
|
|
}
|
|
if (month.Contains("岁"))
|
|
{
|
|
month = month.Replace("岁", "");
|
|
return month.ToDecimal(2) * 12;
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
}
|