|
@ -1,22 +1,22 @@
|
|
package com.yihu.wlyy.web.patient.sign;
|
|
package com.yihu.wlyy.web.patient.sign;
|
|
|
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.entity.patient.invitation.PatientInvitationLog;
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
import com.yihu.wlyy.service.app.family.FamilyService;
|
|
import com.yihu.wlyy.service.app.family.FamilyService;
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
import com.yihu.wlyy.service.app.sign.SignWebService;
|
|
import com.yihu.wlyy.service.app.sign.SignWebService;
|
|
import com.yihu.wlyy.service.common.account.*;
|
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.IdcardValidator;
|
|
import com.yihu.wlyy.util.IdcardValidator;
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import com.yihu.wlyy.entity.patient.invitation.PatientInvitationLog;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -24,7 +24,6 @@ import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.http.CacheControl;
|
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -204,7 +203,8 @@ public class FamilyContractController extends BaseController {
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String homepage(String doctor) {
|
|
public String homepage(String doctor) {
|
|
try {
|
|
try {
|
|
JSONObject json = familyContractService.findDoctorMainPage(getUID(), doctor);
|
|
|
|
|
|
JSONObject json = familyContractService.findDoctorMainPage(getRepUID(), doctor);
|
|
|
|
// JSONObject json = familyContractService.findDoctorMainPage(getUID(), doctor);
|
|
|
|
|
|
if (json == null) {
|
|
if (json == null) {
|
|
return error(-1, "医生主页查询失败!");
|
|
return error(-1, "医生主页查询失败!");
|
|
@ -227,7 +227,8 @@ public class FamilyContractController extends BaseController {
|
|
public String signStatus(String doctor) {
|
|
public String signStatus(String doctor) {
|
|
try {
|
|
try {
|
|
// -1未签约,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
|
|
// -1未签约,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约
|
|
int status = familyContractService.findSignStatus(getUID(), doctor);
|
|
|
|
|
|
int status = familyContractService.findSignStatus(getRepUID(), doctor);
|
|
|
|
// int status = familyContractService.findSignStatus(getUID(), doctor);
|
|
return write(200, "数据加载成功!", "data", status);
|
|
return write(200, "数据加载成功!", "data", status);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
@ -314,7 +315,8 @@ public class FamilyContractController extends BaseController {
|
|
if (StringUtils.isEmpty(getOpenid())) {
|
|
if (StringUtils.isEmpty(getOpenid())) {
|
|
return error(-1, "无效的Openid!");
|
|
return error(-1, "无效的Openid!");
|
|
}
|
|
}
|
|
String doctor = familyContractService.checkPatient(getUID());
|
|
|
|
|
|
String doctor = familyContractService.checkPatient(getRepUID());
|
|
|
|
// String doctor = familyContractService.checkPatient(getUID());
|
|
return write(200, "签约验证成功!", "data", doctor);
|
|
return write(200, "签约验证成功!", "data", doctor);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
@ -352,7 +354,8 @@ public class FamilyContractController extends BaseController {
|
|
return error(-1, "请输入正确的身份证号!");
|
|
return error(-1, "请输入正确的身份证号!");
|
|
}
|
|
}
|
|
|
|
|
|
Patient patient = patientService.findByCode(getUID());
|
|
|
|
|
|
Patient patient = patientService.findByCode(getRepUID());
|
|
|
|
// Patient patient = patientService.findByCode(getUID());
|
|
if (!StringUtils.equals(patient.getIdcard(), idcard)) {
|
|
if (!StringUtils.equals(patient.getIdcard(), idcard)) {
|
|
return error(-1, "身份证号错误,请输入注册的身份证号!");
|
|
return error(-1, "身份证号错误,请输入注册的身份证号!");
|
|
}
|
|
}
|
|
@ -548,7 +551,8 @@ public class FamilyContractController extends BaseController {
|
|
// return error(-1, "无效的用户请求!");
|
|
// return error(-1, "无效的用户请求!");
|
|
// }
|
|
// }
|
|
// -1申请失败, 200申请成功,其他为状态已变化无法取消申请
|
|
// -1申请失败, 200申请成功,其他为状态已变化无法取消申请
|
|
patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getUID();
|
|
|
|
|
|
patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getRepUID();
|
|
|
|
// patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getUID();
|
|
int res = familyContractService.unsign(patientCode, doctor);
|
|
int res = familyContractService.unsign(patientCode, doctor);
|
|
if (res == -1) {
|
|
if (res == -1) {
|
|
return error(-1, "取消签约失败!");
|
|
return error(-1, "取消签约失败!");
|
|
@ -575,7 +579,8 @@ public class FamilyContractController extends BaseController {
|
|
public String surrender(String doctor, String doctorName, String reason,
|
|
public String surrender(String doctor, String doctorName, String reason,
|
|
@RequestParam(required = false) String patientCode) {
|
|
@RequestParam(required = false) String patientCode) {
|
|
try {
|
|
try {
|
|
patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getUID();
|
|
|
|
|
|
patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getRepUID();
|
|
|
|
// patientCode = StringUtils.isNoneBlank(patientCode) ? patientCode : getUID();
|
|
Patient patient = patientService.findByCode(patientCode);
|
|
Patient patient = patientService.findByCode(patientCode);
|
|
int res = familyContractService.surrender(patient.getCode(), patient.getName(), patient.getPhoto(), doctor, doctorName, patient.getOpenid(), reason, patient.getSex());
|
|
int res = familyContractService.surrender(patient.getCode(), patient.getName(), patient.getPhoto(), doctor, doctorName, patient.getOpenid(), reason, patient.getSex());
|
|
if (res == 0) {
|
|
if (res == 0) {
|
|
@ -599,7 +604,8 @@ public class FamilyContractController extends BaseController {
|
|
public String messages(long id, int pagesize) {
|
|
public String messages(long id, int pagesize) {
|
|
try {
|
|
try {
|
|
JSONArray array = new JSONArray();
|
|
JSONArray array = new JSONArray();
|
|
Page<Message> list = familyContractService.findMessageByPatient(getUID(), id, pagesize);
|
|
|
|
|
|
// Page<Message> list = familyContractService.findMessageByPatient(getUID(), id, pagesize);
|
|
|
|
Page<Message> list = familyContractService.findMessageByPatient(getRepUID(), id, pagesize);
|
|
if (list != null) {
|
|
if (list != null) {
|
|
for (Message msg : list) {
|
|
for (Message msg : list) {
|
|
if (msg == null) {
|
|
if (msg == null) {
|
|
@ -651,7 +657,8 @@ public class FamilyContractController extends BaseController {
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
return error(-1, "医生不能为空");
|
|
return error(-1, "医生不能为空");
|
|
}
|
|
}
|
|
JSONObject result = familyContractService.isPatientAndDoctorExistSign(getUID(), doctor);
|
|
|
|
|
|
JSONObject result = familyContractService.isPatientAndDoctorExistSign(getRepUID(), doctor);
|
|
|
|
// JSONObject result = familyContractService.isPatientAndDoctorExistSign(getUID(), doctor);
|
|
return write(200, "查询成功", "data", result);
|
|
return write(200, "查询成功", "data", result);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
@ -672,7 +679,8 @@ public class FamilyContractController extends BaseController {
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
return error(-1, "医生不能为空");
|
|
return error(-1, "医生不能为空");
|
|
}
|
|
}
|
|
JSONObject result = familyContractService.isPatientAndDoctorCanSign(getUID(), doctor);
|
|
|
|
|
|
JSONObject result = familyContractService.isPatientAndDoctorCanSign(getRepUID(), doctor);
|
|
|
|
// JSONObject result = familyContractService.isPatientAndDoctorCanSign(getUID(), doctor);
|
|
return write(200, "查询成功", "data", result);
|
|
return write(200, "查询成功", "data", result);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|