|
@ -27,6 +27,7 @@ import com.yihu.wlyy.repository.statistics.WlyySignFamilyCodeDao;
|
|
|
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
import com.yihu.wlyy.service.app.message.MessageService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
|
import com.yihu.wlyy.task.SignUploadTask;
|
|
|
import com.yihu.wlyy.util.*;
|
|
@ -113,6 +114,8 @@ public class FamilyContractService extends BaseService {
|
|
|
JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
WeiXinAccessTokenUtils accessTokenUtils;
|
|
|
@Autowired
|
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
|
|
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
|
return signFamilyDao.findByCodeAndType(code, 2);
|
|
@ -380,7 +383,7 @@ public class FamilyContractService extends BaseService {
|
|
|
String idcard,
|
|
|
String ssc,
|
|
|
String mobile,
|
|
|
String emerMobile) {
|
|
|
String emerMobile)throws Exception {
|
|
|
// 查询三师签约
|
|
|
JSONObject json = new JSONObject();
|
|
|
SignFamily sc = signFamilyDao.findByIdcard(idcard);
|
|
@ -483,7 +486,12 @@ public class FamilyContractService extends BaseService {
|
|
|
message.setData(temp.getCode());
|
|
|
messageDao.save(message);
|
|
|
// 发送消息给医生
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
|
|
|
// 发送消息给医生
|
|
|
JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
|
|
|
}
|
|
|
}
|
|
|
json.put("id", p.getId());
|
|
|
json.put("uid", p.getCode());
|
|
@ -499,7 +507,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param doctorType 医生类型
|
|
|
* @return
|
|
|
*/
|
|
|
public int sign(String doctor, String patient, int doctorType) {
|
|
|
public int sign(String doctor, String patient, int doctorType) throws Exception{
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
if (p == null) {
|
|
|
return -1;
|
|
@ -570,8 +578,12 @@ public class FamilyContractService extends BaseService {
|
|
|
message.setData(temp.getCode());
|
|
|
messageDao.save(message);
|
|
|
// 发送消息给医生
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
|
|
|
}
|
|
|
JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@ -623,7 +635,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param reason 解约理由
|
|
|
* @return
|
|
|
*/
|
|
|
public int surrender(String patient, String patientName, String userPhoto, String doctor, String doctorName, String openid, String reason, int sex) {
|
|
|
public int surrender(String patient, String patientName, String userPhoto, String doctor, String doctorName, String openid, String reason, int sex) throws Exception{
|
|
|
// 更新为待解约
|
|
|
int res = signFamilyDao.surrender(patient, doctor);
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(patient);
|
|
@ -659,7 +671,11 @@ public class FamilyContractService extends BaseService {
|
|
|
message.setData(signFamily.getCode());
|
|
|
messageDao.save(message);
|
|
|
// 发送消息给医生
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.D_SW_02.name(), MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.家庭签约.name(), patientName + " 申请解除与您的家庭签约!", patient);
|
|
|
JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
//如果在工作时间内就推送
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.D_SW_02.name(), MessageType.MESSAGE_TYPE_DOCTOR_SIGN_WEB_RELIEVE.家庭签约.name(), patientName + " 申请解除与您的家庭签约!", patient);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@ -2182,7 +2198,7 @@ public class FamilyContractService extends BaseService {
|
|
|
}
|
|
|
|
|
|
|
|
|
public Integer findPatientCountByAdminTeam(String doctorCode,String teamCode) {
|
|
|
public Integer findPatientCountByAdminTeam(String doctorCode, String teamCode) {
|
|
|
String sql = "select count(sf.id) " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family sf " +
|
|
@ -2191,8 +2207,8 @@ public class FamilyContractService extends BaseService {
|
|
|
" AND sf.STATUS >= 0 " +
|
|
|
" AND ( sf.doctor = ? or sf.doctor_health=? )" +
|
|
|
" AND sf.admin_team_code =?";
|
|
|
Object [] parms=new Object[]{doctorCode,doctorCode,teamCode};
|
|
|
Integer count = jdbcTemplate.queryForObject(sql,parms,Integer.class);
|
|
|
Object[] parms = new Object[]{doctorCode, doctorCode, teamCode};
|
|
|
Integer count = jdbcTemplate.queryForObject(sql, parms, Integer.class);
|
|
|
return count;
|
|
|
}
|
|
|
}
|