diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java index bd32cf5..94b8e09 100644 --- a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java @@ -6110,6 +6110,111 @@ public class BasicConfigServiceTest { } } + + public static void becareful(String fileName) { + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); + MongoTemplate mongoTemplate + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); + File file = new File(fileName); + Workbook wb = null; + try { + wb = Workbook.getWorkbook(file); + + + Sheet s = wb.getSheet(0); + System.out.println(s.getName() + " : "); + int rows = s.getRows(); + if (rows > 0) { + //遍历每行 + for (int i = 1; i < rows; i++) { + System.out.println("rows=" + i); + QhdWeightConfigModel weightConfigModel = new QhdWeightConfigModel(); + weightConfigModel.setIsHighRisk("1"); + weightConfigModel.setHighRiskIlness("0"); + Cell[] cells = s.getRow(i); + if (cells.length > 0) { + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + weightConfigModel.setWeek(Integer.parseInt(str)); + continue; + case 1: + List list2 = Arrays.asList(str.split("\n")); + weightConfigModel.setBreakfast(list2); + continue; + } + } + } + mongoTemplate.save(weightConfigModel); + } + } + Sheet s1 = wb.getSheet(1); + System.out.println(s1.getName() + " : "); + int rows1 = s1.getRows(); + if (rows1 > 0) { + //遍历每行 + for (int i = 1; i < rows1; i++) { + System.out.println("rows=" + i); + QhdWeightConfigModel weightConfigModel = new QhdWeightConfigModel(); + weightConfigModel.setIsHighRisk("1"); + weightConfigModel.setHighRiskIlness("1"); + Cell[] cells = s1.getRow(i); + if (cells.length > 0) { + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + weightConfigModel.setWeek(Integer.parseInt(str)); + continue; + case 1: + List list2 = Arrays.asList(str.split("\n")); + weightConfigModel.setBreakfast(list2); + continue; + } + } + } + mongoTemplate.save(weightConfigModel); + } + } + + Sheet s2 = wb.getSheet(2); + System.out.println(s2.getName() + " : "); + int rows2 = s2.getRows(); + if (rows2 > 0) { + //遍历每行 + for (int i = 1; i < rows2; i++) { + System.out.println("rows=" + i); + QhdWeightConfigModel weightConfigModel = new QhdWeightConfigModel(); + weightConfigModel.setIsHighRisk("1"); + weightConfigModel.setHighRiskIlness("2"); + Cell[] cells = s2.getRow(i); + if (cells.length > 0) { + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + weightConfigModel.setWeek(Integer.parseInt(str)); + continue; + case 1: + List list2 = Arrays.asList(str.split("\n")); + weightConfigModel.setBreakfast(list2); + continue; + } + } + } + mongoTemplate.save(weightConfigModel); + } + } + + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); @@ -6134,7 +6239,7 @@ public class BasicConfigServiceTest { //dietaryIntake("F:\\膳食摄入量推荐.xls"); - zdyinshu("F:\\诊断因素.xls"); + //zdyinshu("F:\\诊断因素.xls"); //saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls"); @@ -6142,12 +6247,12 @@ public class BasicConfigServiceTest { //saveEvaluationCriterionModel2("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童智能等级.xls"); // saveEvaluationCriterionModel3("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童神经心理发育情况.xls"); //saveQhdWeight("F:\\text.xls"); - //saveQhdGaoWeiWeight("F:\\秦皇岛高危报告内容.xls"); + // saveQhdGaoWeiWeight("F:\\秦皇岛高危报告内容.xls"); // saveQhdWeight("F:\\text.xls"); // baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls"); // baby35Report("C:\\Users\\Administrator\\Desktop\\doc\\秦皇岛3-5月龄膳食报告\\3-5月龄儿童膳食报告内容.xls"); - saveWeight("F:\\体成分分析报告内容.xls"); - + //saveWeight("F:\\体成分分析报告内容.xls"); + becareful("F:\\秦皇岛生重本周注意.xls"); } diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/QhdWeightConfigModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/QhdWeightConfigModel.java index 4ac05a1..7718705 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/QhdWeightConfigModel.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/QhdWeightConfigModel.java @@ -32,7 +32,26 @@ public class QhdWeightConfigModel { private Integer pregnancy; //孕期 private Integer kcal; //整值卡路里 + //本周注意 + private List becareful; + private Integer week; + + public Integer getWeek() { + return week; + } + + public void setWeek(Integer week) { + this.week = week; + } + + public List getBecareful() { + return becareful; + } + + public void setBecareful(List becareful) { + this.becareful = becareful; + } public String getHighRiskIlness() { return highRiskIlness; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index f1cdd72..bdb119e 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -2438,20 +2438,21 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient Map data3 = new HashMap<>(); List reiskFactor = patients.getRiskFactorId(); for (String reis : reiskFactor) { - //糖尿病 if (this.initReport("0").contains(reis)) { List diabetes = mongoTemplate.find(Query.query(Criteria.where("kcal").is(diabetesKcal).and("isHighRisk").is("1").and("highRiskIlness").is("2")), QhdWeightConfigModel.class); - datas.put("1", this.getQhdInfo(weights, data3, diabetes, patientWeight, patients, bmiD, week)); + QhdWeightConfigModel qhdWeightConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("week").is(week).and("isHighRisk").is("1").and("highRiskIlness").is("2")), QhdWeightConfigModel.class); + datas.put("1", this.getQhdInfo(weights, data3, diabetes, patientWeight, patients, bmiD, week, qhdWeightConfigModel)); } else if (this.initReport("1").contains(reis)) { //高血压 List feritin = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("0")), QhdWeightConfigModel.class); - System.out.println(feritin.size()); - datas.put("2", this.getQhdInfo(weights, data2, feritin, patientWeight, patients, bmiD, week)); + QhdWeightConfigModel qhdWeightConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("week").is(week).and("isHighRisk").is("1").and("highRiskIlness").is("0")), QhdWeightConfigModel.class); + datas.put("2", this.getQhdInfo(weights, data2, feritin, patientWeight, patients, bmiD, week, qhdWeightConfigModel)); } else if (this.initReport("2").contains(reis)) { + QhdWeightConfigModel qhdWeightConfigModel = mongoTemplate.findOne(Query.query(Criteria.where("week").is(week).and("isHighRisk").is("1").and("highRiskIlness").is("1")), QhdWeightConfigModel.class); //贫血 List anemia = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("1")), QhdWeightConfigModel.class); - datas.put("3", this.getQhdInfo(weights, data0, anemia, patientWeight, patients, bmiD, week)); + datas.put("3", this.getQhdInfo(weights, data0, anemia, patientWeight, patients, bmiD, week, qhdWeightConfigModel)); } } } @@ -2628,9 +2629,12 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient /** * 秦皇岛定制 **/ - public Map getQhdInfo(Map weights, Map data, List weightReportModel, PatientWeight patientWeight, Patients patients, double bmi, int week) { + public Map getQhdInfo(Map weights, Map data, + List weightReportModel, PatientWeight patientWeight, + Patients patients, double bmi, int week, QhdWeightConfigModel qhdWeightConfigModel) { setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic()); Map userMap = new HashMap(); + userMap.put("userName", patients.getUsername()); userMap.put("age", patients.getAge() + "岁"); userMap.put("height", patientWeight.getBeforeHeight() + "cm"); @@ -2696,7 +2700,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map1.put("proposalInfo", qhd.getLaterSuggests()); } } - + data.put("becareful", CollectionUtils.isNotEmpty(qhdWeightConfigModel.getBreakfast()) ? qhdWeightConfigModel.getBreakfast() : null); data.put("recipes", map1); data.put("dietaryRules", map3);