|
@ -14,6 +14,7 @@ import com.yihu.ehr.service.thread.StandardUpdateThread;
|
|
|
import com.yihu.ehr.service.thread.ThreadManage;
|
|
|
import com.yihu.ehr.util.httpclient.EsbHttp;
|
|
|
import com.yihu.ehr.util.httpclient.Response;
|
|
|
import com.yihu.ehr.ws.SQLWebService;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@ -101,7 +102,7 @@ public class SystemManager implements ISystemManager {
|
|
|
private void saveSystemParams(String key, String value) throws Exception {
|
|
|
Object obj = db.scalar("select 1 from system_param where param_key='" + key + "'");
|
|
|
|
|
|
if (obj==null) {
|
|
|
if (obj == null) {
|
|
|
addSystemParams(key, value);
|
|
|
} else {
|
|
|
String sql = "update system_param set param_value = '" + value + "' where param_key='" + key + "'";
|
|
@ -139,7 +140,8 @@ public class SystemManager implements ISystemManager {
|
|
|
if (id != null && id.length() > 0) {
|
|
|
sql = "update system_datasource set name = '" + name + "',config='" + config + "' where id='" + id + "'";
|
|
|
}
|
|
|
|
|
|
//更新数据源
|
|
|
SQLWebService.db = new DBHelper("new", config);
|
|
|
if (db.execute(sql)) {
|
|
|
return Result.success("保存成功!");
|
|
|
} else {
|
|
@ -157,22 +159,18 @@ public class SystemManager implements ISystemManager {
|
|
|
DBDriver.registerDriver(uri);
|
|
|
Connection conn = DriverManager.getConnection(uri);
|
|
|
|
|
|
if(conn!=null) {
|
|
|
String message="连接测试成功!";
|
|
|
if(conn.isClosed())
|
|
|
{
|
|
|
if (conn != null) {
|
|
|
String message = "连接测试成功!";
|
|
|
if (conn.isClosed()) {
|
|
|
message = "连接测试失败!";
|
|
|
}
|
|
|
|
|
|
conn.close();
|
|
|
return Result.success(message);
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
return Result.error("连接测试失败!");
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
} catch (Exception ex) {
|
|
|
return Result.error(ex.getMessage());
|
|
|
}
|
|
|
}
|
|
@ -211,21 +209,20 @@ public class SystemManager implements ISystemManager {
|
|
|
userInfo.setRealName(userObject.getString("realName"));
|
|
|
String orgCode = "";
|
|
|
String orgName = "";
|
|
|
if(userObject.has("organization") && !userObject.get("organization").equals(null)) {
|
|
|
if (userObject.has("organization") && !userObject.get("organization").equals(null)) {
|
|
|
JSONObject orgInfo = userObject.getJSONObject("organization");
|
|
|
orgCode = orgInfo.getString("orgCode");
|
|
|
orgName = orgInfo.getString("fullName");
|
|
|
userInfo.setOrgCode(orgCode);
|
|
|
userInfo.setOrgName(orgName);
|
|
|
}
|
|
|
else{
|
|
|
} else {
|
|
|
return Result.error("该用户未配置机构!");
|
|
|
}
|
|
|
session.setAttribute("userInfo", userInfo);
|
|
|
|
|
|
//判断组织编码是否为空
|
|
|
String orgCodeOld = this.getSystemParam("ORG_CODE");
|
|
|
if (orgCodeOld==null || orgCodeOld.length() == 0) {
|
|
|
if (orgCodeOld == null || orgCodeOld.length() == 0) {
|
|
|
this.saveSystemParams("FINGER_PRINT", UUID.randomUUID().toString());
|
|
|
this.saveSystemParams("ORG_CODE", orgCode);
|
|
|
this.saveSystemParams("ORG_NAME", orgName);
|
|
@ -238,43 +235,34 @@ public class SystemManager implements ISystemManager {
|
|
|
standardUpdateThread.start();
|
|
|
}
|
|
|
return Result.success("登录成功!");
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
if (orgCodeOld.equals(orgCode)) {
|
|
|
return Result.success("登录成功!");
|
|
|
} else {
|
|
|
return Result.error("机构编码不一致!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
} else {
|
|
|
return Result.error("获取用户信息失败!");
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if(obj.has("message"))
|
|
|
{
|
|
|
return Result.error("登录失败!"+obj.getString("message"));
|
|
|
}
|
|
|
else{
|
|
|
} else {
|
|
|
if (obj.has("message")) {
|
|
|
return Result.error("登录失败!" + obj.getString("message"));
|
|
|
} else {
|
|
|
return Result.error("登录失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
String msg = "登录失败。";
|
|
|
if (response != null)
|
|
|
{
|
|
|
msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
|
|
|
if (response != null) {
|
|
|
msg += "(错误代码:" + response.getStatusCode() + ",错误信息:" + response.getBody() + ")";
|
|
|
}
|
|
|
return Result.error(msg);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception ex) {
|
|
|
} catch (Exception ex) {
|
|
|
return Result.error(ex.getMessage());
|
|
|
}
|
|
|
|