|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.wlyy.service.app.account;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.yihu.wlyy.entity.address.City;
|
|
|
import com.yihu.wlyy.entity.address.Province;
|
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
@ -28,17 +29,18 @@ import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.talk.TalkGroupService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import com.yihu.wlyy.util.*;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
@ -54,6 +56,7 @@ import org.springside.modules.persistence.SearchFilter.Operator;
|
|
|
import org.springside.modules.security.utils.Digests;
|
|
|
import org.springside.modules.utils.Encodes;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -113,6 +116,16 @@ public class DoctorInfoService extends BaseService {
|
|
|
@Autowired
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
|
|
|
//基卫服务地址
|
|
|
@Value("${sign.check_upload}")
|
|
|
private String jwUrl;
|
|
|
|
|
|
@Autowired
|
|
|
private HttpClientUtil HttpClientUtil;
|
|
|
|
|
|
@Autowired
|
|
|
private LogService logService;
|
|
|
|
|
|
/**
|
|
|
* 获取医生的签约病人
|
|
|
*
|
|
@ -1268,17 +1281,164 @@ public class DoctorInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 审方密码设置
|
|
|
// * @param passwoed
|
|
|
// * @return
|
|
|
// */
|
|
|
// @Transactional
|
|
|
// public void setCheckPassword(Doctor doctor,String passwoed){
|
|
|
//
|
|
|
// byte[] salt = Digests.generateSalt(8);
|
|
|
// doctor.setCheckSalt(Encodes.encodeHex(salt));
|
|
|
// byte[] hashPassword = Digests.sha1(passwoed.getBytes(), salt, 1024);
|
|
|
// doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 审方密码设置
|
|
|
* @param passwoed
|
|
|
* @return
|
|
|
* 获取CA证书过期时间
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void setCheckPassword(Doctor doctor,String passwoed){
|
|
|
public JSONObject getCAPastDue(String strUserIdcardNum) throws Exception{
|
|
|
|
|
|
Boolean isSuccess = true;
|
|
|
String url = jwUrl+"/third/prescription/GetRealNameSoftCertExpiredDatetime";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
|
|
|
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
int status = responseObject.getInt("status");
|
|
|
String msg = responseObject.getString("msg");
|
|
|
if (status == 200) {
|
|
|
String data = responseObject.getString("data");
|
|
|
if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
|
|
|
throw new Exception(data);
|
|
|
} else {
|
|
|
// JSONObject jsonData = new JSONObject(data);
|
|
|
// JSONArray jsonArray = jsonData.getJSONArray("EventList");
|
|
|
// re = jsonArray.toString();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
//1、有证书,并有效,2、有证书,已过期,3、无证书
|
|
|
if(StringUtils.isNotEmpty(data)){
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
long times = simpleDateFormat.parse(data).getTime();
|
|
|
if(System.currentTimeMillis()<=times){
|
|
|
jsonObject.put("type",1);
|
|
|
}else{
|
|
|
jsonObject.put("type",2);
|
|
|
}
|
|
|
}else{
|
|
|
jsonObject.put("type",3);
|
|
|
}
|
|
|
jsonObject.put("time",data);
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
} else {
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
|
}
|
|
|
}else {
|
|
|
throw new Exception("null response.");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
byte[] salt = Digests.generateSalt(8);
|
|
|
doctor.setCheckSalt(Encodes.encodeHex(salt));
|
|
|
byte[] hashPassword = Digests.sha1(passwoed.getBytes(), salt, 1024);
|
|
|
doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
|
|
|
/**
|
|
|
* 修改实名软证书调用保护口令
|
|
|
*/
|
|
|
public boolean updateAuthenticationPassword(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd) throws Exception{
|
|
|
|
|
|
String url = jwUrl+"/third/prescription/ModifyRealNameSoftCertCalledPasswd";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
|
|
|
params.add(new BasicNameValuePair("strOldCalledPasswd",strOldCalledPasswd));
|
|
|
params.add(new BasicNameValuePair("strNewCalledPasswd",strNewCalledPasswd));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
int status = responseObject.getInt("status");
|
|
|
String msg = responseObject.getString("msg");
|
|
|
if (status == 200) {
|
|
|
String data = responseObject.getString("data");
|
|
|
if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
|
|
|
throw new Exception(data);
|
|
|
}else{
|
|
|
if("0".equals(data)){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception("null response.");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public boolean requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData, String srcBusinessStreamNO) throws Exception{
|
|
|
|
|
|
String url = jwUrl+"/third/prescription/RequestRealNameSoftCertAndSign";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
|
|
|
params.add(new BasicNameValuePair("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd));
|
|
|
params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
|
|
|
params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
int status = responseObject.getInt("status");
|
|
|
String msg = responseObject.getString("msg");
|
|
|
if (status == 200) {
|
|
|
String data = responseObject.getString("data");
|
|
|
if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
|
|
|
throw new Exception(data);
|
|
|
}else{
|
|
|
String[] str = data.split("||");
|
|
|
// String strSignData = str[0];
|
|
|
// String strCertData = str[1];
|
|
|
// JSONObject jsonObject = new JSONObject();
|
|
|
// jsonObject.put("strSignData",str[0]);
|
|
|
// jsonObject.put("strCertData",str[1]);
|
|
|
return verifySignOnMultiServer(str[0],str[1],strOriginalData);
|
|
|
// return jsonObject;
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception("null response.");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//验证签名( ( 带多服务器负载均衡) )
|
|
|
public boolean verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData) throws Exception{
|
|
|
|
|
|
String url = jwUrl+"/third/prescription/VerifySignOnMultiServer";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("strSignData",strSignData));
|
|
|
params.add(new BasicNameValuePair("strCertData",strCertData));
|
|
|
params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
int status = responseObject.getInt("status");
|
|
|
String msg = responseObject.getString("msg");
|
|
|
if (status == 200) {
|
|
|
String data = responseObject.getString("data");
|
|
|
if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
|
|
|
throw new Exception(data);
|
|
|
}else{
|
|
|
if("0".equals(data)){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception("null response.");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
}
|