Commit 0144898cf952134afb0838d976e1a70789a7723a
1 parent
795cddadd2
Exists in
master
and in
6 other branches
省平台孕前优生
Showing 4 changed files with 195 additions and 4 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PreeugenicsAddrModel.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/LhxfyService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
0144898
| ... | ... | @@ -7135,8 +7135,62 @@ |
| 7135 | 7135 | } |
| 7136 | 7136 | |
| 7137 | 7137 | |
| 7138 | + public static void savePreeugenicsAddr(String fileName) { | |
| 7139 | + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
| 7140 | + MongoTemplate mongoTemplate | |
| 7141 | + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
| 7142 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 7143 | + File file = new File(fileName); | |
| 7144 | + Workbook wb = null; | |
| 7145 | + try { | |
| 7146 | + wb = Workbook.getWorkbook(file); | |
| 7147 | + | |
| 7148 | + Sheet s = wb.getSheet(0); | |
| 7149 | + System.out.println(s.getName() + " : "); | |
| 7150 | + int rows = s.getRows(); | |
| 7151 | + if (rows > 0) { | |
| 7152 | + //遍历每行 | |
| 7153 | + for (int i = 1; i < rows; i++) { | |
| 7154 | + System.out.println("rows=" + i); | |
| 7155 | + PreeugenicsAddrModel model = new PreeugenicsAddrModel(); | |
| 7156 | + Cell[] cells = s.getRow(i); | |
| 7157 | + if (cells.length > 0) { | |
| 7158 | + for (int j = 0; j < cells.length; j++) { | |
| 7159 | + | |
| 7160 | + String str = cells[j].getContents().trim(); | |
| 7161 | + switch (j) { | |
| 7162 | + case 0: | |
| 7163 | + model.setId(str); | |
| 7164 | + continue; | |
| 7165 | + case 1: | |
| 7166 | + | |
| 7167 | + continue; | |
| 7168 | + case 2: | |
| 7169 | + model.setName(str); | |
| 7170 | + continue; | |
| 7171 | + case 3: | |
| 7172 | + model.setParentId(str); | |
| 7173 | + continue; | |
| 7174 | + case 4: | |
| 7175 | + model.setLevel(str); | |
| 7176 | + continue; | |
| 7177 | + } | |
| 7178 | + } | |
| 7179 | + } | |
| 7180 | + mongoTemplate.save(model); | |
| 7181 | + } | |
| 7182 | + } | |
| 7183 | + } catch (Exception e) { | |
| 7184 | + e.printStackTrace(); | |
| 7185 | + } | |
| 7186 | + } | |
| 7187 | + | |
| 7188 | + | |
| 7189 | + | |
| 7190 | + | |
| 7138 | 7191 | public static void main(String[] args) { |
| 7139 | - dic(); | |
| 7192 | + savePreeugenicsAddr("C:\\Users\\liquanyu\\Desktop\\doc\\孕前优生上传省平台\\承德区划对照表.xls"); | |
| 7193 | +// dic(); | |
| 7140 | 7194 | // handle(); |
| 7141 | 7195 | // getData(); |
| 7142 | 7196 | //weightWeek("F:\\体重与营养管理\\体重与营养管理第三版(北方)改标红“、冰淇淋”-晓萌.xls"); |
platform-dal/src/main/java/com/lyms/platform/pojo/PreeugenicsAddrModel.java
View file @
0144898
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseModel; | |
| 4 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + *孕前优生省平台地址 | |
| 10 | + */ | |
| 11 | +@Document(collection = "lyms_preeugenics_addr") | |
| 12 | +public class PreeugenicsAddrModel extends BaseModel { | |
| 13 | + | |
| 14 | + private String id; | |
| 15 | + private String name; | |
| 16 | + private String parentId; | |
| 17 | + // 1:省 2:市 3:县/区 4:乡 5:村 | |
| 18 | + private String level; | |
| 19 | + | |
| 20 | + public String getId() { | |
| 21 | + return id; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setId(String id) { | |
| 25 | + this.id = id; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public String getName() { | |
| 29 | + return name; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setName(String name) { | |
| 33 | + this.name = name; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public String getParentId() { | |
| 37 | + return parentId; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setParentId(String parentId) { | |
| 41 | + this.parentId = parentId; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getLevel() { | |
| 45 | + return level; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setLevel(String level) { | |
| 49 | + this.level = level; | |
| 50 | + } | |
| 51 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/lhxfy/LhxfyService.java
View file @
0144898
| ... | ... | @@ -9,9 +9,8 @@ |
| 9 | 9 | import com.lyms.platform.operate.web.utils.*; |
| 10 | 10 | import com.lyms.platform.permission.model.LisReportItemModel; |
| 11 | 11 | import com.lyms.platform.permission.model.LisReportModel; |
| 12 | -import com.lyms.platform.pojo.PreEugenicsBaseModel; | |
| 13 | -import com.lyms.platform.pojo.PremaritalCheckup; | |
| 14 | -import com.lyms.platform.pojo.ResidentsArchiveModel; | |
| 12 | +import com.lyms.platform.pojo.*; | |
| 13 | +import com.lyms.platform.query.BasicConfigQuery; | |
| 15 | 14 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 16 | 15 | import net.sf.json.JSONObject; |
| 17 | 16 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -25,6 +24,7 @@ |
| 25 | 24 | import org.springframework.data.mongodb.core.query.Query; |
| 26 | 25 | import org.springframework.data.mongodb.core.query.Update; |
| 27 | 26 | import org.springframework.stereotype.Service; |
| 27 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | import java.util.*; |
| ... | ... | @@ -1152,6 +1152,51 @@ |
| 1152 | 1152 | e.printStackTrace(); |
| 1153 | 1153 | } |
| 1154 | 1154 | } |
| 1155 | + | |
| 1156 | + /** | |
| 1157 | + * | |
| 1158 | + * @param streetId 街道地址id | |
| 1159 | + * @return | |
| 1160 | + */ | |
| 1161 | + public String getPreeugenicsAddr(String streetId) { | |
| 1162 | + | |
| 1163 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(streetId); | |
| 1164 | + if (basicConfig != null) | |
| 1165 | + { | |
| 1166 | + String name = basicConfig.getName(); | |
| 1167 | + String parentId = basicConfig.getParentId(); | |
| 1168 | + PreeugenicsAddrModel addrModel = mongoTemplate.findOne(Query.query(Criteria.where("name").is(name).and("level").is("4")), PreeugenicsAddrModel.class); | |
| 1169 | + if (addrModel != null) | |
| 1170 | + { | |
| 1171 | + List<PreeugenicsAddrModel> addrModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(addrModel.getId()).and("level").is("5")), PreeugenicsAddrModel.class); | |
| 1172 | + if (CollectionUtils.isNotEmpty(addrModels)) | |
| 1173 | + { | |
| 1174 | + return addrModels.get(0).getId(); | |
| 1175 | + } | |
| 1176 | + } | |
| 1177 | + else | |
| 1178 | + { | |
| 1179 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
| 1180 | + basicConfigQuery.setParentId(parentId); | |
| 1181 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
| 1182 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(basicConfigQuery); | |
| 1183 | + if (CollectionUtils.isNotEmpty(configList)) | |
| 1184 | + { | |
| 1185 | + PreeugenicsAddrModel addrModel1 = mongoTemplate.findOne(Query.query(Criteria.where("name").is(configList.get(0).getName()).and("level").is("4")), PreeugenicsAddrModel.class); | |
| 1186 | + if (addrModel1 != null) | |
| 1187 | + { | |
| 1188 | + List<PreeugenicsAddrModel> addrModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(addrModel1.getId()).and("level").is("5")), PreeugenicsAddrModel.class); | |
| 1189 | + if (CollectionUtils.isNotEmpty(addrModels)) | |
| 1190 | + { | |
| 1191 | + return addrModels.get(0).getId(); | |
| 1192 | + } | |
| 1193 | + } | |
| 1194 | + } | |
| 1195 | + } | |
| 1196 | + } | |
| 1197 | + return ""; | |
| 1198 | + } | |
| 1199 | + | |
| 1155 | 1200 | |
| 1156 | 1201 | |
| 1157 | 1202 | public static final String LHFY_HIS_URL = PropertiesUtils.getPropertyValue("lhfy_his_url"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
0144898
| ... | ... | @@ -4896,7 +4896,46 @@ |
| 4896 | 4896 | } |
| 4897 | 4897 | return "success"; |
| 4898 | 4898 | } |
| 4899 | + @RequestMapping(value = "/getPreeugenicsAddr/{streetId}", method = RequestMethod.GET) | |
| 4900 | + @ResponseBody | |
| 4901 | + public String getPreeugenicsAddr(@PathVariable("streetId") String streetId) { | |
| 4899 | 4902 | |
| 4903 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(streetId); | |
| 4904 | + if (basicConfig != null) | |
| 4905 | + { | |
| 4906 | + String name = basicConfig.getName(); | |
| 4907 | + String parentId = basicConfig.getParentId(); | |
| 4908 | + PreeugenicsAddrModel addrModel = mongoTemplate.findOne(Query.query(Criteria.where("name").is(name).and("level").is("4")), PreeugenicsAddrModel.class); | |
| 4909 | + if (addrModel != null) | |
| 4910 | + { | |
| 4911 | + List<PreeugenicsAddrModel> addrModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(addrModel.getId()).and("level").is("5")), PreeugenicsAddrModel.class); | |
| 4912 | + if (CollectionUtils.isNotEmpty(addrModels)) | |
| 4913 | + { | |
| 4914 | + return addrModels.get(0).getId(); | |
| 4915 | + } | |
| 4916 | + } | |
| 4917 | + else | |
| 4918 | + { | |
| 4919 | + BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); | |
| 4920 | + basicConfigQuery.setParentId(parentId); | |
| 4921 | + basicConfigQuery.setYn(YnEnums.YES.getId()); | |
| 4922 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(basicConfigQuery); | |
| 4923 | + if (CollectionUtils.isNotEmpty(configList)) | |
| 4924 | + { | |
| 4925 | + PreeugenicsAddrModel addrModel1 = mongoTemplate.findOne(Query.query(Criteria.where("name").is(configList.get(0).getName()).and("level").is("4")), PreeugenicsAddrModel.class); | |
| 4926 | + if (addrModel1 != null) | |
| 4927 | + { | |
| 4928 | + List<PreeugenicsAddrModel> addrModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(addrModel1.getId()).and("level").is("5")), PreeugenicsAddrModel.class); | |
| 4929 | + if (CollectionUtils.isNotEmpty(addrModels)) | |
| 4930 | + { | |
| 4931 | + return addrModels.get(0).getId(); | |
| 4932 | + } | |
| 4933 | + } | |
| 4934 | + } | |
| 4935 | + } | |
| 4936 | + } | |
| 4937 | + return ""; | |
| 4938 | + } | |
| 4900 | 4939 | |
| 4901 | 4940 | } |