|
@ -15,6 +15,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.WlyyPatientSick;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
|
import com.yihu.wlyy.repository.address.CityDao;
|
|
|
import com.yihu.wlyy.repository.address.ProvinceDao;
|
|
|
import com.yihu.wlyy.repository.address.TownDao;
|
|
@ -25,6 +26,7 @@ import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientSickDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.talk.TalkGroupService;
|
|
@ -116,9 +118,12 @@ public class DoctorInfoService extends BaseService {
|
|
|
@Autowired
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
//基卫服务地址
|
|
|
@Value("${sign.check_upload}")
|
|
|
private String jwUrl;
|
|
|
private String jwUrl;//="http://192.168.131.105:8011";
|
|
|
|
|
|
@Autowired
|
|
|
private HttpClientUtil HttpClientUtil;
|
|
@ -1295,19 +1300,49 @@ public class DoctorInfoService extends BaseService {
|
|
|
// doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 判断实名软证书是否已申请
|
|
|
*/
|
|
|
public boolean judgeRealNameSoftCertIsApplied(String doctorCode) throws Exception{
|
|
|
Doctor doctor = findDoctorByCode(doctorCode);
|
|
|
String strUserIdcardNum = doctor.getIdcard();
|
|
|
String data ="";
|
|
|
String url = jwUrl+"/third/prescription/IsApplied";
|
|
|
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");
|
|
|
if (status == 200) {
|
|
|
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("null response.");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取线上CA是否认证过
|
|
|
*/
|
|
|
public JSONObject isAuthentication(String doctorCode) throws Exception{
|
|
|
public JSONObject isAuthentication(String doctorCode) throws Exception{
|
|
|
Doctor doctor = findDoctorByCode(doctorCode);
|
|
|
String strUserIdcardNum = doctor.getIdcard();
|
|
|
// String strUserIdcardNum = doctor.getIdcard();
|
|
|
Boolean isSuccess = true;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
if(doctor.getIscertified()==1){
|
|
|
if(doctor.getCertifiedOvertime().getTime()>System.currentTimeMillis()){
|
|
|
//1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
|
|
|
jsonObject.put("type",4);
|
|
|
String data = simpleDateFormat.format(doctor.getCertifiedOvertime());
|
|
|
jsonObject.put("time",data);
|
|
@ -1315,17 +1350,20 @@ public class DoctorInfoService extends BaseService {
|
|
|
jsonObject = getCAPastDue(doctorCode,jsonObject);
|
|
|
}
|
|
|
}else{
|
|
|
|
|
|
jsonObject = getCAPastDue(doctorCode,jsonObject);
|
|
|
|
|
|
boolean j = judgeRealNameSoftCertIsApplied(doctorCode);
|
|
|
if(j){
|
|
|
jsonObject = getCAPastDue(doctorCode,jsonObject);
|
|
|
}else{
|
|
|
jsonObject.put("type",3);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取CA证书过期时间
|
|
|
*/
|
|
|
@Transactional
|
|
|
public JSONObject getCAPastDue(String doctorCode,JSONObject jsonObject) throws Exception{
|
|
|
Doctor doctor = findDoctorByCode(doctorCode);
|
|
|
String strUserIdcardNum = doctor.getIdcard();
|
|
@ -1340,7 +1378,6 @@ public class DoctorInfoService extends BaseService {
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
int status = responseObject.getInt("status");
|
|
|
String msg = responseObject.getString("msg");
|
|
|
if (status == 200) {
|
|
|
data = responseObject.getString("data");
|
|
|
if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
|
|
@ -1358,12 +1395,13 @@ public class DoctorInfoService extends BaseService {
|
|
|
jsonObject.put("type",2);
|
|
|
}
|
|
|
}else{
|
|
|
jsonObject.put("type",3);
|
|
|
// jsonObject.put("type",3);
|
|
|
throw new Exception("null data.");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
|
jsonObject.put("type",3);
|
|
|
}
|
|
|
}else {
|
|
|
throw new Exception("null response.");
|
|
@ -1413,18 +1451,19 @@ public class DoctorInfoService extends BaseService {
|
|
|
* @param strUserIdcardNum
|
|
|
* @param strRealNameSoftCertCalledPasswd
|
|
|
* @param strOriginalData
|
|
|
* @param srcBusinessStreamNO
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public boolean requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData, String srcBusinessStreamNO) throws Exception{
|
|
|
@Transactional
|
|
|
public JSONObject requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String prescriptionCode) 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));
|
|
|
|
|
|
params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
|
|
|
// params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
@ -1438,11 +1477,17 @@ public class DoctorInfoService extends BaseService {
|
|
|
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;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("strSignData",str[0]);
|
|
|
jsonObject.put("strCertData",str[1]);
|
|
|
jsonObject.put("srcBusinessStreamNO",str[2]);
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
prescription.setCaMessage(str[0]);
|
|
|
prescription.setCaCertData(str[1]);
|
|
|
prescriptionDao.save(prescription);
|
|
|
// String srcBusinessStreamNO = str[2];//CA 数字签名唯一流水号
|
|
|
// return verifySignOnMultiServer(str[0],str[1],strOriginalData);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception(responseObject.getString("msg"));
|
|
@ -1459,7 +1504,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("strSignData",strSignData));
|
|
|
params.add(new BasicNameValuePair("strCertData",strCertData));
|
|
|
params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
|
|
|
params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
@ -1485,8 +1530,6 @@ public class DoctorInfoService extends BaseService {
|
|
|
|
|
|
//校验医师输入的CA证书是否正确
|
|
|
public boolean checkCertificate(String doctorCode,String certificateNum){
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
String response = HttpClientUtil.post("http://120.77.209.211:5000/yueren/phonekey", params, "UTF-8");
|
|
|
int count = doctorDao.checkCertificate(doctorCode,certificateNum);
|
|
|
if(count>0){
|
|
|
return true;
|