|
@ -0,0 +1,553 @@
|
|
|
|
package com.yihu.wlyy.service.service;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.service.dao.zydict.*;
|
|
|
|
import com.yihu.wlyy.service.entity.zydict.*;
|
|
|
|
import com.yihu.wlyy.service.service.prescription.PrescriptionService;
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by chenweida on 2017/8/10.
|
|
|
|
* 智业的字典数据
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
public class ZyDictDataService extends ZysoftBaseService {
|
|
|
|
private Logger logger = LoggerFactory.getLogger(ZyDictDataService.class);
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ZyCommonDictDao zyCommonDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvDeptDictDao zyIvDeptDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvDeptStaffAllotDictDao zyIvDeptStaffAllotDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvDiagnoseClassDictDao zyIvDiagnoseClassDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvDiagnoseDictDao zyIvDiagnoseDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvOrgPhysicAllotDictDao zyIvOrgPhysicAllotDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvPhysicDictDao zyIvPhysicDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvStaffDictDao zyIvStaffDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvStaffRegTypeAllotDictDao zyIvStaffRegTypeAllotDictDao;
|
|
|
|
@Autowired
|
|
|
|
private ZyIvSubjectClassDictDao zyIvSubjectClassDictDao;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionService prescriptionService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据字典名称下载字典
|
|
|
|
* @param dictName
|
|
|
|
*/
|
|
|
|
public void dictByDictName(String dictName){
|
|
|
|
switch (dictName){
|
|
|
|
case IV_SUBJECT_CLASS_DICT:
|
|
|
|
synchronizeZy_iv_subject_class_dict();
|
|
|
|
break;
|
|
|
|
case IV_STAFF_REG_TYPE_ALLOT_DICT:
|
|
|
|
synchronizeZy_iv_staff_reg_type_allot_dict();
|
|
|
|
break;
|
|
|
|
case IV_STAFF_DICT:
|
|
|
|
synchronizeZy_iv_staff_dict();
|
|
|
|
break;
|
|
|
|
case IV_PHYSIC_DICT:
|
|
|
|
synchronizeZy_iv_physic_dict();
|
|
|
|
break;
|
|
|
|
case IV_ORG_PHYSIC_ALLOT_DICT:
|
|
|
|
synchronizeZy_iv_org_physic_allot_dict();
|
|
|
|
break;
|
|
|
|
case IV_DIAGNOSE_CLASS_DICT:
|
|
|
|
synchronizeZy_iv_diagnose_class_dict();
|
|
|
|
break;
|
|
|
|
case IV_DEPT_STAFF_ALLOT_DICT:
|
|
|
|
synchronizeZy_iv_dept_staff_allot_dict();
|
|
|
|
break;
|
|
|
|
case "commonDict":
|
|
|
|
synchronizeZyCommonDict();
|
|
|
|
break;
|
|
|
|
case IV_DEPT_DICT:
|
|
|
|
synchronizeZy_iv_dept_dict();
|
|
|
|
break;
|
|
|
|
default:break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void allDict() {
|
|
|
|
try {
|
|
|
|
//同步 zy_common_dict
|
|
|
|
synchronizeZyCommonDict();
|
|
|
|
//同步 zy_iv_dept_dict
|
|
|
|
synchronizeZy_iv_dept_dict();
|
|
|
|
//同步 zy_iv_dept_staff_allot_dict
|
|
|
|
synchronizeZy_iv_dept_staff_allot_dict();
|
|
|
|
//同步 zy_iv_diagnose_dict
|
|
|
|
synchronizeZy_iv_diagnose_dict();
|
|
|
|
//同步 zy_iv_diagnose_class_dict
|
|
|
|
synchronizeZy_iv_diagnose_class_dict();
|
|
|
|
//同步 zy_iv_org_physic_allot_dict
|
|
|
|
synchronizeZy_iv_org_physic_allot_dict();
|
|
|
|
//同步 zy_iv_physic_dict
|
|
|
|
synchronizeZy_iv_physic_dict();
|
|
|
|
//同步 zy_iv_staff_dict
|
|
|
|
synchronizeZy_iv_staff_dict(); //birthday Date(529084800000+0800) 无法解析
|
|
|
|
//同步 zy_iv_staff_reg_type_allot_dict
|
|
|
|
synchronizeZy_iv_staff_reg_type_allot_dict();
|
|
|
|
//同步 zy_iv_subject_class_dict
|
|
|
|
synchronizeZy_iv_subject_class_dict();
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void synchronizeZy_iv_diagnose_dict() {
|
|
|
|
logger.info("synchronized zy_iv_diagnose_dict start");
|
|
|
|
String dictName = this.IV_DIAGNOSE_DICT;
|
|
|
|
List<ZyIvDiagnoseDict> zyIvDiagnoseDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvDiagnoseDicts = commonGetOneDict(ZyIvDiagnoseDict.class, dictName);
|
|
|
|
if (zyIvDiagnoseDicts != null && zyIvDiagnoseDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvDiagnoseDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_diagnose_dict ,size:" + zyIvDiagnoseDicts.size());
|
|
|
|
zyIvDiagnoseDictDao.save(zyIvDiagnoseDicts);
|
|
|
|
}
|
|
|
|
logger.info("synchronized zy_iv_diagnose_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_subject_class_dict() {
|
|
|
|
logger.info("synchronized zy_iv_subject_class_dict start");
|
|
|
|
String dictName = this.IV_SUBJECT_CLASS_DICT;
|
|
|
|
List<ZyIvSubjectClassDict> zyIvSubjectClassDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvSubjectClassDicts = commonGetOneDict(ZyIvSubjectClassDict.class, dictName);
|
|
|
|
if (zyIvSubjectClassDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvSubjectClassDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_subject_class_dict ,size:" + zyIvSubjectClassDicts.size());
|
|
|
|
zyIvSubjectClassDictDao.save(zyIvSubjectClassDicts);
|
|
|
|
logger.info("synchronized zy_iv_subject_class_dict end");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_staff_reg_type_allot_dict() {
|
|
|
|
logger.info("synchronized zy_iv_staff_reg_type_allot_dict start");
|
|
|
|
String dictName = this.IV_STAFF_REG_TYPE_ALLOT_DICT;
|
|
|
|
List<ZyIvStaffRegTypeAllotDict> zyIvStaffRegTypeAllotDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvStaffRegTypeAllotDicts = commonGetOneDict(ZyIvStaffRegTypeAllotDict.class, dictName);
|
|
|
|
if (zyIvStaffRegTypeAllotDicts != null && zyIvStaffRegTypeAllotDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvStaffRegTypeAllotDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_staff_reg_type_allot_dict ,size:" + zyIvStaffRegTypeAllotDicts.size());
|
|
|
|
zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDicts);
|
|
|
|
logger.info("synchronized zy_iv_staff_reg_type_allot_dict end");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_staff_dict() {
|
|
|
|
logger.info("synchronized zy_iv_staff_dict start");
|
|
|
|
String dictName = this.IV_STAFF_DICT;
|
|
|
|
List<ZyIvStaffDict> zyIvStaffDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvStaffDicts = commonGetOneDict(ZyIvStaffDict.class, dictName);
|
|
|
|
//清空表
|
|
|
|
if (zyIvStaffDicts != null && zyIvStaffDicts.size() > 0) {
|
|
|
|
zyIvStaffDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_staff_dict ,size:" + zyIvStaffDicts.size());
|
|
|
|
zyIvStaffDictDao.save(zyIvStaffDicts);
|
|
|
|
logger.info("synchronized zy_iv_staff_dict end");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_physic_dict() {
|
|
|
|
logger.info("synchronized zy_iv_physic_dict start");
|
|
|
|
String dictName = this.IV_PHYSIC_DICT;
|
|
|
|
List<ZyIvPhysicDict> zyIvPhysicDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvPhysicDicts = commonGetOneDict(ZyIvPhysicDict.class, dictName);
|
|
|
|
if (zyIvPhysicDicts != null && zyIvPhysicDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvPhysicDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_physic_dict ,size:" + zyIvPhysicDicts.size());
|
|
|
|
zyIvPhysicDictDao.save(zyIvPhysicDicts);
|
|
|
|
logger.info("synchronized zy_iv_physic_dict end");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_org_physic_allot_dict() {
|
|
|
|
logger.info("synchronized zy_iv_org_physic_allot_dict start");
|
|
|
|
String dictName = this.IV_ORG_PHYSIC_ALLOT_DICT;
|
|
|
|
List<ZyIvOrgPhysicAllotDict> zyIvOrgPhysicAllotDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvOrgPhysicAllotDicts = commonGetOneDict(ZyIvOrgPhysicAllotDict.class, dictName);
|
|
|
|
if (zyIvOrgPhysicAllotDicts != null && zyIvOrgPhysicAllotDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvOrgPhysicAllotDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_org_physic_allot_dict ,size:" + zyIvOrgPhysicAllotDicts.size());
|
|
|
|
zyIvOrgPhysicAllotDictDao.save(zyIvOrgPhysicAllotDicts);
|
|
|
|
}
|
|
|
|
logger.info("synchronized zy_iv_org_physic_allot_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_diagnose_class_dict() {
|
|
|
|
logger.info("synchronized zy_iv_diagnose_class_dict start");
|
|
|
|
String dictName = this.IV_DIAGNOSE_CLASS_DICT;
|
|
|
|
List<ZyIvDiagnoseClassDict> zIvDiagnoseClassDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zIvDiagnoseClassDicts = commonGetOneDict(ZyIvDiagnoseClassDict.class, dictName);
|
|
|
|
if (zIvDiagnoseClassDicts != null && zIvDiagnoseClassDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvDiagnoseClassDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
|
|
|
|
logger.info("save table zy_iv_diagnose_class_dict ,size:" + zIvDiagnoseClassDicts.size());
|
|
|
|
zyIvDiagnoseClassDictDao.save(zIvDiagnoseClassDicts);
|
|
|
|
}
|
|
|
|
logger.info("synchronized zy_iv_diagnose_class_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_dept_staff_allot_dict() {
|
|
|
|
logger.info("synchronized zy_iv_dept_staff_allot_dict start");
|
|
|
|
String dictName = this.IV_DEPT_STAFF_ALLOT_DICT;
|
|
|
|
List<ZyIvDeptStaffAllotDict> syIvDeptStaffAllotDictz = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
syIvDeptStaffAllotDictz = commonGetOneDict(ZyIvDeptStaffAllotDict.class, dictName);
|
|
|
|
|
|
|
|
if (syIvDeptStaffAllotDictz != null && syIvDeptStaffAllotDictz.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvDeptStaffAllotDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_dept_staff_allot_dict ,size:" + syIvDeptStaffAllotDictz.size());
|
|
|
|
zyIvDeptStaffAllotDictDao.save(syIvDeptStaffAllotDictz);
|
|
|
|
}
|
|
|
|
logger.info("synchronized zy_iv_dept_staff_allot_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZyCommonDict() {
|
|
|
|
logger.info("synchronized zy_common_dict start");
|
|
|
|
String[] dictNames = new String[]{
|
|
|
|
this.IV_PHYSIC_FORM_DICT, this.IV_PHYSIC_INJECT_PLACE_DICT, this.IV_PHYSIC_SKIN_TEST_DICT,
|
|
|
|
this.IV_RATE_TYPE_DICT, this.IV_RECIPE_FREQUENCY_DICT, this.IV_RECIPE_USAGE_DICT,
|
|
|
|
this.IV_SEX_DICT, this.IV_PHYSIC_TOXICOLOGY_TYPE_DICT, this.IV_MEASURE_UNIT_DICT,
|
|
|
|
this.IV_DEPT_TYPE_DICT};
|
|
|
|
List<ZyCommonDict> zyCommonDictz = new ArrayList<>();
|
|
|
|
Boolean isFlush = true;
|
|
|
|
for (String dictName : dictNames) {
|
|
|
|
String json = null;
|
|
|
|
try {
|
|
|
|
//调用智业的接口得到字典
|
|
|
|
json = prescriptionService.getDictForI(dictName);
|
|
|
|
JSONObject dataString = JSONObject.fromObject(json);
|
|
|
|
JSONArray dataJSONArray = JSONObject.fromObject(dataString).getJSONArray("returnData");
|
|
|
|
if (dataJSONArray.size() == 0) {
|
|
|
|
logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//下划线转驼峰
|
|
|
|
JSONArray newJA = new JSONArray();
|
|
|
|
JSONArray jsonArrayTemp = dataJSONArray.getJSONArray(0);
|
|
|
|
logger.info("zy dict data size " + jsonArrayTemp.size() + ",dictname:" + dictName);
|
|
|
|
for (int i = 0; i < jsonArrayTemp.size(); i++) {
|
|
|
|
JSONObject jo = jsonArrayTemp.getJSONObject(i);
|
|
|
|
JSONObject newJO = new JSONObject();
|
|
|
|
jo.keySet().stream().forEach(key -> {
|
|
|
|
Object value = jo.get(key);
|
|
|
|
String newKey = Tool.lineToHump(key.toString());
|
|
|
|
newJO.put(newKey, value);
|
|
|
|
});
|
|
|
|
newJA.add(newJO);
|
|
|
|
}
|
|
|
|
|
|
|
|
ZyCommonDict[] zyCommonDictArrays = (ZyCommonDict[]) JSONArray.toArray(newJA, ZyCommonDict.class);
|
|
|
|
zyCommonDictz.addAll(Arrays.asList(zyCommonDictArrays));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
isFlush = false; //设置状态不能更新
|
|
|
|
logger.error("dictName:" + dictName);
|
|
|
|
logger.error("returnJson:" + json);
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//判断是否可以更新
|
|
|
|
if (isFlush) {
|
|
|
|
// 判断返回的数据是否大于0
|
|
|
|
if (zyCommonDictz.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyCommonDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_common_dict ,size:" + zyCommonDictz.size());
|
|
|
|
zyCommonDictDao.save(zyCommonDictz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("synchronized zy_common_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
private void synchronizeZy_iv_dept_dict() {
|
|
|
|
logger.info("synchronized zy_iv_dept_dict start");
|
|
|
|
String dictName = this.IV_DEPT_DICT;
|
|
|
|
List<ZyIvDeptDict> zyIvDeptDicts = new ArrayList<>();
|
|
|
|
//得到list
|
|
|
|
zyIvDeptDicts = commonGetOneDict(ZyIvDeptDict.class, dictName);
|
|
|
|
if (zyIvDeptDicts != null && zyIvDeptDicts.size() > 0) {
|
|
|
|
//清空表
|
|
|
|
zyIvDeptDictDao.deleteAll();
|
|
|
|
//新增数据
|
|
|
|
logger.info("save table zy_iv_dept_dict ,size:" + zyIvDeptDicts.size());
|
|
|
|
zyIvDeptDictDao.save(zyIvDeptDicts);
|
|
|
|
}
|
|
|
|
logger.info("synchronized zy_iv_dept_dict end");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 得到单个字典
|
|
|
|
*
|
|
|
|
* @param clazz class
|
|
|
|
* @param dictName 字典名称
|
|
|
|
*/
|
|
|
|
private List commonGetOneDict(Class clazz, String dictName) {
|
|
|
|
String json = null;
|
|
|
|
try {
|
|
|
|
//调用智业的接口得到字典
|
|
|
|
json = prescriptionService.getDictForI(dictName);
|
|
|
|
JSONObject joTemp = JSONObject.fromObject(json);
|
|
|
|
|
|
|
|
JSONArray dataJSONArray = joTemp.getJSONArray("returnData");
|
|
|
|
if (dataJSONArray.size() == 0) {
|
|
|
|
logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
dataJSONArray = dataJSONArray.getJSONArray(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("zy dict data size " + dataJSONArray.size() + ",dictname:" + dictName);
|
|
|
|
|
|
|
|
//下划线转驼峰
|
|
|
|
JSONArray newJA = new JSONArray();
|
|
|
|
for (int i = 0; i < dataJSONArray.size(); i++) {
|
|
|
|
JSONObject jo = dataJSONArray.getJSONObject(i);
|
|
|
|
JSONObject newJO = new JSONObject();
|
|
|
|
jo.keySet().stream().forEach(key -> {
|
|
|
|
Object value = jo.get(key);
|
|
|
|
String newKey = Tool.lineToHump(key.toString());
|
|
|
|
newJO.put(newKey, value);
|
|
|
|
});
|
|
|
|
newJA.add(newJO);
|
|
|
|
}
|
|
|
|
return (List) JSONArray.toCollection(newJA, clazz);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("dictName:" + dictName);
|
|
|
|
logger.error("returnJson:" + json);
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 智业的字典
|
|
|
|
*/
|
|
|
|
public static final String IV_MEASURE_UNIT_DICT = "IV_MEASURE_UNIT_DICT";//("计量单位字典", "IV_MEASURE_UNIT_DICT"),
|
|
|
|
public static final String IV_PHYSIC_FORM_DICT = "IV_PHYSIC_FORM_DICT";//("药品剂型字典", "IV_PHYSIC_FORM_DICT"),
|
|
|
|
public static final String IV_PHYSIC_INJECT_PLACE_DICT = "IV_PHYSIC_INJECT_PLACE_DICT";//"计量单位字典", "IV_PHYSIC_INJECT_PLACE_DICT"),
|
|
|
|
public static final String IV_PHYSIC_SKIN_TEST_DICT = "IV_PHYSIC_SKIN_TEST_DICT";//("皮试类型字典", "IV_PHYSIC_SKIN_TEST_DICT"),
|
|
|
|
public static final String IV_RATE_TYPE_DICT = "IV_RATE_TYPE_DICT";//("费别字典", "IV_RATE_TYPE_DICT"),
|
|
|
|
public static final String IV_RECIPE_FREQUENCY_DICT = "IV_RECIPE_FREQUENCY_DICT";//("频次字典", "IV_RECIPE_FREQUENCY_DICT"),
|
|
|
|
public static final String IV_RECIPE_USAGE_DICT = "IV_RECIPE_USAGE_DICT";//("用药方法字典", "IV_RECIPE_USAGE_DICT"),
|
|
|
|
public static final String IV_SEX_DICT = "IV_SEX_DICT";//("性别字典", "IV_SEX_DICT"),
|
|
|
|
public static final String IV_PHYSIC_DICT = "IV_PHYSIC_DICT";//("药品字典", "IV_PHYSIC_DICT"),
|
|
|
|
public static final String IV_ORG_PHYSIC_ALLOT_DICT = "IV_ORG_PHYSIC_ALLOT_DICT";//("机构药品分发字典", "IV_ORG_PHYSIC_ALLOT_DICT "),
|
|
|
|
public static final String IV_SUBJECT_CLASS_DICT = "IV_SUBJECT_CLASS_DICT";//("科目类别字典", "IV_SUBJECT_CLASS_DICT"),
|
|
|
|
public static final String IV_PHYSIC_TOXICOLOGY_TYPE_DICT = "IV_PHYSIC_TOXICOLOGY_TYPE_DICT";//("药品毒理分类字典", "IV_PHYSIC_TOXICOLOGY_TYPE_DICT"),
|
|
|
|
public static final String IV_DEPT_DICT = "IV_DEPT_DICT";//("科室字典", "IV_DEPT_DICT"),
|
|
|
|
public static final String IV_DEPT_TYPE_DICT = "IV_DEPT_TYPE_DICT";//("科室类型字典", "IV_DEPT_TYPE_DICT"),
|
|
|
|
public static final String IV_DIAGNOSE_DICT = "IV_DIAGNOSE_DICT";//("诊断字典", "IV_DIAGNOSE_DICT"),
|
|
|
|
public static final String IV_DIAGNOSE_CLASS_DICT = "IV_DIAGNOSE_CLASS_DICT";//("诊断类别字典", "IV_DIAGNOSE_CLASS_DICT"),
|
|
|
|
public static final String IV_STAFF_DICT = "IV_STAFF_DICT";//("员工字典", "IV_STAFF_DICT"),
|
|
|
|
public static final String IV_STAFF_REG_TYPE_ALLOT_DICT = "IV_STAFF_REG_TYPE_ALLOT_DICT";//("员工挂号类型配置字典", "IV_STAFF_REG_TYPE_ALLOT_DICT"),
|
|
|
|
public static final String IV_DEPT_STAFF_ALLOT_DICT = "IV_DEPT_STAFF_ALLOT_DICT";//("科室员工配置字典", "IV_DEPT_STAFF_ALLOT_DICT");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 字典表的枚举类
|
|
|
|
*/
|
|
|
|
public enum TableName {
|
|
|
|
|
|
|
|
zy_common_dict("通用字典", "zy_common_dict"),
|
|
|
|
zy_iv_dept_dict("科室字典", "zy_iv_dept_dict"),
|
|
|
|
zy_iv_dept_staff_allot_dict("科室员工配置字典", "zy_iv_dept_staff_allot_dict"),
|
|
|
|
zy_iv_diagnose_class_dict("诊断类别字典", "zy_iv_diagnose_class_dict"),
|
|
|
|
zy_iv_diagnose_dict("诊断字典表", "zy_iv_diagnose_dict"),
|
|
|
|
zy_iv_org_physic_allot_dict("机构药品分发字典", "zy_iv_org_physic_allot_dict"),
|
|
|
|
zy_iv_physic_dict("药品字典", "zy_iv_physic_dict"),
|
|
|
|
zy_iv_staff_dict("员工字典", "zy_iv_staff_dict"),
|
|
|
|
zy_iv_staff_reg_type_allot_dict("员工挂号类型配置字典", "zy_iv_staff_reg_type_allot_dict"),
|
|
|
|
zy_iv_subject_class_dict("科目类别字典", "zy_iv_subject_class_dict");
|
|
|
|
|
|
|
|
TableName(String name, String dict) {
|
|
|
|
this.name = name;
|
|
|
|
this.dict = dict;
|
|
|
|
}
|
|
|
|
|
|
|
|
private String name;
|
|
|
|
private String dict;
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDict() {
|
|
|
|
return dict;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDict(String dict) {
|
|
|
|
this.dict = dict;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据字典获取表名
|
|
|
|
*
|
|
|
|
* @param dictName
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String getTableName(String dictName) {
|
|
|
|
switch (dictName) {
|
|
|
|
case IV_PHYSIC_FORM_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_PHYSIC_INJECT_PLACE_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_PHYSIC_SKIN_TEST_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_RATE_TYPE_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_RECIPE_FREQUENCY_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_RECIPE_USAGE_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_SEX_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_PHYSIC_TOXICOLOGY_TYPE_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_MEASURE_UNIT_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_DEPT_TYPE_DICT: {
|
|
|
|
return TableName.zy_common_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_PHYSIC_DICT: {
|
|
|
|
return TableName.zy_iv_physic_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_ORG_PHYSIC_ALLOT_DICT: {
|
|
|
|
return TableName.zy_iv_org_physic_allot_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_SUBJECT_CLASS_DICT: {
|
|
|
|
return TableName.zy_iv_subject_class_dict.getDict();
|
|
|
|
}
|
|
|
|
|
|
|
|
case IV_DIAGNOSE_DICT: {
|
|
|
|
return TableName.zy_iv_diagnose_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_DIAGNOSE_CLASS_DICT: {
|
|
|
|
return TableName.zy_iv_diagnose_class_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_STAFF_DICT: {
|
|
|
|
return TableName.zy_iv_staff_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_STAFF_REG_TYPE_ALLOT_DICT: {
|
|
|
|
return TableName.zy_iv_staff_reg_type_allot_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_DEPT_STAFF_ALLOT_DICT: {
|
|
|
|
return TableName.zy_iv_dept_staff_allot_dict.getDict();
|
|
|
|
}
|
|
|
|
case IV_DEPT_DICT: {
|
|
|
|
return TableName.zy_iv_dept_dict.getDict();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class Tool {
|
|
|
|
private static Pattern linePattern = Pattern.compile("_(\\w)");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 下划线转驼峰
|
|
|
|
*/
|
|
|
|
public static String lineToHump(String str) {
|
|
|
|
str = str.toLowerCase();
|
|
|
|
Matcher matcher = linePattern.matcher(str);
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
while (matcher.find()) {
|
|
|
|
matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
|
|
|
|
}
|
|
|
|
matcher.appendTail(sb);
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)})
|
|
|
|
*/
|
|
|
|
public static String humpToLine(String str) {
|
|
|
|
return str.replaceAll("[A-Z]", "_$0").toLowerCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Pattern humpPattern = Pattern.compile("[A-Z]");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 驼峰转下划线,效率比上面高
|
|
|
|
*/
|
|
|
|
public static String humpToLine2(String str) {
|
|
|
|
Matcher matcher = humpPattern.matcher(str);
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
while (matcher.find()) {
|
|
|
|
matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
|
|
|
|
}
|
|
|
|
matcher.appendTail(sb);
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|