From 1e535fea2589f4fcef22f566d9c20e16adcfbfe2 Mon Sep 17 00:00:00 2001 From: wangbo <184677810@qq.com> Date: Wed, 24 Apr 2019 09:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=8A=E9=AB=98=E7=97=87=E5=B9=B3=E6=9D=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lyms/platform/biz/BasicConfigServiceTest.java | 487 ++++++++++++++++++++- .../main/java/com/lyms/platform/pojo/PihModel.java | 97 ++++ .../com/lyms/platform/pojo/PihParameterModel.java | 253 +++++++++++ .../web/controller/annualReportController.java | 2 +- .../operate/web/controller/pihController.java | 46 ++ .../platform/operate/web/service/PihService.java | 10 + .../operate/web/service/impl/PihServiceImpl.java | 45 ++ 7 files changed, 938 insertions(+), 2 deletions(-) create mode 100644 platform-dal/src/main/java/com/lyms/platform/pojo/PihModel.java create mode 100644 platform-dal/src/main/java/com/lyms/platform/pojo/PihParameterModel.java create mode 100644 platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/pihController.java create mode 100644 platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PihService.java create mode 100644 platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PihServiceImpl.java 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 565c149..5ba0021 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 @@ -3521,6 +3521,490 @@ public class BasicConfigServiceTest { } + public static void renGaoZhen(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); + PihModel pin = new PihModel(); + //0 健康教育之孕期相关 1 饮食 2 饮食之营养指南 3 运动 + pin.setType(1); + pin.setSymptomsType(1); + 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: + pin.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pin.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pin.setUnscramble(list1); + continue; + case 3: + List list2 = Arrays.asList(str.split("\n")); + pin.setCheck(list2); + continue; + case 4: + List list3 = Arrays.asList(str.split("\n")); + pin.setDiet(list3); + continue; + case 5: + List list4 = Arrays.asList(str.split("\n")); + pin.setLifeStyle(list4); + continue; + } + } + + } + mongoTemplate.save(pin); + } + + } + + Sheet s1 = wb.getSheet(1); + System.out.println(s.getName() + " : "); + int rows1 = s1.getRows(); + if (rows1 > 0) { + for (int i = 1; i < rows1; i++) { + System.out.println("rows=" + i); + PihModel pin = new PihModel(); + //0 健康教育之孕期相关 1 饮食 2 饮食之营养指南 3 运动 + pin.setType(2); + pin.setSymptomsType(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: + pin.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pin.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pin.setUnscramble(list1); + continue; + case 3: + List list2 = Arrays.asList(str.split("\n")); + pin.setCheck(list2); + continue; + case 4: + List list3 = Arrays.asList(str.split("\n")); + pin.setDiet(list3); + continue; + case 5: + List list4 = Arrays.asList(str.split("\n")); + pin.setLifeStyle(list4); + continue; + } + } + + } + mongoTemplate.save(pin); + } + } + + 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); + PihModel pih = new PihModel(); + //0 健康教育之孕期相关 1 饮食 2 饮食之营养指南 3 运动 + pih.setType(3); + pih.setSymptomsType(1); + 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: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setUnscramble(list1); + continue; + case 3: + List list2 = Arrays.asList(str.split("\n")); + pih.setCheck(list2); + continue; + case 4: + List list3 = Arrays.asList(str.split("\n")); + pih.setDiet(list3); + continue; + case 5: + List list4 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list4); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + + Sheet s3 = wb.getSheet(3); + System.out.println(s3.getName() + " : "); + int rows3 = s3.getRows(); + if (rows3 > 0) { + //遍历每行 + for (int i = 1; i < rows3; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //0 健康教育之孕期相关 1 饮食 2 饮食之营养指南 3 运动 + pih.setType(1); + pih.setSymptomsType(2); + Cell[] cells = s3.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list4 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list4); + continue; + } + } + + } + mongoTemplate.save(pih); + } + } + + Sheet s4 = wb.getSheet(4); + System.out.println(s4.getName() + " : "); + int rows4 = s4.getRows(); + if (rows4 > 0) { + //遍历每行 + for (int i = 1; i < rows4; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(2); + pih.setSymptomsType(2); + Cell[] cells = s4.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + + Sheet s5 = wb.getSheet(5); + System.out.println(s5.getName() + " : "); + int rows5 = s5.getRows(); + if (rows5 > 0) { + //遍历每行 + for (int i = 1; i < rows5; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(3); + pih.setSymptomsType(2); + Cell[] cells = s5.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + + Sheet s6 = wb.getSheet(6); + System.out.println(s6.getName() + " : "); + int rows6 = s6.getRows(); + if (rows6 > 0) { + //遍历每行 + for (int i = 1; i < rows6; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(1); + pih.setSymptomsType(3); + Cell[] cells = s6.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + Sheet s7 = wb.getSheet(7); + System.out.println(s7.getName() + " : "); + int rows7 = s7.getRows(); + if (rows7 > 0) { + //遍历每行 + for (int i = 1; i < rows7; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(2); + pih.setSymptomsType(3); + Cell[] cells = s7.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + Sheet s8 = wb.getSheet(8); + System.out.println(s8.getName() + " : "); + int rows8 = s8.getRows(); + if (rows8 > 0) { + //遍历每行 + for (int i = 1; i < rows8; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(3); + pih.setSymptomsType(3); + Cell[] cells = s8.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + Sheet s9 = wb.getSheet(9); + System.out.println(s9.getName() + " : "); + int rows9 = s9.getRows(); + if (rows9 > 0) { + //遍历每行 + for (int i = 1; i < rows9; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(1); + pih.setSymptomsType(4); + Cell[] cells = s9.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + Sheet s10 = wb.getSheet(10); + System.out.println(s10.getName() + " : "); + int rows10 = s10.getRows(); + if (rows10 > 0) { + //遍历每行 + for (int i = 1; i < rows10; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(2); + pih.setSymptomsType(4); + Cell[] cells = s10.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + + } + mongoTemplate.save(pih); + } + } + Sheet s11 = wb.getSheet(11); + System.out.println(s11.getName() + " : "); + int rows11 = s11.getRows(); + if (rows11 > 0) { + //遍历每行 + for (int i = 1; i < rows11; i++) { + System.out.println("rows=" + i); + PihModel pih = new PihModel(); + //1,阴性 2.阳性 3.可疑 + //c1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + pih.setType(3); + pih.setSymptomsType(4); + Cell[] cells = s11.getRow(i); + if (cells.length > 0) { + //遍历每行中的每列 + for (int j = 0; j < cells.length; j++) { + String str = cells[j].getContents().trim(); + switch (j) { + case 0: + pih.setStartWeek(Integer.parseInt(str)); + continue; + case 1: + pih.setEndWeek(Integer.parseInt(str)); + continue; + case 2: + List list1 = Arrays.asList(str.split("\n")); + pih.setLifeStyle(list1); + continue; + + } + } + } + mongoTemplate.save(pih); + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (BiffException e) { + e.printStackTrace(); + } + + } + public static void main(String[] args) { // weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); // weightMange("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); @@ -3537,7 +4021,8 @@ public class BasicConfigServiceTest { // babyNutritionConfig("F:\\儿童营养报告\\婴幼儿体重与营养管理报告内容及规则\\儿童膳食报告文章2.xls"); //xyPresentation("E:\\血压报告.xls"); - weightReport("E:\\体重营养报告10.xls"); + //weightReport("E:\\体重营养报告10.xls"); + renGaoZhen("G:\\妊高症风险.xls"); } } diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/PihModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/PihModel.java new file mode 100644 index 0000000..1b3548f --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/PihModel.java @@ -0,0 +1,97 @@ +package com.lyms.platform.pojo; + +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.List; + +@Document(collection = "lyms_pin_config") +public class PihModel { + + private String id; + private Integer startWeek; + private Integer endWeek; + private List unscramble;//检查结果解读 + private List check;//定期检查 + private List diet;//饮食建议 + private List lifeStyle;//生活方式指导 + /** + * 1,阴性 2.阳性 3.可疑 + */ + private Integer type; + /** + * 1.无风险因素 2.甲亢 3.糖尿病 4.缺铁性贫血 + */ + private Integer symptomsType; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getStartWeek() { + return startWeek; + } + + public void setStartWeek(Integer startWeek) { + this.startWeek = startWeek; + } + + public Integer getEndWeek() { + return endWeek; + } + + public void setEndWeek(Integer endWeek) { + this.endWeek = endWeek; + } + + public List getUnscramble() { + return unscramble; + } + + public void setUnscramble(List unscramble) { + this.unscramble = unscramble; + } + + public List getCheck() { + return check; + } + + public void setCheck(List check) { + this.check = check; + } + + public List getDiet() { + return diet; + } + + public void setDiet(List diet) { + this.diet = diet; + } + + public List getLifeStyle() { + return lifeStyle; + } + + public void setLifeStyle(List lifeStyle) { + this.lifeStyle = lifeStyle; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getSymptomsType() { + return symptomsType; + } + + public void setSymptomsType(Integer symptomsType) { + this.symptomsType = symptomsType; + } +} diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/PihParameterModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/PihParameterModel.java new file mode 100644 index 0000000..f20a7ad --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/PihParameterModel.java @@ -0,0 +1,253 @@ +package com.lyms.platform.pojo; + + +import org.springframework.data.mongodb.core.mapping.Document; + +@Document(collection = "lyms_pin_parameter") +public class PihParameterModel { + + private String id; + private String ssyBT;//收缩压 + private String szyBT;//舒张压 + private String cvp;//脉压 + private String meanAP;//平均动脉压 + private String pbpi;//血压指数 + private String bsa;//体表面积 + private String totalBloodVolume;//总血容量 + private String sff;//波形系数 + private String bmi;//体重指数 + private String cardiacOutput;//心输出力 + private String wzzl;//外周助力 + private String aestheticVolume;//美博量 + private String cl;//心脏指数 + private String cardiacIndex;//心博指数 + private String compliance;//顺应性 + private String heartRate;//心率 + private String cbf;//中心血流量 + private String bloodViscosity;//血液沾度 + private String arTime;//平均滞留时间 + private String parameterResult;//参数结果 + private String parameterGuide;//参数指南 + private String pulse;//脉搏波形 + private String measureEnd;//测量结束 + private String exit;//非正常退出 + private String pid;//病人id + private String hospitalId;//医院id + private String IDCard;//病人身份证号 + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSsyBT() { + return ssyBT; + } + + public void setSsyBT(String ssyBT) { + this.ssyBT = ssyBT; + } + + public String getSzyBT() { + return szyBT; + } + + public void setSzyBT(String szyBT) { + this.szyBT = szyBT; + } + + public String getCvp() { + return cvp; + } + + public void setCvp(String cvp) { + this.cvp = cvp; + } + + public String getMeanAP() { + return meanAP; + } + + public void setMeanAP(String meanAP) { + this.meanAP = meanAP; + } + + public String getPbpi() { + return pbpi; + } + + public void setPbpi(String pbpi) { + this.pbpi = pbpi; + } + + public String getBsa() { + return bsa; + } + + public void setBsa(String bsa) { + this.bsa = bsa; + } + + public String getTotalBloodVolume() { + return totalBloodVolume; + } + + public void setTotalBloodVolume(String totalBloodVolume) { + this.totalBloodVolume = totalBloodVolume; + } + + public String getSff() { + return sff; + } + + public void setSff(String sff) { + this.sff = sff; + } + + public String getBmi() { + return bmi; + } + + public void setBmi(String bmi) { + this.bmi = bmi; + } + + public String getCardiacOutput() { + return cardiacOutput; + } + + public void setCardiacOutput(String cardiacOutput) { + this.cardiacOutput = cardiacOutput; + } + + public String getWzzl() { + return wzzl; + } + + public void setWzzl(String wzzl) { + this.wzzl = wzzl; + } + + public String getAestheticVolume() { + return aestheticVolume; + } + + public void setAestheticVolume(String aestheticVolume) { + this.aestheticVolume = aestheticVolume; + } + + public String getCl() { + return cl; + } + + public void setCl(String cl) { + this.cl = cl; + } + + public String getCardiacIndex() { + return cardiacIndex; + } + + public void setCardiacIndex(String cardiacIndex) { + this.cardiacIndex = cardiacIndex; + } + + public String getCompliance() { + return compliance; + } + + public void setCompliance(String compliance) { + this.compliance = compliance; + } + + public String getHeartRate() { + return heartRate; + } + + public void setHeartRate(String heartRate) { + this.heartRate = heartRate; + } + + public String getCbf() { + return cbf; + } + + public void setCbf(String cbf) { + this.cbf = cbf; + } + + public String getBloodViscosity() { + return bloodViscosity; + } + + public void setBloodViscosity(String bloodViscosity) { + this.bloodViscosity = bloodViscosity; + } + + public String getArTime() { + return arTime; + } + + public void setArTime(String arTime) { + this.arTime = arTime; + } + + public String getParameterResult() { + return parameterResult; + } + + public void setParameterResult(String parameterResult) { + this.parameterResult = parameterResult; + } + + public String getParameterGuide() { + return parameterGuide; + } + + public void setParameterGuide(String parameterGuide) { + this.parameterGuide = parameterGuide; + } + + public String getPulse() { + return pulse; + } + + public void setPulse(String pulse) { + this.pulse = pulse; + } + + public String getMeasureEnd() { + return measureEnd; + } + + public void setMeasureEnd(String measureEnd) { + this.measureEnd = measureEnd; + } + + public String getExit() { + return exit; + } + + public void setExit(String exit) { + this.exit = exit; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java index 42e17d6..bc1a86a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/annualReportController.java @@ -32,7 +32,7 @@ public class annualReportController extends BaseController { @RequestParam(required = false) String proviceId, @RequestParam(required = false) String cityId, HttpServletResponse httpServletResponse) { - if (StringUtils.isEmpty(proviceId) && StringUtils.isEmpty(cityId)) { + if (StringUtils.isEmpty(proviceId) && StringUtils.isEmpty(cityId) && StringUtils.isEmpty(time)) { return; } annualReportFacade.queryAnnualReport(getUserId(request), time, proviceId, cityId, httpServletResponse); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/pihController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/pihController.java new file mode 100644 index 0000000..6f6d7c0 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/pihController.java @@ -0,0 +1,46 @@ +package com.lyms.platform.operate.web.controller; + +import com.lyms.platform.common.base.BaseController; +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.operate.web.service.PihService; +import com.lyms.platform.pojo.PihParameterModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.validation.Valid; + + +@Controller +@RequestMapping(value = "/pih") +public class pihController extends BaseController { + + @Autowired + private PihService pihService; + + + @ResponseBody + @RequestMapping(value = "/add", method = RequestMethod.POST) + public void addPih(@Valid @RequestBody PihParameterModel parameterModel) { + pihService.addPih(parameterModel); + } + + + @RequestMapping(value = "/query", method = RequestMethod.GET) + @ResponseBody + public BaseResponse queryAllPih() { + + + return null; + } + + @ResponseBody + @RequestMapping(value = "/queyrInfo", method = RequestMethod.GET) + public BaseResponse query(String cardNo) { + return pihService.queryInfo(cardNo); + } + +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PihService.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PihService.java new file mode 100644 index 0000000..392b884 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PihService.java @@ -0,0 +1,10 @@ +package com.lyms.platform.operate.web.service; + +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.pojo.PihParameterModel; + +public interface PihService { + public void addPih(PihParameterModel parameterModel); + + public BaseResponse queryInfo(String cardNo); +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PihServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PihServiceImpl.java new file mode 100644 index 0000000..314cef2 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PihServiceImpl.java @@ -0,0 +1,45 @@ +package com.lyms.platform.operate.web.service.impl; + +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.common.result.RespBuilder; +import com.lyms.platform.operate.web.service.PihService; +import com.lyms.platform.pojo.Patients; +import com.lyms.platform.pojo.PihParameterModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Service +public class PihServiceImpl extends BaseServiceImpl implements PihService { + + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public void addPih(PihParameterModel parameterModel) { + mongoTemplate.save(parameterModel); + + } + + @Override + public BaseResponse queryInfo(String cardNo) { + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(cardNo)), Patients.class); + Map map = new HashMap<>(); + if (patients != null) { + map.put("username", patients.getUsername()); + map.put("cardNo", patients.getCardNo()); + map.put("hospitalId", patients.getHospitalId()); + map.put("age", patients.getAge()); + map.put("phone", patients.getPhone()); + map.put("vcCardNo", patients.getVcCardNo()); + return RespBuilder.buildSuccess(map); + } + return RespBuilder.buildSuccess("没有此人信息"); + } + +} -- 1.8.3.1