|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.wlyy.service.app.sign;
|
|
|
|
|
|
import com.yihu.wlyy.entity.consult.Consult;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.OperatorLog;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
@ -13,6 +14,7 @@ import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.patient.*;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
import com.yihu.wlyy.repository.doctor.*;
|
|
@ -117,7 +119,8 @@ public class FamilyContractService extends BaseService {
|
|
|
private OperatorLogDao operatorLogDao;
|
|
|
@Autowired
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultDao consultDao;
|
|
|
@Autowired
|
|
|
private SignFamilyRenewDao signFamilyRenewDao;
|
|
|
|
|
@ -648,7 +651,6 @@ public class FamilyContractService extends BaseService {
|
|
|
} else if (doc.getLevel() == 3) {
|
|
|
sf = signFamilyDao.findByDoctorHealthPatient(doctor, patient);
|
|
|
}
|
|
|
Message message = messageDao.findByPatient(patient, doctor);
|
|
|
if (sf.getStatus() != 0 && sf.getStatus() != 2) {
|
|
|
return -2;
|
|
|
}
|
|
@ -657,10 +659,16 @@ public class FamilyContractService extends BaseService {
|
|
|
} else {
|
|
|
return -2;
|
|
|
}
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
|
message.setOver("0");
|
|
|
//结束与医生所有消息
|
|
|
List<Message> messages = messageDao.findByPatient(patient, doctor);
|
|
|
if(messages!=null&&messages.size()>0){
|
|
|
for(Message message:messages){
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
|
message.setOver("0");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return 200;
|
|
|
}
|
|
@ -688,12 +696,20 @@ public class FamilyContractService extends BaseService {
|
|
|
sf.setStatus(-1);
|
|
|
}
|
|
|
|
|
|
Message message = messageDao.findByPatientRenew(patient, doctor);
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
|
message.setOver("0");
|
|
|
//结束与医生所有消息
|
|
|
List<Message> messages = messageDao.findByPatientRenew(patient, doctor);
|
|
|
|
|
|
if(messages!=null&messages.size()>0){
|
|
|
for(Message message:messages){
|
|
|
//修改信息为无效
|
|
|
if (message != null) {
|
|
|
message.setRead(0);
|
|
|
message.setOver("0");
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return 200;
|
|
|
}
|
|
|
|
|
@ -2602,7 +2618,8 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
|
|
|
SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
// SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
|
|
|
if (ssSign != null) {
|
|
|
DoctorTeamMember member = doctorTeamDoctor.findSanshiByTeamAndType(ssSign.getTeamCode(), 1);
|
|
|
if (member != null) {
|
|
@ -2669,7 +2686,8 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject result = new JSONObject();
|
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(infos[0], 1);
|
|
|
SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
// SignFamily jtSign = signFamilyDao.findByTeamCode(infos[1]);
|
|
|
SignFamily jtSign = getSignFamilyBySessionId(sessionId,infos[0]);
|
|
|
JSONObject ssArray = new JSONObject();
|
|
|
JSONObject jtArray = new JSONObject();
|
|
|
if (ssSign != null) {
|
|
@ -2697,6 +2715,27 @@ public class FamilyContractService extends BaseService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据会话id查询 家庭签约信息
|
|
|
* @param sessionId
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public SignFamily getSignFamilyBySessionId(String sessionId,String patient){
|
|
|
SignFamily signFamily = null;
|
|
|
String sql = "select id from " + SystemConf.getInstance().getImDataBaseName() + ".topics where session_id = '"+sessionId+"' order by create_time desc limit 0, 1";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
String consultCode = list.get(0).get("id").toString();
|
|
|
signFamily = signFamilyDao.findByPatient(patient);
|
|
|
Consult consult = consultDao.findByCode(consultCode);
|
|
|
if(signFamily==null||signFamily.getApplyDate().getTime()-consult.getCzrq().getTime()>0){
|
|
|
signFamily = signFamilyDao.findOutTimeSigningByPatient(patient);
|
|
|
}
|
|
|
}
|
|
|
return signFamily;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询患者对应医生
|