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.
 
 
 
 
 
 

2011 lines
97 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FastReport.Editor;
using Report.Entity;
using Report.Entity.RptEntity;
using Spire.Pdf.Lists;
namespace PeisStart.WInForm.ReportTest
{
public class ConvertHelper
{
private const int EMPTY_VALUE = -1;
public static void RemoveEmptyRows(DataSet dataSet)
{
foreach (DataTable table in dataSet.Tables)
{
for (int i = 0; i < table.Rows.Count; i++)
{
bool isRowEmpty = false;
foreach (DataColumn column in table.Columns)
{
if (!string.IsNullOrEmpty(table.Rows[i][column].ToString()))
{
if (table.Rows[i][column].ToString().Equals("-1"))
{
isRowEmpty = true;
break;
};
}
}
if (isRowEmpty)
{
table.Rows[i].Delete();
}
}
}
}
private static List<piclog> ToPicTable(Dictionary<string, string> dict, string websiteUrl)
{
List<piclog> picList = new List<piclog>();
piclog pic = new piclog();
string key = "hisLog";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.photo = fullUri.AbsoluteUri;
}
key = "firstPage";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.firstPage = fullUri.AbsoluteUri;
}
key = "pageHeader";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.pageHeader = fullUri.AbsoluteUri;
}
key = "pageFooter";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.pageFooter = fullUri.AbsoluteUri;
}
key = "resultSign";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.resultSign = fullUri.AbsoluteUri;
}
key = "orgSign";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.orgSign = fullUri.AbsoluteUri;
}
key = "picExtOne";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtOne = fullUri.AbsoluteUri;
}
key = "picExtTwo";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtTwo = fullUri.AbsoluteUri;
}
key = "picExtThree";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtThree = fullUri.AbsoluteUri;
}
key = "picExtFour";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtFour = fullUri.AbsoluteUri;
}
key = "picExtFive";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtFive = fullUri.AbsoluteUri;
}
key = "picExtSix";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtSix = fullUri.AbsoluteUri;
}
key = "picExtSeven";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtSeven = fullUri.AbsoluteUri;
}
key = "picExtEight";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtEight = fullUri.AbsoluteUri;
}
key = "picExtNine";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtNine = fullUri.AbsoluteUri;
}
key = "picExtTen";
if (dict.ContainsKey(key) == true)
{
var baseUri = new Uri(websiteUrl);
var fullUri = new Uri(baseUri, dict[key]);
pic.picExtTen = fullUri.AbsoluteUri;
}
picList.Add(pic);
return picList;
}
public static async Task<DataSet> ReportHealthToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, string imageUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string json = FileHelper.ReadAllText(filePath);
Dto0005 bill = ClientConfig.DeserializeObject<Dto0005>(json);
List<DictMedicalReportType> dictMedicalTypeList = new List<DictMedicalReportType>();
foreach (var item in bill.medicalReportTypes)
{
DictMedicalReportType dictmedicalreporttype = new DictMedicalReportType()
{
medicalReportTypeId = item.medicalReportTypeId,
medicalReportTypeName = item.medicalReportTypeName,
displayOrder = item.displayOrder,
};
dictMedicalTypeList.Add(dictmedicalreporttype);
}
List<HRPatientRegister> pHealthList = new List<HRPatientRegister>();
HRPatientRegister pHealth = new HRPatientRegister()
{
patientRegisterId = bill.patientRegisterId,
isPersonal = bill.isPersonal,
customerOrgName = bill.customerOrgName,
departmentName = bill.departmentName,
patientRegisterNo = bill.patientRegisterNo,
barcodeImg = BarCodeHelper.BuildBarCode(bill.patientRegisterNo),
patientNo = bill.patientNo,
idNo = bill.idNo,
medicalTimes = bill.medicalTimes,
patientName = bill.patientName,
sexName = bill.sexName,
age = bill.age == null ? "" : Convert.ToString(bill.age),
birthDate = bill.birthDate == null ? "" : Convert.ToDateTime(bill.birthDate).ToString("yyyy-MM-dd"),
maritalStatusName = bill.maritalStatusName,
nationName = bill.nationName,
mobileTelephone = bill.mobileTelephone,
isVip = bill.isVip,
medicalStartDate = bill.medicalStartDate.Replace("T", " ").Substring(0, 19),
medicalTypeName = bill.medicalTypeName,
personnelTypeName = bill.personnelTypeName,
medicalPackageOrCustomerOrgGroupName = bill.medicalPackageOrCustomerOrgGroupName,
summaryDoctorName = bill.summaryDoctorName,
summaryDoctorSignUrl = bill.summaryDoctorSignUrl,
summaryDate = bill.summaryDate,
auditDoctorName = bill.auditDoctorName,
auditDoctorSignUrl = bill.auditDoctorSignUrl,
auditDate = bill.auditDate,
medicalCenterId = bill.medicalCenterId,
medicalCenterName = bill.medicalCenterName,
medicalCenterAddress = bill.medicalCenterAddress,
medicalCenterTelphone = bill.medicalCenterTelphone,
};
pHealthList.Add(pHealth);
List<HRSumSummary> pSumList = new List<HRSumSummary>();
List<HRSummaryContent> pContentList = new List<HRSummaryContent>();
foreach (var item in bill.sumSummarys)
{
HRSumSummary hrsumsummary = new HRSumSummary()
{
summaryTitle = item.summaryTitle,
summaryFlag = item.summaryFlag,
displayOrder = item.displayOrder,
};
foreach (var content in item.summaryContents)
{
HRSummaryContent hrsummarycontent = new HRSummaryContent()
{
summaryTitle = item.summaryTitle,
summaryContent = content.summaryContent,
displayOrder = content.displayOrder,
};
pContentList.Add(hrsummarycontent);
}
pSumList.Add(hrsumsummary);
}
if (pSumList.Count == 0)
{
HRSumSummary hrsumsummary = new HRSumSummary() { displayOrder = EMPTY_VALUE };
pSumList.Add(hrsumsummary);
}
if (pContentList.Count == 0)
{
HRSummaryContent hrsummarycontent = new HRSummaryContent() { displayOrder = EMPTY_VALUE };
pContentList.Add(hrsummarycontent);
}
List<HRSuggestion> pSugList = new List<HRSuggestion>();
List<HRSugMedicalInterpretation> pMedList = new List<HRSugMedicalInterpretation>();
List<HRSugCommonReason> pReasonList = new List<HRSugCommonReason>();
List<HRSugHealthGuidance> pGuideList = new List<HRSugHealthGuidance>();
int orderNo = 0;
string text = string.Empty;
foreach (var item in bill.sumSuggestions)
{
HRSuggestion hrsuggestion = new HRSuggestion()
{
suggestionTitle = item.suggestionTitle,
suggestionFlag = item.suggestionFlag,
displayOrder = item.displayOrder,
};
orderNo = 0;
text = "{医学解释}";
var medicalInterSortList = item.medicalInterpretations.OrderBy(o => o.displayOrder).ToList();
foreach (var med in medicalInterSortList)
{
HRSugMedicalInterpretation hrsugmedicalinterpretation = new HRSugMedicalInterpretation()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = med.suggestionContent,
displayOrder = med.displayOrder,
};
orderNo++;
pMedList.Add(hrsugmedicalinterpretation);
if (medicalInterSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, med.suggestionContent);
else
{
text += string.Format("{0}", med.suggestionContent);
}
}
if (medicalInterSortList.Count > 0) hrsuggestion.medicalText = text;
orderNo = 0;
text = "{常见原因}";
var commonReasonSortList = item.commonReasons.OrderBy(o => o.displayOrder).ToList();
foreach (var reason in commonReasonSortList)
{
HRSugCommonReason hrsugcommonreason = new HRSugCommonReason()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = reason.suggestionContent,
displayOrder = reason.displayOrder,
};
orderNo++;
pReasonList.Add(hrsugcommonreason);
if (commonReasonSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, reason.suggestionContent);
else
{
text += string.Format("{0}", reason.suggestionContent);
}
}
if (commonReasonSortList.Count > 0) hrsuggestion.reasonText = text;
orderNo = 0;
text = "{健康指导}";
var healthGuidSortList = item.healthGuidances.OrderBy(o => o.displayOrder).ToList();
foreach (var guide in healthGuidSortList)
{
HRSugHealthGuidance hrsughealthguidance = new HRSugHealthGuidance()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = guide.suggestionContent,
displayOrder = guide.displayOrder,
};
orderNo++;
pGuideList.Add(hrsughealthguidance);
if (healthGuidSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, guide.suggestionContent);
else
{
text += string.Format("{0}", guide.suggestionContent);
}
}
if (healthGuidSortList.Count > 0) hrsuggestion.guideText = text;
pSugList.Add(hrsuggestion);
}
if (pSugList.Count == 0)
{
HRSuggestion hrsuggestion = new HRSuggestion() { displayOrder = EMPTY_VALUE }; ;
pSugList.Add(hrsuggestion);
}
if (pMedList.Count == 0)
{
HRSugMedicalInterpretation hrsugmedicalinterpretation = new HRSugMedicalInterpretation() { displayOrder = EMPTY_VALUE };
pMedList.Add(hrsugmedicalinterpretation);
}
if (pReasonList.Count == 0)
{
HRSugCommonReason hrsugcommonreason = new HRSugCommonReason() { displayOrder = EMPTY_VALUE };
pReasonList.Add(hrsugcommonreason);
}
if (pGuideList.Count == 0)
{
HRSugHealthGuidance hrsughealthguidance = new HRSugHealthGuidance() { displayOrder = EMPTY_VALUE };
pGuideList.Add(hrsughealthguidance);
}
List<RegisterCheckItemType> pItemTypeList = new List<RegisterCheckItemType>();
List<RegisterCheckAsbitem> pAsbitemList = new List<RegisterCheckAsbitem>();
List<RegisterCheckItem> pCheckItemList = new List<RegisterCheckItem>();
List<RegisterCheckPircture> pPirctureList = new List<RegisterCheckPircture>();
List<RegisterCheckSummary> pSummaryList = new List<RegisterCheckSummary>();
List<DictExamItemType> dExamItemTypeList = new List<DictExamItemType>();
List<DictNotExamItemType> dNotExamItemTypeList = new List<DictNotExamItemType>();
List<HBsAgAsbitem> dHBsAgList = new List<HBsAgAsbitem>();
List<RegisterCheckPirctureHorizontal> pPirctureListHorizontal = new List<RegisterCheckPirctureHorizontal>();
string previousItemTypeId = "", previousAsbitemNames = "";
int absitemOrderNo = 0;
orderNo = 0;
text = "";
var registerCheckSortList = bill.registerChecks.OrderBy(o => o.displayOrder).ToList();
foreach (var asbitem in registerCheckSortList)
{
if (previousItemTypeId != asbitem.itemTypeId)
{
ItemType type = bill.itemTypes.Where(p => (p.itemTypeId.Equals(asbitem.itemTypeId))).FirstOrDefault();
if (type != null)
{
RegisterCheckItemType registercheckitemtype = new RegisterCheckItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
if (type.medicalReportTypeId.Equals("3"))
{
DictExamItemType dictexamitemtype = new DictExamItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypePathCode = type.itemTypePathCode,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
dExamItemTypeList.Add(dictexamitemtype);
}
else
{
DictNotExamItemType dictnotexamitemtype = new DictNotExamItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypePathCode = type.itemTypePathCode,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
dNotExamItemTypeList.Add(dictnotexamitemtype);
}
pItemTypeList.Add(registercheckitemtype);
}
previousItemTypeId = asbitem.itemTypeId;
}
if (previousAsbitemNames != asbitem.asbitemNames)
{
previousAsbitemNames = asbitem.asbitemNames;
absitemOrderNo++;
}
RegisterCheckAsbitem registercheckasbitem = new RegisterCheckAsbitem()
{
itemTypeId = asbitem.itemTypeId,
asbitemNames = asbitem.asbitemNames,
absOrderNo = absitemOrderNo,
displayOrder = asbitem.displayOrder,
checkDoctorName = asbitem.checkDoctorName,
checkDoctorSignUrl = asbitem.checkDoctorSignUrl,
checkDate = asbitem.checkDate.Replace("T", " ").Substring(0, 19),
auditorName = asbitem.auditorName,
auditorSignUrl = asbitem.auditorSignUrl,
lisSampleNo = asbitem.lisSampleNo,
};
if (asbitem.asbitemNames.Contains("乙肝"))
{
HBsAgAsbitem hb = new HBsAgAsbitem()
{
itemTypeId = asbitem.itemTypeId,
asbitemNames = asbitem.asbitemNames,
absOrderNo = absitemOrderNo,
displayOrder = asbitem.displayOrder,
checkDoctorName = asbitem.checkDoctorName,
checkDoctorSignUrl = asbitem.checkDoctorSignUrl,
checkDate = asbitem.checkDate.Replace("T", " ").Substring(0, 19),
auditorName = asbitem.auditorName,
auditorSignUrl = asbitem.auditorSignUrl,
lisSampleNo = asbitem.lisSampleNo,
};
dHBsAgList.Add(hb);
}
foreach (var item in asbitem.items)
{
RegisterCheckItem registercheckitem = new RegisterCheckItem()
{
asbitemNames = asbitem.asbitemNames,
itemId = item.itemId,
itemName = item.itemName,
result = item.result,
referenceRangeValue = item.referenceRangeValue,
criticalRangeValue = item.criticalRangeValue,
unit = item.unit,
reportFontColor = item.reportFontColor,
reportBackgroundColor = item.reportBackgroundColor,
reportPrompt = item.reportPrompt,
displayOrder = item.displayOrder,
};
pCheckItemList.Add(registercheckitem);
}
foreach (var pic in asbitem.pictures)
{
var baseUri = new Uri(imageUrl);
var fullUri = new Uri(baseUri, pic.pictureFileName);
RegisterCheckPircture registercheckpircture = new RegisterCheckPircture()
{
asbitemNames = asbitem.asbitemNames,
pictureFileName = fullUri.AbsoluteUri,
pictureFileType = pic.pictureFileType,
itemTypeName = pic.itemTypeName,
pictureBase64 = pic.pictureBase64,
displayOrder = pic.displayOrder,
};
pPirctureList.Add(registercheckpircture);
}
var grouped = pPirctureList.GroupBy(x => x.asbitemNames).ToList();
foreach (var group in grouped)
{
var existingItem = pPirctureListHorizontal.FirstOrDefault(item => item.asbitemNames == group.Key);
if (existingItem == null)
{
RegisterCheckPirctureHorizontal newItem = new RegisterCheckPirctureHorizontal
{
asbitemNames = group.Key
};
var pictures = group.Select(x => x.pictureFileName).Take(6).ToList();
if (pictures.Count > 0) newItem.pictureHorizontalOne = pictures.ElementAtOrDefault(0);
if (pictures.Count > 1) newItem.pictureHorizontalTwo = pictures.ElementAtOrDefault(1);
if (pictures.Count > 2) newItem.pictureHorizontalThree = pictures.ElementAtOrDefault(2);
if (pictures.Count > 3) newItem.pictureHorizontalFour = pictures.ElementAtOrDefault(3);
if (pictures.Count > 4) newItem.pictureHorizontalFive = pictures.ElementAtOrDefault(4);
if (pictures.Count > 5) newItem.pictureHorizontalSix = pictures.ElementAtOrDefault(5);
newItem.pictureCount = pictures.Count; // 设置实际转换的行数
var ext = group.Where(p => p.asbitemNames.Equals(group.Key)).FirstOrDefault();
if (ext != null)
{
newItem.itemTypeName = ext.itemTypeName;
newItem.displayOrder = ext.displayOrder;
}
pPirctureListHorizontal.Add(newItem);
}
}
orderNo = 0;
text = "";
var summarysSortList = asbitem.summarys.OrderBy(o => o.displayOrder).ToList();
foreach (var sum in summarysSortList)
{
RegisterCheckSummary registerchecksummary = new RegisterCheckSummary()
{
asbitemNames = asbitem.asbitemNames,
summary = sum.summary,
displayOrder = sum.displayOrder,
};
orderNo++;
if (summarysSortList.Count > 1)
text += string.Format("{0}:{1}", orderNo, sum.summary);
else
{
text = string.Format("{0}", sum.summary);
}
pSummaryList.Add(registerchecksummary);
}
if (summarysSortList.Count > 0) registercheckasbitem.summarysText = text;
pAsbitemList.Add(registercheckasbitem);
}
List<CheckTarget> checkTargetOne = new List<CheckTarget>();
List<CheckTarget> checkTargetTwo = new List<CheckTarget>();
List<CheckTarget> checkTargetThree = new List<CheckTarget>();
List<CheckTarget> checkTargetFour = new List<CheckTarget>();
List<CheckTarget> checkTargetFive = new List<CheckTarget>();
List<CheckTarget> checkTargetSix = new List<CheckTarget>();
var groupedItem = bill.ItemContrasts.GroupBy(x => x.asbitemName).ToList();
int tagIndex = 1;
string itemReferenceRange = "", tempItemName;
foreach (var group in groupedItem)
{
var targets = bill.ItemContrasts.Where(x => x.asbitemName.Equals(group.Key));
foreach (var target in targets)
{
var groupedRange = targets.GroupBy(x => x.itemName).ToList();
if (groupedRange.Count == 1)
{
itemReferenceRange = targets.Max(x => x.itemReferenceRange);
}
if (groupedRange.Count > 1)
{
foreach (var item in groupedRange)
{
tempItemName = targets.Where(p => p.itemReferenceRange.Equals(item.Key)).FirstOrDefault().itemName;
itemReferenceRange += string.Format("{0}:{1} ", tempItemName, item.Key);
}
}
CheckTarget checkTarget = new CheckTarget()
{
asbitemName = target.asbitemName,
itemName = target.itemName,
itemReferenceRange = itemReferenceRange,
itemResult = target.itemResult,
medicalStartDate = target.medicalStartDate,
displayOrder = 1
};
if (tagIndex == 1)
checkTargetOne.Add(checkTarget);
else if (tagIndex == 2)
checkTargetTwo.Add(checkTarget);
else if (tagIndex == 3)
checkTargetThree.Add(checkTarget);
else if (tagIndex == 4)
checkTargetFour.Add(checkTarget);
else if (tagIndex == 5)
checkTargetFive.Add(checkTarget);
else if (tagIndex == 6)
checkTargetSix.Add(checkTarget);
}
tagIndex++;
}
if (checkTargetOne.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetOne.Add(checkTarget);
}
if (checkTargetTwo.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetTwo.Add(checkTarget);
}
if (checkTargetThree.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetThree.Add(checkTarget);
}
if (checkTargetFour.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetFour.Add(checkTarget);
}
if (checkTargetFive.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetFive.Add(checkTarget);
}
if (checkTargetSix.Count == 0)
{
CheckTarget checkTarget = new CheckTarget() { displayOrder = EMPTY_VALUE }; ;
checkTargetSix.Add(checkTarget);
}
if (dExamItemTypeList.Count == 0)
{
DictExamItemType dictexamitemtype = new DictExamItemType() { displayOrder = EMPTY_VALUE }; ;
dExamItemTypeList.Add(dictexamitemtype);
}
if (dNotExamItemTypeList.Count == 0)
{
DictNotExamItemType dictnotexamitemtype = new DictNotExamItemType() { displayOrder = EMPTY_VALUE }; ;
dNotExamItemTypeList.Add(dictnotexamitemtype);
}
if (dHBsAgList.Count == 0)
{
HBsAgAsbitem hb = new HBsAgAsbitem() { displayOrder = EMPTY_VALUE }; ;
dHBsAgList.Add(hb);
}
if (pItemTypeList.Count == 0)
{
RegisterCheckItemType registercheckitemtype = new RegisterCheckItemType() { displayOrder = EMPTY_VALUE }; ;
pItemTypeList.Add(registercheckitemtype);
}
if (pAsbitemList.Count == 0)
{
RegisterCheckAsbitem registercheckasbitem = new RegisterCheckAsbitem() { absOrderNo = EMPTY_VALUE, displayOrder = EMPTY_VALUE };
pAsbitemList.Add(registercheckasbitem);
}
if (pCheckItemList.Count == 0)
{
RegisterCheckItem registercheckitem = new RegisterCheckItem() { reportFontColor = EMPTY_VALUE, reportBackgroundColor = EMPTY_VALUE, displayOrder = EMPTY_VALUE };
pCheckItemList.Add(registercheckitem);
}
if (pPirctureList.Count == 0)
{
RegisterCheckPircture registercheckpircture = new RegisterCheckPircture() { displayOrder = EMPTY_VALUE };
pPirctureList.Add(registercheckpircture);
}
if (pPirctureListHorizontal.Count == 0)
{
RegisterCheckPirctureHorizontal registercheckpircture = new RegisterCheckPirctureHorizontal() { displayOrder = EMPTY_VALUE };
pPirctureListHorizontal.Add(registercheckpircture);
}
if (pSummaryList.Count == 0)
{
RegisterCheckSummary registerchecksummary = new RegisterCheckSummary() { displayOrder = EMPTY_VALUE };
pSummaryList.Add(registerchecksummary);
}
Rpt0005 hrpersonhealth = new Rpt0005()
{
dictMedType = dictMedicalTypeList,
dictExamItemType = dExamItemTypeList,
dictNotExamItemType = dNotExamItemTypeList,
pinfo = pHealthList,
resItemType = pItemTypeList,
resAsbitem = pAsbitemList,
res = pCheckItemList,
resPic = pPirctureList,
resPicHorizontal = pPirctureListHorizontal,
resSum = pSummaryList,
sug = pSugList,
sugReason = pReasonList,
sugGuide = pGuideList,
sugMeical = pMedList,
summ = pSumList,
summContent = pContentList,
pic = ToPicTable(dict, websiteUrl),
HBsAg = dHBsAgList,
checkTargetOne = checkTargetOne,
checkTargetTwo = checkTargetTwo,
checkTargetThree = checkTargetThree,
checkTargetFour = checkTargetFour,
checkTargetFive = checkTargetFive,
checkTargetSix = checkTargetSix,
};
string dataSetJson = ClientConfig.SerializeObject(hrpersonhealth);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
RemoveEmptyRows(dSet);
return dSet;
}
public static async Task<DataSet> OccupationalDiseaseToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, string imageUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string json = FileHelper.ReadAllText(filePath);
Report.Entity.PeisEntity.OccupationalDisease.Dto0006 bill = ClientConfig.DeserializeObject<Report.Entity.PeisEntity.OccupationalDisease.Dto0006>(json);
List<DictMedicalReportType> dictMedicalTypeList = new List<DictMedicalReportType>();
foreach (var item in bill.medicalReportTypes)
{
DictMedicalReportType dictmedicalreporttype = new DictMedicalReportType()
{
medicalReportTypeId = item.medicalReportTypeId,
medicalReportTypeName = item.medicalReportTypeName,
displayOrder = item.displayOrder,
};
dictMedicalTypeList.Add(dictmedicalreporttype);
}
List<HRPatientRegister> pHealthList = new List<HRPatientRegister>();
HRPatientRegister pHealth = new HRPatientRegister()
{
patientRegisterId = bill.patientRegisterId,
isPersonal = bill.isPersonal,
customerOrgName = bill.customerOrgName,
departmentName = bill.departmentName,
patientRegisterNo = bill.patientRegisterNo,
barcodeImg = BarCodeHelper.BuildBarCode(bill.patientRegisterNo),
patientNo = bill.patientNo,
idNo = bill.idNo,
medicalTimes = bill.medicalTimes,
patientName = bill.patientName,
sexName = bill.sexName,
age = bill.age == null ? "" : Convert.ToString(bill.age),
birthDate = bill.birthDate == null ? "" : Convert.ToDateTime(bill.birthDate).ToString("yyyy-MM-dd"),
maritalStatusName = bill.maritalStatusName,
nationName = bill.nationName,
mobileTelephone = bill.mobileTelephone,
isVip = bill.isVip,
medicalStartDate = bill.medicalStartDate.Replace("T", " ").Substring(0, 19),
medicalTypeName = bill.medicalTypeName,
personnelTypeName = bill.personnelTypeName,
medicalPackageOrCustomerOrgGroupName = bill.medicalPackageOrCustomerOrgGroupName,
summaryDoctorName = bill.summaryDoctorName,
summaryDoctorSignUrl = bill.summaryDoctorSignUrl,
summaryDate = bill.summaryDate,
auditDoctorName = bill.auditDoctorName,
auditDoctorSignUrl = bill.auditDoctorSignUrl,
auditDate = bill.auditDate,
medicalCenterId = bill.medicalCenterId,
medicalCenterName = bill.medicalCenterName,
medicalCenterAddress = bill.medicalCenterAddress,
medicalCenterTelphone = bill.medicalCenterTelphone,
};
pHealthList.Add(pHealth);
List<PatientOccupationalDisease> pOccDisList = new List<PatientOccupationalDisease>();
PatientOccupationalDisease patientoccupationaldisease = new PatientOccupationalDisease()
{
ocCheckTypeId = bill.patientOccupationalDisease.ocCheckTypeId,
ocCheckTypeName = bill.patientOccupationalDisease.ocCheckTypeName,
jobType = bill.patientOccupationalDisease.jobType,
totalWorkTime = bill.patientOccupationalDisease.totalWorkTime,
poisonWorkTime = bill.patientOccupationalDisease.poisonWorkTime,
riskFactors = bill.patientOccupationalDisease.riskFactors,
familyGeneticHistory = bill.patientOccupationalDisease.familyGeneticHistory,
lastMenstrualPeriodDate = bill.patientOccupationalDisease.lastMenstrualPeriodDate,
firstMenstruation = bill.patientOccupationalDisease.firstMenstruation,
menstruationTimeLength = bill.patientOccupationalDisease.menstruationTimeLength,
menstruationCycle = bill.patientOccupationalDisease.menstruationCycle,
menstruationEndAge = bill.patientOccupationalDisease.menstruationEndAge,
menstruationFlag = bill.patientOccupationalDisease.menstruationFlag,
childrenNum = bill.patientOccupationalDisease.childrenNum,
abortionTimes = bill.patientOccupationalDisease.abortionTimes,
prematureBirthTimes = bill.patientOccupationalDisease.abortionTimes,
stillbirthTimes = bill.patientOccupationalDisease.stillbirthTimes,
abnormalTimes = bill.patientOccupationalDisease.abnormalTimes,
smokeFlag = bill.patientOccupationalDisease.smokeFlag,
smokeNum = bill.patientOccupationalDisease.smokeNum == null ? "" : Convert.ToString(bill.patientOccupationalDisease.smokeNum),
smokeNumMax = bill.patientOccupationalDisease.smokeNumMax == null ? "" : Convert.ToString(bill.patientOccupationalDisease.smokeNumMax),
smokeYears = bill.patientOccupationalDisease.smokeYears == null ? "" : Convert.ToString(bill.patientOccupationalDisease.smokeYears),
drinkFlag = bill.patientOccupationalDisease.drinkFlag,
drinkNum = bill.patientOccupationalDisease.drinkNum == null ? "" : Convert.ToString(bill.patientOccupationalDisease.drinkNum),
drinkNumMax = bill.patientOccupationalDisease.drinkNumMax == null ? "" : Convert.ToString(bill.patientOccupationalDisease.drinkNumMax),
drinkYears = bill.patientOccupationalDisease.drinkYears == null ? "" : Convert.ToString(bill.patientOccupationalDisease.drinkYears),
other = bill.patientOccupationalDisease.other,
occupationalAbnormal = bill.patientOccupationalDisease.occupationalAbnormal,
noOccupationalAbnormal = bill.patientOccupationalDisease.noOccupationalAbnormal,
occupationalAbSuggestion = bill.patientOccupationalDisease.occupationalAbSuggestion,
noOccupAbSuggestion = bill.patientOccupationalDisease.noOccupAbSuggestion,
handleSuggestion = bill.patientOccupationalDisease.handleSuggestion,
};
pOccDisList.Add(patientoccupationaldisease);
List<OcCheckType> pOcCheckList = new List<OcCheckType>();
foreach (var item in bill.ocCheckTypeDtos)
{
OcCheckType occhecktype = new OcCheckType()
{
ocCheckTypeId = item.ocCheckTypeId,
displayName = item.displayName,
simpleCode = item.simpleCode,
displayOrder = item.displayOrder,
};
pOcCheckList.Add(occhecktype);
}
List<PatientOccupationalHistory> pPatOccHisList = new List<PatientOccupationalHistory>();
foreach (var item in bill.patientOccupationalHistoryDtos)
{
PatientOccupationalHistory patientoccupationalhistory = new PatientOccupationalHistory()
{
org = item.org,
beginDate = item.beginDate,
endDate = item.endDate,
workShop = item.workShop,
workType = item.workType,
poison = item.poison,
protectiveMeasures = item.protectiveMeasures,
displayOrder = item.displayOrder,
};
pPatOccHisList.Add(patientoccupationalhistory);
}
List<PatientOccupationalMedicalHistory> pPatOccMedHisList = new List<PatientOccupationalMedicalHistory>();
foreach (var item in bill.patientOccupationalMedicalHistoryDtos)
{
PatientOccupationalMedicalHistory patientoccupationalmedicalhistory = new PatientOccupationalMedicalHistory()
{
occupationalDisease = item.occupationalDisease,
diagnosisDate = item.diagnosisDate,
diagnosisHospital = item.diagnosisHospital,
isRecovery = item.isRecovery,
treatmentMethods = item.treatmentMethods,
displayOrder = item.displayOrder,
};
pPatOccMedHisList.Add(patientoccupationalmedicalhistory);
}
List<PatientPastMedicalHistory> pPatPastMedHisList = new List<PatientPastMedicalHistory>();
foreach (var item in bill.patientPastMedicalHistoryDtos)
{
PatientPastMedicalHistory patientpastmedicalhistory = new PatientPastMedicalHistory()
{
occupationalDisease = item.occupationalDisease,
diagnosisDate = item.diagnosisDate,
diagnosisHospital = item.diagnosisHospital,
isRecovery = item.isRecovery,
treatmentMethods = item.treatmentMethods,
displayOrder = item.displayOrder,
};
pPatPastMedHisList.Add(patientpastmedicalhistory);
}
List<PatientPoison> pPatPoiList = new List<PatientPoison>();
foreach (var item in bill.patientPoisonDtos)
{
PatientPoison patientpoison = new PatientPoison()
{
poisonName = item.poisonName,
occupationalAbnormalName = item.occupationalAbnormalName,
displayOrder = item.displayOrder,
};
pPatPoiList.Add(patientpoison);
}
List<PatientSymptom> pPatSymList = new List<PatientSymptom>();
foreach (var item in bill.patientSymptomDtos)
{
PatientSymptom patientsymptom = new PatientSymptom()
{
symptomName = item.symptomName,
degree = item.degree,
timeLength = item.timeLength,
displayOrder = item.displayOrder,
};
pPatSymList.Add(patientsymptom);
}
if (pOccDisList.Count == 0)
{
PatientOccupationalDisease patOccDis = new PatientOccupationalDisease();
pOccDisList.Add(patOccDis);
}
if (pOcCheckList.Count == 0)
{
OcCheckType patOccDis = new OcCheckType() { displayOrder = EMPTY_VALUE };
pOcCheckList.Add(patOccDis);
}
if (pPatOccHisList.Count == 0)
{
PatientOccupationalHistory patOccDis = new PatientOccupationalHistory() { displayOrder = EMPTY_VALUE };
pPatOccHisList.Add(patOccDis);
}
if (pPatOccMedHisList.Count == 0)
{
PatientOccupationalMedicalHistory patOccDis = new PatientOccupationalMedicalHistory() { displayOrder = EMPTY_VALUE };
pPatOccMedHisList.Add(patOccDis);
}
if (pPatPastMedHisList.Count == 0)
{
PatientPastMedicalHistory patOccDis = new PatientPastMedicalHistory() { displayOrder = EMPTY_VALUE };
pPatPastMedHisList.Add(patOccDis);
}
if (pPatPoiList.Count == 0)
{
PatientPoison patOccDis = new PatientPoison() { displayOrder = EMPTY_VALUE };
pPatPoiList.Add(patOccDis);
}
if (pPatSymList.Count == 0)
{
PatientSymptom patOccDis = new PatientSymptom() { displayOrder = EMPTY_VALUE };
pPatSymList.Add(patOccDis);
}
List<HRSumSummary> pSumList = new List<HRSumSummary>();
List<HRSummaryContent> pContentList = new List<HRSummaryContent>();
foreach (var item in bill.sumSummarys)
{
HRSumSummary hrsumsummary = new HRSumSummary()
{
summaryTitle = item.summaryTitle,
summaryFlag = item.summaryFlag,
displayOrder = item.displayOrder,
};
foreach (var content in item.summaryContents)
{
HRSummaryContent hrsummarycontent = new HRSummaryContent()
{
summaryTitle = item.summaryTitle,
summaryContent = content.summaryContent,
displayOrder = content.displayOrder,
};
pContentList.Add(hrsummarycontent);
}
pSumList.Add(hrsumsummary);
}
if (pSumList.Count == 0)
{
HRSumSummary hrsumsummary = new HRSumSummary() { displayOrder = EMPTY_VALUE };
pSumList.Add(hrsumsummary);
}
if (pContentList.Count == 0)
{
HRSummaryContent hrsummarycontent = new HRSummaryContent() { displayOrder = EMPTY_VALUE };
pContentList.Add(hrsummarycontent);
}
List<HRSuggestion> pSugList = new List<HRSuggestion>();
List<HRSugMedicalInterpretation> pMedList = new List<HRSugMedicalInterpretation>();
List<HRSugCommonReason> pReasonList = new List<HRSugCommonReason>();
List<HRSugHealthGuidance> pGuideList = new List<HRSugHealthGuidance>();
int orderNo = 0;
string text = string.Empty;
foreach (var item in bill.sumSuggestions)
{
HRSuggestion hrsuggestion = new HRSuggestion()
{
suggestionTitle = item.suggestionTitle,
suggestionFlag = item.suggestionFlag,
displayOrder = item.displayOrder,
};
orderNo = 0;
text = "{医学解释}";
var medicalInterSortList = item.medicalInterpretations.OrderBy(o => o.displayOrder).ToList();
foreach (var med in medicalInterSortList)
{
HRSugMedicalInterpretation hrsugmedicalinterpretation = new HRSugMedicalInterpretation()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = med.suggestionContent,
displayOrder = med.displayOrder,
};
orderNo++;
pMedList.Add(hrsugmedicalinterpretation);
if (medicalInterSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, med.suggestionContent);
else
{
text += string.Format("{0}", med.suggestionContent);
}
}
if (medicalInterSortList.Count > 0) hrsuggestion.medicalText = text;
orderNo = 0;
text = "{常见原因}";
var commonReasonSortList = item.commonReasons.OrderBy(o => o.displayOrder).ToList();
foreach (var reason in commonReasonSortList)
{
HRSugCommonReason hrsugcommonreason = new HRSugCommonReason()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = reason.suggestionContent,
displayOrder = reason.displayOrder,
};
orderNo++;
pReasonList.Add(hrsugcommonreason);
if (commonReasonSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, reason.suggestionContent);
else
{
text += string.Format("{0}", reason.suggestionContent);
}
}
if (commonReasonSortList.Count > 0) hrsuggestion.reasonText = text;
orderNo = 0;
text = "{健康指导}";
var healthGuidSortList = item.healthGuidances.OrderBy(o => o.displayOrder).ToList();
foreach (var guide in healthGuidSortList)
{
HRSugHealthGuidance hrsughealthguidance = new HRSugHealthGuidance()
{
suggestionTitle = item.suggestionTitle,
suggestionContent = guide.suggestionContent,
displayOrder = guide.displayOrder,
};
orderNo++;
pGuideList.Add(hrsughealthguidance);
if (healthGuidSortList.Count > 1)
text += string.Format("{0}、{1}", orderNo, guide.suggestionContent);
else
{
text += string.Format("{0}", guide.suggestionContent);
}
}
if (healthGuidSortList.Count > 0) hrsuggestion.guideText = text;
pSugList.Add(hrsuggestion);
}
if (pSugList.Count == 0)
{
HRSuggestion hrsuggestion = new HRSuggestion() { displayOrder = EMPTY_VALUE }; ;
pSugList.Add(hrsuggestion);
}
if (pMedList.Count == 0)
{
HRSugMedicalInterpretation hrsugmedicalinterpretation = new HRSugMedicalInterpretation() { displayOrder = EMPTY_VALUE };
pMedList.Add(hrsugmedicalinterpretation);
}
if (pReasonList.Count == 0)
{
HRSugCommonReason hrsugcommonreason = new HRSugCommonReason() { displayOrder = EMPTY_VALUE };
pReasonList.Add(hrsugcommonreason);
}
if (pGuideList.Count == 0)
{
HRSugHealthGuidance hrsughealthguidance = new HRSugHealthGuidance() { displayOrder = EMPTY_VALUE };
pGuideList.Add(hrsughealthguidance);
}
List<RegisterCheckItemType> pItemTypeList = new List<RegisterCheckItemType>();
List<RegisterCheckAsbitem> pAsbitemList = new List<RegisterCheckAsbitem>();
List<RegisterCheckItem> pCheckItemList = new List<RegisterCheckItem>();
List<RegisterCheckPircture> pPirctureList = new List<RegisterCheckPircture>();
List<RegisterCheckSummary> pSummaryList = new List<RegisterCheckSummary>();
List<DictExamItemType> dExamItemTypeList = new List<DictExamItemType>();
List<DictNotExamItemType> dNotExamItemTypeList = new List<DictNotExamItemType>();
string previousItemTypeId = "", previousAsbitemNames = "";
int absitemOrderNo = 0;
orderNo = 0;
text = "";
var registerCheckSortList = bill.registerChecks.OrderBy(o => o.displayOrder).ToList();
foreach (var asbitem in registerCheckSortList)
{
if (previousItemTypeId != asbitem.itemTypeId)
{
Report.Entity.PeisEntity.OccupationalDisease.ItemType type = bill.itemTypes.Where(p => (p.itemTypeId.Equals(asbitem.itemTypeId))).FirstOrDefault();
if (type != null)
{
RegisterCheckItemType registercheckitemtype = new RegisterCheckItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
if (type.medicalReportTypeId.Equals("3"))
{
DictExamItemType dictexamitemtype = new DictExamItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypePathCode = type.itemTypePathCode,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
dExamItemTypeList.Add(dictexamitemtype);
}
else
{
DictNotExamItemType dictnotexamitemtype = new DictNotExamItemType()
{
medicalReportTypeId = type.medicalReportTypeId,
itemTypeId = type.itemTypeId,
itemTypePathCode = type.itemTypePathCode,
itemTypeName = type.itemTypeName,
displayOrder = type.displayOrder,
};
dNotExamItemTypeList.Add(dictnotexamitemtype);
}
pItemTypeList.Add(registercheckitemtype);
}
previousItemTypeId = asbitem.itemTypeId;
}
if (previousAsbitemNames != asbitem.asbitemNames)
{
previousAsbitemNames = asbitem.asbitemNames;
absitemOrderNo++;
}
RegisterCheckAsbitem registercheckasbitem = new RegisterCheckAsbitem()
{
itemTypeId = asbitem.itemTypeId,
asbitemNames = asbitem.asbitemNames,
absOrderNo = absitemOrderNo,
displayOrder = asbitem.displayOrder,
checkDoctorName = asbitem.checkDoctorName,
checkDoctorSignUrl = asbitem.checkDoctorSignUrl,
auditorName = asbitem.auditorName,
auditorSignUrl = asbitem.auditorSignUrl,
checkDate = asbitem.checkDate.Replace("T", " ").Substring(0, 19),
};
foreach (var item in asbitem.items)
{
RegisterCheckItem registercheckitem = new RegisterCheckItem()
{
asbitemNames = asbitem.asbitemNames,
itemId = item.itemId,
itemName = item.itemName,
result = item.result,
referenceRangeValue = item.referenceRangeValue,
criticalRangeValue = item.criticalRangeValue,
unit = item.unit,
reportFontColor = item.reportFontColor,
reportBackgroundColor = item.reportBackgroundColor,
reportPrompt = item.reportPrompt,
displayOrder = item.displayOrder,
};
pCheckItemList.Add(registercheckitem);
}
foreach (var pic in asbitem.pictures)
{
var baseUri = new Uri(imageUrl);
var fullUri = new Uri(baseUri, pic.pictureFileName);
RegisterCheckPircture registercheckpircture = new RegisterCheckPircture()
{
asbitemNames = asbitem.asbitemNames,
pictureFileName = fullUri.AbsoluteUri,
pictureBase64 = pic.pictureBase64,
displayOrder = pic.displayOrder,
};
pPirctureList.Add(registercheckpircture);
}
orderNo = 0;
text = "";
var summarysSortList = asbitem.summarys.OrderBy(o => o.displayOrder).ToList();
foreach (var sum in summarysSortList)
{
RegisterCheckSummary registerchecksummary = new RegisterCheckSummary()
{
asbitemNames = asbitem.asbitemNames,
summary = sum.summary,
displayOrder = sum.displayOrder,
};
orderNo++;
if (summarysSortList.Count > 1)
text += string.Format("{0}:{1}", orderNo, sum.summary);
else
{
text = string.Format("{0}", sum.summary);
}
pSummaryList.Add(registerchecksummary);
}
if (summarysSortList.Count > 0) registercheckasbitem.summarysText = text;
pAsbitemList.Add(registercheckasbitem);
}
if (dExamItemTypeList.Count == 0)
{
DictExamItemType dictexamitemtype = new DictExamItemType() { displayOrder = EMPTY_VALUE }; ;
dExamItemTypeList.Add(dictexamitemtype);
}
if (dNotExamItemTypeList.Count == 0)
{
DictNotExamItemType dictnotexamitemtype = new DictNotExamItemType() { displayOrder = EMPTY_VALUE }; ;
dNotExamItemTypeList.Add(dictnotexamitemtype);
}
if (pItemTypeList.Count == 0)
{
RegisterCheckItemType registercheckitemtype = new RegisterCheckItemType() { displayOrder = EMPTY_VALUE }; ;
pItemTypeList.Add(registercheckitemtype);
}
if (pAsbitemList.Count == 0)
{
RegisterCheckAsbitem registercheckasbitem = new RegisterCheckAsbitem() { absOrderNo = EMPTY_VALUE, displayOrder = EMPTY_VALUE };
pAsbitemList.Add(registercheckasbitem);
}
if (pCheckItemList.Count == 0)
{
RegisterCheckItem registercheckitem = new RegisterCheckItem() { reportFontColor = EMPTY_VALUE, reportBackgroundColor = EMPTY_VALUE, displayOrder = EMPTY_VALUE };
pCheckItemList.Add(registercheckitem);
}
if (pPirctureList.Count == 0)
{
RegisterCheckPircture registercheckpircture = new RegisterCheckPircture() { displayOrder = EMPTY_VALUE };
pPirctureList.Add(registercheckpircture);
}
if (pSummaryList.Count == 0)
{
RegisterCheckSummary registerchecksummary = new RegisterCheckSummary() { displayOrder = EMPTY_VALUE };
pSummaryList.Add(registerchecksummary);
}
Rpt0006 hrpersonhealth = new Rpt0006()
{
dictMedType = dictMedicalTypeList,
dictExamItemType = dExamItemTypeList,
dictNotExamItemType = dNotExamItemTypeList,
pinfo = pHealthList,
resItemType = pItemTypeList,
resAsbitem = pAsbitemList,
res = pCheckItemList,
resPic = pPirctureList,
resSum = pSummaryList,
sug = pSugList,
sugReason = pReasonList,
sugGuide = pGuideList,
sugMeical = pMedList,
summ = pSumList,
summContent = pContentList,
odPat = pOccDisList,
odCheckType = pOcCheckList,
odHistory = pPatOccHisList,
odMedicHistory = pPatOccMedHisList,
odPastMedicHistory = pPatPastMedHisList,
odPoison = pPatPoiList,
odSymptom = pPatSymList,
pic = ToPicTable(dict, websiteUrl),
};
string dataSetJson = ClientConfig.SerializeObject(hrpersonhealth);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
RemoveEmptyRows(dSet);
return dSet;
}
public static async Task<DataSet> PatientGuideToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string json = FileHelper.ReadAllText(filePath);
Dto0001 pg = ClientConfig.DeserializeObject<Dto0001>(json);
List<PatientInfo> pList = new List<PatientInfo>();
PatientInfo patientinfo = new PatientInfo()
{
patientRegisterId = pg.patientRegisterId,
patientRegisterNo = pg.patientRegisterNo,
patientName = pg.patientName,
photo = pg.photo,
barcodeImg = BarCodeHelper.BuildBarCode(pg.patientRegisterNo),
sexName = pg.sexName,
age = pg.age == null ? "" : Convert.ToString(pg.age),
hisPatientId = pg.hisPatientId,
medicalStartDate = pg.medicalStartDate,
idNo = pg.idNo,
mobileTelephone = pg.mobileTelephone,
patientNo = pg.patientNo,
medicalTimes = pg.medicalTimes,
jobCardNo = pg.jobCardNo,
medicalCardNo = pg.medicalCardNo,
customerOrgName = pg.customerOrgName,
customerOrgShortName = pg.customerOrgShortName,
departmentName = pg.departmentName,
customerOrgGroupName = pg.customerOrgGroupName,
medicalPackageName = pg.medicalPackageName,
personnelTypeName = pg.personnelTypeName,
organizationUnitId = pg.organizationUnitId,
organizationUnitName = pg.organizationUnitName,
medicalCenterAddress = pg.medicalCenterAddress,
medicalCenterTelphone = pg.medicalCenterTelphone,
medicalCenterFax = pg.medicalCenterFax,
medicalTypeName = pg.medicalTypeName,
};
pList.Add(patientinfo);
var guideSortList = pg.detail.OrderBy(o => o.displayOrder).ToList();
List<GuideInfo> guideList = new List<GuideInfo>();
List<AsbitemInfo> asbitemList = new List<AsbitemInfo>();
foreach (var item in guideSortList)
{
GuideInfo guideinfo = new GuideInfo()
{
patientRegisterId = pg.patientRegisterId,
guideName = item.guideName,
asbitemCount = item.asbitemCount,
displayOrder = item.displayOrder,
};
foreach (var asbitem in item.detail_Name)
{
AsbitemInfo asbiteminfo = new AsbitemInfo()
{
guideName = item.guideName,
asbitemName = asbitem.asbitemName,
checkRequestNo = asbitem.checkRequestNo,
asbitemGuide = asbitem.asbitemGuide,
displayOrder = asbitem.displayOrder,
};
asbitemList.Add(asbiteminfo);
}
guideList.Add(guideinfo);
}
if (guideList.Count == 0)
{
GuideInfo guideinfo = new GuideInfo() { asbitemCount = EMPTY_VALUE, displayOrder = EMPTY_VALUE };
guideList.Add(guideinfo);
}
if (asbitemList.Count == 0)
{
AsbitemInfo asbiteminfo = new AsbitemInfo() { displayOrder = EMPTY_VALUE };
asbitemList.Add(asbiteminfo);
}
Rpt0001 guidees = new Rpt0001()
{
pinfo = pList,
guide = guideList,
asbitem = asbitemList,
pic = ToPicTable(dict, websiteUrl),
};
string dataSetJson = ClientConfig.SerializeObject(guidees);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
RemoveEmptyRows(dSet);
return dSet;
}
public static async Task<DataSet> TestRequestToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string dataSetJson = string.Empty;
string json = FileHelper.ReadAllText(filePath);
var bill = ClientConfig.DeserializeObject<Dto0002>(json);
var objStr = bill.lisRequest.ToString();
if (objStr.Contains("["))
{
var array = ClientConfig.DeserializeObject<TestRequest[]>(objStr);
List<TestRequest> testList = new List<TestRequest>();
foreach (var item in array)
{
item.barcodeImg = BarCodeHelper.BuildBarCode(item.lisRequestNo);
}
List<TestRequest> tqList = new List<TestRequest>();
tqList = array.ToList<TestRequest>();
var printArray = tqList.Where(p => p.samplePrintCount != "1").ToList();
int index = 0;
foreach (var item in printArray)
{
index = 0;
for (int i = 0; i < Convert.ToInt32(item.samplePrintCount) - 1; i++)
{
TestRequest req = new TestRequest()
{
patientName = item.patientName,
sexName = item.sexName,
age = item.age,
sampleTypeName = item.sampleTypeName,
sampleContainerName = item.sampleContainerName,
containerColor = item.containerColor,
sampleContainerRemark = item.sampleContainerRemark,
lisRequestNo = item.lisRequestNo,
barcodeImg = new byte[] { 1 },
patientRegisterNo = item.patientRegisterNo,
asbitemNames = item.asbitemNames,
customerOrgName = item.customerOrgName,
departmentName = item.departmentName,
sampleGroupName = item.sampleGroupName,
mobileTelephone = item.mobileTelephone,
//samplePrintCount = item.samplePrintCount,
};
index = tqList.IndexOf(item);
if (index == 0)
{
tqList.Insert(0, req);
}
else
{
tqList.Insert(index - 1, req);
}
}
}
Rpt0002 tr = new Rpt0002()
{
testRequestes = tqList.OrderBy(p => p.sampleGroupName).ToList(),
};
dataSetJson = ClientConfig.SerializeObject(tr);
}
else
{
var obj = ClientConfig.DeserializeObject<TestRequest>(objStr);
obj.barcodeImg = BarCodeHelper.BuildBarCode(obj.lisRequestNo);
List<TestRequest> testList = new List<TestRequest>();
testList.Add(obj);
var printArray = testList.Where(p => p.samplePrintCount != "1").ToList();
int index = 0;
foreach (var item in printArray)
{
index = 0;
for (int i = 0; i < Convert.ToInt32(item.samplePrintCount) - 1; i++)
{
TestRequest req = new TestRequest()
{
patientName = item.patientName,
sexName = item.sexName,
age = item.age,
sampleTypeName = item.sampleTypeName,
sampleContainerName = item.sampleContainerName,
containerColor = item.containerColor,
sampleContainerRemark = item.sampleContainerRemark,
lisRequestNo = item.lisRequestNo,
barcodeImg = new byte[] { 1 },
patientRegisterNo = item.patientRegisterNo,
asbitemNames = item.asbitemNames,
customerOrgName = item.customerOrgName,
departmentName = item.departmentName,
sampleGroupName = item.sampleGroupName,
mobileTelephone = item.mobileTelephone,
//samplePrintCount = item.samplePrintCount,
};
index = testList.IndexOf(item);
if (index == 0)
{
testList.Insert(0, req);
}
else
{
testList.Insert(index - 1, req);
}
}
}
Rpt0002 tr = new Rpt0002()
{
testRequestes = testList,
};
dataSetJson = ClientConfig.SerializeObject(tr);
}
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
return dSet;
}
public static async Task<DataSet> ExamRequestToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string dataSetJson = string.Empty;
string json = FileHelper.ReadAllText(filePath);
var bill = ClientConfig.DeserializeObject<Dto0004>(json);
var objStr = bill.lisRequest.ToString();
if (objStr.Contains("["))
{
var array = ClientConfig.DeserializeObject<ExamRequest[]>(objStr);
List<ExamRequest> testList = new List<ExamRequest>();
foreach (var item in array)
{
item.barcodeImg = BarCodeHelper.BuildBarCode(item.checkRequestNo);
}
Rpt0004 tr = new Rpt0004()
{
exam = array.ToList<ExamRequest>(),
};
dataSetJson = ClientConfig.SerializeObject(tr);
}
else
{
var obj = ClientConfig.DeserializeObject<ExamRequest>(objStr);
obj.barcodeImg = BarCodeHelper.BuildBarCode(obj.checkRequestNo);
List<ExamRequest> testList = new List<ExamRequest>();
testList.Add(obj);
Rpt0004 tr = new Rpt0004()
{
exam = testList,
};
dataSetJson = ClientConfig.SerializeObject(tr);
}
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
return dSet;
}
public static async Task<DataSet> PayBillToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string json = FileHelper.ReadAllText(filePath);
Dto0007 bill = ClientConfig.DeserializeObject<Dto0007>(json);
List<Dto0007> pList = new List<Dto0007>();
pList.Add(bill);
Rpt0007 p = new Rpt0007()
{
payinfo = pList,
pic = ToPicTable(dict, websiteUrl),
};
string dataSetJson = ClientConfig.SerializeObject(p);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
return dSet;
}
public static async Task<DataSet> OccuptionDiseaseFinalToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string dataSetJson = string.Empty;
string json = FileHelper.ReadAllText(filePath);
Dto0009 odf = ClientConfig.DeserializeObject<Dto0009>(json);
List<ODFSummary> odfList = new List<ODFSummary>();
ODFSummary odfsummary = new ODFSummary()
{
customerOrgName = odf.customerOrgName,
certificateNo = odf.certificateNo,
medicalTypeName = odf.medicalTypeName,
medicalStartDate = odf.medicalStartDate,
recordNumber = odf.recordNumber,
medicalCenterName = odf.medicalCenterName,
medicalCenterAddress = odf.medicalCenterAddress,
reportDate = odf.reportDate,
medicalSumCount = odf.medicalSumCount,
whenLeavingWorkCount = odf.whenLeavingWorkCount,
onDutyCount = odf.onDutyCount,
poisonNames = odf.poisonNames,
conclusions = odf.conclusions,
jobTypes = odf.jobTypes,
};
odfList.Add(odfsummary);
List<ConclusionDetails> cdList = new List<ConclusionDetails>();
foreach (var item in odf.conclusionDetails)
{
ConclusionDetails conclusiondetails = new ConclusionDetails()
{
conclusionName = item.conclusionName,
conclusionCount = item.conclusionCount,
conclusionRatio = item.conclusionRatio,
};
cdList.Add(conclusiondetails);
}
List<AsbitemAbnormal> aaList = new List<AsbitemAbnormal>();
foreach (var item in odf.asbitemAbnormals)
{
AsbitemAbnormal asbitemabnormal = new AsbitemAbnormal()
{
abnormalAsbitemName = item.abnormalAsbitemName,
abnormalCount = item.abnormalCount,
abnormalRatio = item.abnormalRatio,
};
aaList.Add(asbitemabnormal);
}
if (cdList.Count == 0)
{
ConclusionDetails cd = new ConclusionDetails() { conclusionCount = EMPTY_VALUE };
cdList.Add(cd);
}
if (aaList.Count == 0)
{
AsbitemAbnormal aa = new AsbitemAbnormal() { abnormalCount = EMPTY_VALUE };
aaList.Add(aa);
}
Rpt0009 tr = new Rpt0009()
{
summary = odfList,
cdetail = cdList,
asbitem = aaList
};
dataSetJson = ClientConfig.SerializeObject(tr);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
RemoveEmptyRows(dSet);
return dSet;
}
public static async Task<DataSet> OccuptionDiseaseDetailToDataSetAsync(string filePath, Dictionary<string, string> dict, string websiteUrl, string apiUrl, bool isSaveJson = false)
{
Task<DataSet> task = Task.Factory.StartNew<DataSet>(() =>
{
string dataSetJson = string.Empty;
string json = FileHelper.ReadAllText(filePath);
Dto0010 odf = ClientConfig.DeserializeObject<Dto0010>(json);
List<Rpt0010_BaseInfo> baseInfos = new List<Rpt0010_BaseInfo>();
Rpt0010_BaseInfo rpt0010_baseinfo = new Rpt0010_BaseInfo()
{
customerOrgName = odf.customerOrgName,
certificateNo = odf.certificateNo,
recordNumber = odf.recordNumber,
medicalCenterName = odf.medicalCenterName,
medicalStartDate = odf.medicalStartDate,
reportDate = odf.reportDate,
medicalResultDesc = odf.medicalResultDesc,
};
baseInfos.Add(rpt0010_baseinfo);
List<Rpt0010_OcCheckTypeName> checkTypeNames = new List<Rpt0010_OcCheckTypeName>();
if (odf.ocCheckTypeNames != null)
{
foreach (var item in odf.ocCheckTypeNames)
{
Rpt0010_OcCheckTypeName ocCheckTypeName = new Rpt0010_OcCheckTypeName()
{
typeName = item.ocCheckTypeName,
isSelected = item.isSelected,
};
checkTypeNames.Add(ocCheckTypeName);
}
}
List<Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails> odoaiDetails = new List<Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails>();
foreach (var item in odf.otherDiseasesOrAbnormalIndividualsDetails)
{
Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails rpt0010_odoaiDetail = new Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
sexName = item.sexName,
age = item.age,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
anomalyIndex = item.anomalyIndex,
handlingSuggestions = item.handlingSuggestions,
medicalConclusion = item.medicalConclusion,
ocCheckTypeName = item.ocCheckTypeName,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
displayOrder = item.displayOrder,
};
odoaiDetails.Add(rpt0010_odoaiDetail);
};
List<Rpt0010_NoAbnormalConditionsDetails> nacdmedicalResults = new List<Rpt0010_NoAbnormalConditionsDetails>();
foreach (var item in odf.noAbnormalConditionsDetails)
{
Rpt0010_NoAbnormalConditionsDetails rpt0010_nacdmedicalResult = new Rpt0010_NoAbnormalConditionsDetails()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
sexName = item.sexName,
age = item.age,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
anomalyIndex = item.anomalyIndex,
handlingSuggestions = item.handlingSuggestions,
medicalConclusion = item.medicalConclusion,
ocCheckTypeName = item.ocCheckTypeName,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
displayOrder = item.displayOrder,
};
nacdmedicalResults.Add(rpt0010_nacdmedicalResult);
};
List<Rpt0010_MedicalResultAbnormalRate> medicalResultAbnormalRates = new List<Rpt0010_MedicalResultAbnormalRate>();
foreach (var item in odf.medicalResultAbnormalRateDetails)
{
Rpt0010_MedicalResultAbnormalRate rpt0010_medicalresultabnormalrate = new Rpt0010_MedicalResultAbnormalRate()
{
asbitemName = item.asbitemName,
abnormalRate = item.abnormalRate.ToString(),
abnormalPatientNames = item.abnormalPatientNames,
displayOrder = item.displayOrder,
};
medicalResultAbnormalRates.Add(rpt0010_medicalresultabnormalrate);
};
List<Rpt0010_MissingItems> missingItems = new List<Rpt0010_MissingItems>();
foreach (var item in odf.listOfMissingItemsDetails)
{
Rpt0010_MissingItems rpt0010_missingitems = new Rpt0010_MissingItems()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
ocCheckTypeName = item.ocCheckTypeName,
sexName = item.sexName,
age = item.age,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
unCheckAsbitemName = item.unCheckAsbitemName,
displayOrder = item.displayOrder,
};
missingItems.Add(rpt0010_missingitems);
};
List<Rpt0010_UninspectedPerson> uninspectedPersones = new List<Rpt0010_UninspectedPerson>();
foreach (var item in odf.uninspectedPersonnelDetails)
{
Rpt0010_UninspectedPerson rpt0010_missingitems = new Rpt0010_UninspectedPerson()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
ocCheckTypeName = item.ocCheckTypeName,
sexName = item.sexName,
age = item.age,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
unCheckAsbitemName = item.unCheckAsbitemName,
displayOrder = item.displayOrder,
};
uninspectedPersones.Add(rpt0010_missingitems);
};
List<Rpt0010_OcAbnormal> ocAbnormals = new List<Rpt0010_OcAbnormal>();
foreach (var item in odf.occupationalAbnormalDetails)
{
Rpt0010_OcAbnormal rpt0010_ocabnormal = new Rpt0010_OcAbnormal()
{
occupationalAbnormalName = item.occupationalAbnormalName,
occupationalAbnormalCount = item.occupationalAbnormalCount.ToString(),
occupationalAbnormalRatio = item.occupationalAbnormalRatio.ToString(),
displayOrder = item.displayOrder,
};
ocAbnormals.Add(rpt0010_ocabnormal);
};
List<Rpt0010_OcCheckType> ocCheckTypes = new List<Rpt0010_OcCheckType>();
foreach (var item in odf.ocCheckTypeDetails)
{
Rpt0010_OcCheckType rpt0010_occhecktype = new Rpt0010_OcCheckType()
{
poisonNames = item.poisonNames,
ocCheckTypeName = item.ocCheckTypeName,
checkCount = item.checkCount,
displayOrder = item.displayOrder,
};
ocCheckTypes.Add(rpt0010_occhecktype);
};
List<Rpt0010_OcContraindication> ocContraindications = new List<Rpt0010_OcContraindication>();
foreach (var item in odf.occupationalContraindicationDetails)
{
Rpt0010_OcContraindication rpt0010_occontraindication = new Rpt0010_OcContraindication()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
sexName = item.sexName,
age = item.age,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
anomalyIndex = item.anomalyIndex,
handlingSuggestions = item.handlingSuggestions,
medicalConclusion = item.medicalConclusion,
ocCheckTypeName = item.ocCheckTypeName,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
displayOrder = item.displayOrder,
};
ocContraindications.Add(rpt0010_occontraindication);
};
List<Rpt0010_ReviewPersonnel> reviewPersonnel = new List<Rpt0010_ReviewPersonnel>();
foreach (var item in odf.reviewPersonnelDetails)
{
Rpt0010_ReviewPersonnel rpt0010_reviewpersonnel = new Rpt0010_ReviewPersonnel()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
sexName = item.sexName,
age = item.age,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
anomalyIndex = item.anomalyIndex,
handlingSuggestions = item.handlingSuggestions,
medicalConclusion = item.medicalConclusion,
ocCheckTypeName = item.ocCheckTypeName,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
displayOrder = item.displayOrder,
};
reviewPersonnel.Add(rpt0010_reviewpersonnel);
};
List<Rpt0010_SuspectedOcDisease> suspectedOcDiseases = new List<Rpt0010_SuspectedOcDisease>();
foreach (var item in odf.suspectedOccupationalDiseaseDetails)
{
Rpt0010_SuspectedOcDisease rpt0010_suspectedocdisease = new Rpt0010_SuspectedOcDisease()
{
patientRegisterNo = item.patientRegisterNo,
patientName = item.patientName,
idNo = item.idNo,
sexName = item.sexName,
age = item.age,
jobType = item.jobType,
poisonWorkTime = item.poisonWorkTime,
poisonNames = item.poisonNames,
anomalyIndex = item.anomalyIndex,
handlingSuggestions = item.handlingSuggestions,
medicalConclusion = item.medicalConclusion,
ocCheckTypeName = item.ocCheckTypeName,
medicalStartDate = item.medicalStartDate,
summaryDoctorName = item.summaryDoctorName,
displayOrder = item.displayOrder,
};
suspectedOcDiseases.Add(rpt0010_suspectedocdisease);
};
if (checkTypeNames.Count == 0)
{
Rpt0010_OcCheckTypeName aa = new Rpt0010_OcCheckTypeName() { typeName = EMPTY_VALUE.ToString() };
checkTypeNames.Add(aa);
}
if (odoaiDetails.Count == 0)
{
Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails aa = new Rpt0010_OtherDiseasesOrAbnormalIndividualsDetails();
odoaiDetails.Add(aa);
}
if (nacdmedicalResults.Count == 0)
{
Rpt0010_NoAbnormalConditionsDetails aa = new Rpt0010_NoAbnormalConditionsDetails();
nacdmedicalResults.Add(aa);
}
if (medicalResultAbnormalRates.Count == 0)
{
Rpt0010_MedicalResultAbnormalRate aa = new Rpt0010_MedicalResultAbnormalRate();
medicalResultAbnormalRates.Add(aa);
}
if (missingItems.Count == 0)
{
Rpt0010_MissingItems aa = new Rpt0010_MissingItems();
missingItems.Add(aa);
}
if (uninspectedPersones.Count == 0)
{
Rpt0010_UninspectedPerson aa = new Rpt0010_UninspectedPerson();
uninspectedPersones.Add(aa);
}
if (ocAbnormals.Count == 0)
{
Rpt0010_OcAbnormal aa = new Rpt0010_OcAbnormal();
ocAbnormals.Add(aa);
}
if (ocCheckTypes.Count == 0)
{
Rpt0010_OcCheckType aa = new Rpt0010_OcCheckType() { displayOrder = EMPTY_VALUE };
ocCheckTypes.Add(aa);
}
if (ocContraindications.Count == 0)
{
Rpt0010_OcContraindication aa = new Rpt0010_OcContraindication();
ocContraindications.Add(aa);
}
if (reviewPersonnel.Count == 0)
{
Rpt0010_ReviewPersonnel aa = new Rpt0010_ReviewPersonnel();
reviewPersonnel.Add(aa);
}
if (suspectedOcDiseases.Count == 0)
{
Rpt0010_SuspectedOcDisease aa = new Rpt0010_SuspectedOcDisease();
suspectedOcDiseases.Add(aa);
}
Rpt0010 tr = new Rpt0010()
{
baseInfo = baseInfos,
odoaiDetail = odoaiDetails,
nacdmedicalResult = nacdmedicalResults,
medicalResultAbnormalRate = medicalResultAbnormalRates,
missingItems = missingItems,
uninspectedPerson = uninspectedPersones,
ocAbnormals = ocAbnormals,
ocCheckType = ocCheckTypes,
ocContraindication = ocContraindications,
reviewPersonnel = reviewPersonnel,
suspectedOcDiseases = suspectedOcDiseases,
ocCheckTypeNames = checkTypeNames,
pic = ToPicTable(dict, websiteUrl),
};
dataSetJson = ClientConfig.SerializeObject(tr);
if (isSaveJson)
FileHelper.WriteAllText(filePath, dataSetJson);
DataSet ds = ClientConfig.DeserializeObject<DataSet>(dataSetJson);
return ds;
});
DataSet dSet = await task;
RemoveEmptyRows(dSet);
return dSet;
}
}
}