Commit 8f1973d719a299e16cb2ab71ad20c0d36adc39e4

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 6 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 8f1973d
... ... @@ -8,9 +8,11 @@
8 8 import com.lyms.platform.biz.service.GuidelinesService;
9 9 import com.lyms.platform.common.enums.YnEnums;
10 10 import com.lyms.platform.common.utils.JsonUtil;
  11 +import com.lyms.platform.common.utils.PingYinUtil;
11 12 import com.lyms.platform.common.utils.SystemConfig;
12 13 import com.lyms.platform.pojo.*;
13 14 import org.apache.commons.io.FileUtils;
  15 +import org.apache.struts.config.BaseConfig;
14 16 import org.springframework.context.ApplicationContext;
15 17 import org.springframework.context.support.ClassPathXmlApplicationContext;
16 18  
... ... @@ -24,7 +26,7 @@
24 26 public static void main(String[] args) throws Exception {
25 27 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
26 28 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
27   - PuerperaService basicConfigService = (PuerperaService) applicationContext.getBean(PuerperaService.class);
  29 + // PuerperaService basicConfigService = (PuerperaService) applicationContext.getBean(PuerperaService.class);
28 30 /* PuerperaModel obj = new PuerperaModel();
29 31 obj.setAddress("成都市高新区天府2街");
30 32 obj.setAge(111);
31 33  
... ... @@ -48,14 +50,14 @@
48 50 obj1.setCardNo("50022319951267164466");
49 51 basicConfigService.addPuerpera(obj1);*/
50 52  
51   - PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
  53 + // PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
52 54  
53 55 ;
54 56 // puerperaQuery.setKeyword("小王");
55 57 // puerperaQuery.setDueDateStart(sdf.parse("2016-1-12"));
56 58 // puerperaQuery.setDueDateEnd(sdf.parse("2016-3-16"));
57   - puerperaQuery.setId("5719caf624fd57791341b7cb");
58   - System.out.println(basicConfigService.queryPuerpera(puerperaQuery));
  59 + // puerperaQuery.setId("5719caf624fd57791341b7cb");
  60 + // System.out.println(basicConfigService.queryPuerpera(puerperaQuery));
59 61 /*
60 62 * for(int i = 6;i<7;i++){ BasicConfig obj = new BasicConfig(); obj.setCode("xc123456"+i); obj.setName("哮喘123456"+i); obj.setYn(1);
61 63 * obj.setParentId("56ea134c24fdaafbabbb0025"); basicConfigService.addBasicConfig(obj); }
... ... @@ -78,7 +80,9 @@
78 80 // addVisit(applicationContext);
79 81 // addaw(applicationContext, "0-83月龄身长、高标准差数值表(男、女).csv", 1);
80 82 // addaw(applicationContext, "0-83月龄体重标准差数值表(男、女).csv", 0);
81   - addZhenduan(applicationContext);
  83 +// addZhenduan(applicationContext);
  84 +
  85 + addCountry(applicationContext);
82 86 }
83 87  
84 88 public static void addZhenduan(ApplicationContext applicationContext) {
... ... @@ -320,6 +324,34 @@
320 324 date.put("xxxxxx3",SimplePermission3);
321 325 DataPermissionsModel.setData(date);
322 326 mongoTemplate.save(DataPermissionsModel);
  327 + }
  328 +
  329 +
  330 + public static void addCountry(ApplicationContext applicationContext) {
  331 + MongoTemplate mongoTemplate
  332 + =(MongoTemplate)applicationContext.getBean("mongoTemplate");
  333 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  334 +
  335 + try {
  336 + List<String> list = FileUtils.readLines(new File("F:\\temp\\country.txt"),"gbk");
  337 + for (String line:list) {
  338 + if (line != null) {
  339 + BasicConfig config = new BasicConfig();
  340 + config.setYn(YnEnums.YES.getId());
  341 + config.setCode(PingYinUtil.getFirstSpell(line).toUpperCase());
  342 + config.setName(line);
  343 + config.setEnable(1);
  344 + Thread.sleep(1000);
  345 + config.setCreateDate(new Date().getTime());
  346 + config.setParentId("57dc45f7-b0ba-42f0-863b-de53966a6e65");
  347 + mongoTemplate.save(config);
  348 + System.out.println(line);
  349 + }
  350 + }
  351 +
  352 + } catch (Exception e) {
  353 + e.printStackTrace();
  354 + }
323 355 }
324 356  
325 357 public static void addVisit(ApplicationContext applicationContext){
platform-common/pom.xml View file @ 8f1973d
... ... @@ -14,7 +14,11 @@
14 14 <groupId>commons-httpclient</groupId>
15 15 <artifactId>commons-httpclient</artifactId>
16 16 </dependency>
17   -
  17 + <dependency>
  18 + <groupId>com.belerweb</groupId>
  19 + <artifactId>pinyin4j</artifactId>
  20 + <version>2.5.0</version>
  21 + </dependency>
18 22 </dependencies>
19 23 <build>
20 24 <plugins>
platform-common/src/main/java/com/lyms/platform/common/utils/PingYinUtil.java View file @ 8f1973d
  1 +package com.lyms.platform.common.utils;
  2 +
  3 +/**
  4 + * Created by Administrator on 2016/9/6.
  5 + */
  6 +import net.sourceforge.pinyin4j.PinyinHelper;
  7 +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
  8 +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
  9 +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
  10 +import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
  11 +import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
  12 +
  13 +/**
  14 + * 拼音工具类
  15 + *
  16 + * @author lsf
  17 + */
  18 +public class PingYinUtil {
  19 + /**
  20 + * 将字符串中的中文转化为拼音,其他字符不变
  21 + *
  22 + * @param inputString
  23 + * @return
  24 + */
  25 + public static String getPingYin(String inputString) {
  26 + HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
  27 + format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
  28 + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
  29 + format.setVCharType(HanyuPinyinVCharType.WITH_V);
  30 +
  31 + char[] input = inputString.trim().toCharArray();
  32 + String output = "";
  33 +
  34 + try {
  35 + for (int i = 0; i < input.length; i++) {
  36 + if (java.lang.Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) {
  37 + String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format);
  38 + output += temp[0];
  39 + } else
  40 + output += java.lang.Character.toString(input[i]);
  41 + }
  42 + } catch (BadHanyuPinyinOutputFormatCombination e) {
  43 + e.printStackTrace();
  44 + }
  45 + return output;
  46 + }
  47 + /**
  48 + * 获取汉字串拼音首字母,英文字符不变
  49 + * @param chinese 汉字串
  50 + * @return 汉语拼音首字母
  51 + */
  52 + public static String getFirstSpell(String chinese) {
  53 + StringBuffer pybf = new StringBuffer();
  54 + char[] arr = chinese.toCharArray();
  55 + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
  56 + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
  57 + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
  58 + for (int i = 0; i < arr.length; i++) {
  59 + if (arr[i] > 128) {
  60 + try {
  61 + String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat);
  62 + if (temp != null) {
  63 + pybf.append(temp[0].charAt(0));
  64 + }
  65 + } catch (BadHanyuPinyinOutputFormatCombination e) {
  66 + e.printStackTrace();
  67 + }
  68 + } else {
  69 + pybf.append(arr[i]);
  70 + }
  71 + }
  72 + return pybf.toString().replaceAll("\\W", "").trim();
  73 + }
  74 + /**
  75 + * 获取汉字串拼音,英文字符不变
  76 + * @param chinese 汉字串
  77 + * @return 汉语拼音
  78 + */
  79 + public static String getFullSpell(String chinese) {
  80 + StringBuffer pybf = new StringBuffer();
  81 + char[] arr = chinese.toCharArray();
  82 + HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
  83 + defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
  84 + defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
  85 + for (int i = 0; i < arr.length; i++) {
  86 + if (arr[i] > 128) {
  87 + try {
  88 + pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]);
  89 + } catch (BadHanyuPinyinOutputFormatCombination e) {
  90 + e.printStackTrace();
  91 + }
  92 + } else {
  93 + pybf.append(arr[i]);
  94 + }
  95 + }
  96 + return pybf.toString();
  97 + }
  98 +
  99 + public static void main(String[] args)
  100 + {
  101 + String s = getFirstSpell("中华人民共和国");
  102 + System.out.print(s);
  103 + }
  104 +}
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java View file @ 8f1973d
... ... @@ -655,7 +655,7 @@
655 655  
656 656 if (!CollectionUtils.isNotEmpty(templates))
657 657 {
658   - return;
  658 + continue;
659 659 }
660 660  
661 661 //循环每一个模板,根据模板条件查询到用户 发送短信
... ... @@ -696,6 +696,8 @@
696 696  
697 697 PatientsQuery patientsQuery = new PatientsQuery();
698 698 patientsQuery.setYn(YnEnums.YES.getId());
  699 + patientsQuery.setHospitalId(hospitalId);
  700 +
699 701 //1孕妇
700 702 patientsQuery.setType(1);
701 703 // 0未终止妊娠 1终止妊娠
... ... @@ -1006,7 +1008,7 @@
1006 1008 {
1007 1009 BabyModelQuery babyModelQuery = new BabyModelQuery();
1008 1010 babyModelQuery.setYn(YnEnums.YES.getId());
1009   -
  1011 + babyModelQuery.setHospitalId(hospitalId);
1010 1012 babyModelQuery = getServiceBabyQuery( serviceType, serviceStatus, babyModelQuery);
1011 1013  
1012 1014 //发送短信集合
1013 1015  
... ... @@ -1332,8 +1334,10 @@
1332 1334 //产妇
1333 1335 else if (serviceObj == ServiceObjEnums.CHANOBJ.getId())
1334 1336 {
  1337 +
1335 1338 PatientsQuery patientsQuery = new PatientsQuery();
1336 1339 patientsQuery.setYn(YnEnums.YES.getId());
  1340 + patientsQuery.setHospitalId(hospitalId);
1337 1341 //1孕妇 3产妇
1338 1342 patientsQuery.setType(3);
1339 1343  
... ... @@ -1351,7 +1355,7 @@
1351 1355 Date actualSendDate = DateUtil.addDay(DateUtil.parseYMD(currentDate), sendTimeType);
1352 1356  
1353 1357 //查询出产妇预约
1354   - List<PostReviewModel> orderModels = postReviewService.queryPostOrder(actualSendDate,tempHid);
  1358 + List<PostReviewModel> orderModels = postReviewService.queryPostOrder(actualSendDate, tempHid);
1355 1359 if(CollectionUtils.isNotEmpty(orderModels))
1356 1360 {
1357 1361 for(PostReviewModel orderModel : orderModels)
... ... @@ -1364,6 +1368,7 @@
1364 1368 }
1365 1369 }
1366 1370 }
  1371 + //产后复查程序提醒
1367 1372 else if (smsType == SmsServiceEnums.CHFCCXTX.getId())
1368 1373 {
1369 1374 //发送频次
... ... @@ -1521,6 +1526,8 @@
1521 1526 {
1522 1527 PatientsQuery chanPatientsQuery = new PatientsQuery();
1523 1528 chanPatientsQuery.setYn(YnEnums.YES.getId());
  1529 + chanPatientsQuery.setHospitalId(hospitalId);
  1530 +
1524 1531 //3产妇
1525 1532 chanPatientsQuery.setType(3);
1526 1533 getServicePatientQuery(serviceType, serviceStatus, chanPatientsQuery);
... ... @@ -1528,6 +1535,7 @@
1528 1535  
1529 1536 PatientsQuery yunPatientsQuery = new PatientsQuery();
1530 1537 yunPatientsQuery.setYn(YnEnums.YES.getId());
  1538 + yunPatientsQuery.setHospitalId(hospitalId);
1531 1539 //1孕妇
1532 1540 yunPatientsQuery.setType(1);
1533 1541 getServicePatientQuery(serviceType, serviceStatus, yunPatientsQuery);
... ... @@ -1535,6 +1543,7 @@
1535 1543  
1536 1544 BabyModelQuery babyModelQuery = new BabyModelQuery();
1537 1545 babyModelQuery.setYn(YnEnums.YES.getId());
  1546 + babyModelQuery.setHospitalId(hospitalId);
1538 1547 babyModelQuery = getServiceBabyQuery(serviceType, serviceStatus, babyModelQuery);
1539 1548  
1540 1549 //发送短信集合
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java View file @ 8f1973d
... ... @@ -57,8 +57,8 @@
57 57 private String typeId;
58 58 @Value("#{configProperties['login.defaultPwd']}")
59 59 private String defaultPwd;
60   - @Value("#{configProperties['default_admin_org_id']}")
61   - private Integer default_admin_org_id;
  60 + @Value("#{configProperties['defaultAdminOrgId']}")
  61 + private String defaultAdminOrgId;
62 62 @Autowired
63 63 private RolePermissionMapsService rolePermissionMapsService;
64 64 @Autowired
... ... @@ -579,7 +579,7 @@
579 579 Users users = new Users();
580 580 users.setType(UserTypeEnum.PLATFORM_ADMIN.getId());
581 581 users.setName(name);
582   - user.setOrgId(default_admin_org_id);
  582 + user.setOrgId(Integer.parseInt(defaultAdminOrgId));
583 583 users.setAccount(account);
584 584 users.setPhone(phone);
585 585 users.setEnable(enable);
platform-operate-api/src/main/resources/database.properties View file @ 8f1973d
... ... @@ -58,5 +58,5 @@
58 58 report.minpoolsize=2
59 59  
60 60 #添加管理员默认所属机构
61   -default_admin_org_id=203
  61 +defaultAdminOrgId=203