using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DataParse : SingleTon { public void ParseRoomInfo(string str) { RoomRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.roomsData = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetRoom, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseCheckBodyQuestionToQuit(string str) { CheckBodyQuetionRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.checkBodyQuestion = root.data; for (int i = 0; i < DataManager.Instance.checkBodyQuestion.Count; i++) { var item = DataManager.Instance.checkBodyQuestion[i]; AnswerQuestionData questionData = new AnswerQuestionData(); questionData.question = item; questionData.questionID = item.id; questionData.type = item.type; if (item.type == 1) { questionData.chooseOne = -1; } else if (item.type == 2) { questionData.choose = new List(); } else { questionData.hint = ""; } bool ishave = false; var temp2 = DataManager.Instance.currentAllDoneQuestion; for (int j = 0; j < temp2.Count; j++) { if (temp2[j].questionID == questionData.questionID) { temp2[j] = questionData; ishave = true; } } if (!ishave) { DataManager.Instance.currentAllDoneQuestion.Add(questionData); } } } else { Debug.LogError("root.code = " + root.code); } } } public void ParseBodyPosInfo(string str) { BodyPosInfoRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.bodyPosInfos = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetBodyPosInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseBodyInfo(string str) { BodyInfoRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.bodyInfoData = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetBodyInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseBodyNum(string str) { BodyNumRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.bodyNum = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetBodyNum, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllStyle(string str) { AllStyleRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.currentStyleItem = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetAllStyle, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllOtherInfo(string str) { OtherInfoRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.otherInfoItem = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetOtherInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllCheckReason(string str) { CheckReasonRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.checkReasonItems = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetCheckReason, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllHealing(string str) { HealingRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.healingItems = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetHealing, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllLifeType(string str) { LifeTypeRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.lifeItems = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetLifeType, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllHistoryInfo(string str) { HistoryInfoRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.historyInfoItems = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetHistoryInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllAskReason(string str) { AskRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.askItems = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetAskReason, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseSinglePeopleInfo(string str) { Root6 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.rowitems2 = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetPeopleInfo2, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseAllPeopleInfo(string str) { Root6 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.rowitems2 = root.data.rows; EventCenter.dispatcher.SendMessage(MsgType.OnGetPeopleInfo2, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParsePeopleHistory(string str) { Root5 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { //DataManager.Instance.currentTalk = root.data; //EventCenter.dispatcher.SendMessage(MsgType.OnGetTalkMsg, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParsePeopleTalk(string str) { Root4 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.currentTalk = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetTalkMsg, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParsePeopleQuestion(string str) { Root3 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.currentPeoplesQuestion = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetPeopleQuetionList, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParsePeopleList(string str) { Root2 root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.currentPeoplesProgress = root.data; //当前诊断 诊断步骤 EventCenter.dispatcher.SendMessage(MsgType.OnGetCurrentPeopleProgress, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseStudentList(string str) { StudentInfoDataRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.studentInfoDataItems = root.data; EventCenter.dispatcher.SendMessage(MsgType.OnGetStudentInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } public void ParseStudentTest(string str) { StudentTestRoot root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.studentsTest = root.data; //var list = DataManager.Instance.peopleDisProgress; //for (int i = 0; i < root.data.Count; i++) //{ // var data = root.data[i]; // if (!list.ContainsKey(data.id)) // { // list.Add(data.id, new List(1) { 0 }); // } //} //DataManager.Instance.peopleDisProgress = list; } else { Debug.LogError("root.code = " + root.code); } } } /// /// 诊断病例列表进展 /// /// public void ParsePeople(string str) { Root root = JsonUtility.FromJson(str); if (root != null) { if (root.code == 200) { DataManager.Instance.peoples = root.data.rows; var list = DataManager.Instance.peopleDisProgress; for (int i = 0; i < root.data.rows.Count; i++) { var data = root.data.rows[i]; if (!list.ContainsKey(data.id)) { list.Add(data.id, new List(1) { 0 }); } } DataManager.Instance.peopleDisProgress = list; EventCenter.dispatcher.SendMessage(MsgType.OnGetPeopleInfo, null); } else { Debug.LogError("root.code = " + root.code); } } } } /// /// 病人的个人资料 /// [Serializable] public class RowsItem2 { /// /// /// public int createBy; /// /// /// public string createTime; /// /// /// public int updateBy; /// /// /// public string updateTime; /// /// /// public int id; /// /// /// public int sex; /// /// /// public int age; /// /// /// public int weight; /// /// /// public int height; /// /// 李 /// public string familyName; /// /// 工 /// public string name; /// /// /// public int matrimony; /// /// /// public int childrenNum; /// /// java工程师 /// public string occupation; /// /// /// public int weightExponent; /// /// /// public string type; /// /// /// public string abdominalCircumference; /// /// /// public string diagnosisId; } /// /// 病人的个人资料 /// [Serializable] public class Data2 { /// /// /// public int total; /// /// /// public List rows; } /// /// 病人的个人资料 /// [Serializable] public class Root6 { /// /// /// public int code; /// /// 查询成功 /// public string msg; /// /// /// public Data2 data; } [Serializable] public class DataItem4 { /// /// /// public int createBy; /// /// /// public string createTime; /// /// /// public string updateBy; /// /// /// public string updateTime; /// /// /// public int id; /// /// {"drugAllergy":null,"allergens":"阿莫西林"} /// public string detailInfo; /// /// /// public string type; /// /// 消炎时,过敏 /// public string peculiarity; /// /// /// public int diagnosisId; } [Serializable] public class Root5 { /// /// /// public int code { get; set; } /// /// 操作成功 /// public string msg { get; set; } /// /// /// public List data { get; set; } } [Serializable] public class DataItem3 { /// /// /// public string createBy; /// /// /// public string createTime; /// /// /// public string updateBy; /// /// /// public string updateTime; /// /// /// public int id; /// /// /// public int senderCode; /// /// /// public int backgroundType; /// /// /// public int relationId; /// /// 请问有什么可以帮助您的? /// public string msg; } [Serializable] public class Root4 { /// /// /// public int code; /// /// 操作成功 /// public string msg; /// /// /// public List data; } [Serializable] public class LinkRedirectRespListItem { /// /// /// public int id; /// /// /// public string title; /// /// /// public string linkUrl; /// /// /// public int backgroundType; /// /// /// public int relevanceId { get; set; } } [Serializable] public class ProblemAnswerRespListItem { /// /// /// public int id; /// /// /// public int problemId; /// /// 没有问题不需要进行治疗。 /// public string replyText; /// /// /// public int replyEvaluate; /// /// /// public string extra; } [Serializable] public class ProblemDescribeFilesItem { /// /// /// public int id; /// /// /// public int type; /// /// /// public string filePath; /// /// /// public string filePathOutside; /// /// /// public string name; /// /// /// public string remark; } /// /// 问题 /// [Serializable] public class DataItem2 { /// /// /// public int id; /// /// /// public int diagnosisId; /// /// /// public int backgroundType; /// /// /// public int type; /// /// 其他问题 /// public string introduce; /// /// 没啥大问题 /// public string title; /// /// 问题不大 /// public string feedback; /// /// /// public string titleFileIds; /// /// /// public string feedbackFileIds; public List problemAnswerRespList; /// /// /// public List problemDescribeFiles; /// /// /// public List problemFeedbackFiles; /// /// /// public List linkRedirectRespList; } [Serializable] public class Root3 { /// /// /// public int code; /// /// 操作成功 /// public string msg; /// /// /// public List data; } [Serializable] public class DataItem { /// /// /// public int createBy; /// /// /// public string createTime; /// /// /// public int updateBy; /// /// /// public string updateTime; /// /// /// public int id; /// /// /// public string bodyTemperature; /// /// /// public string pulse; /// /// /// public string respiratoryRate; /// /// /// public int bloodPressure; /// /// /// public int casesId; /// /// /// public string diagnosisBackgroundId; /// /// /// public string reason; /// /// /// public string illustrate; /// /// /// public int sort; /// /// 初次诊断 /// public string title; /// /// /// public string dateTime; /// /// 诊断背景 /// public string background; /// /// /// public int patientDiagnosis; /// /// /// public string haveProjectId; } [Serializable] public class Root2 { /// /// /// public int code; /// /// 操作成功 /// public string msg; /// /// /// public List data; } /// /// 诊断数据 /// [Serializable] public class RowsItem { /// /// /// public int createBy; /// /// /// public string createTime; /// /// /// public int updateBy; /// /// /// public string updateTime; /// /// 诊断ID /// public int id; /// /// 测试病例 /// public string name; /// /// 汉语 /// public string languageType; /// /// 解刨 /// public string specialty; /// /// /// public List assessmentPoints; /// /// /// public List field; /// /// /// public List difficulty; /// /// /// public string patientId; /// /// /// public string image; /// /// /// public string sex; /// /// /// public string age; /// /// /// public string weight; /// /// /// public string feature; /// /// /// public int haveClothing; /// /// /// public string order; } [Serializable] public class Data { /// /// /// public int total; /// /// /// public List rows; } [Serializable] public class Root { /// /// /// public int code; /// /// 查询成功 /// public string msg; /// /// /// public Data data; } [Serializable] public class CheckBodyQuetionRoot { /// /// /// public int code; /// /// 操作成功 /// public string msg; /// /// /// public List data; }