|
@ -8,11 +8,14 @@ import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@ -42,9 +45,10 @@ public class FamilyMemberService extends BaseService {
|
|
|
* @param patient 患者
|
|
|
* @param member 成员
|
|
|
* @param captcha 验证码
|
|
|
* @param member 成员
|
|
|
* @return
|
|
|
*/
|
|
|
public int addMember(String patient, String member, String captcha, int relation) {
|
|
|
public int addMember(String patient, String member, String captcha, String password, int relation) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
Patient m = patientDao.findByCode(member);
|
|
|
|
|
@ -56,9 +60,15 @@ public class FamilyMemberService extends BaseService {
|
|
|
return -2;
|
|
|
}
|
|
|
// 验证码验证
|
|
|
if (smsService.check(m.getMobile(), 9, captcha) != 1) {
|
|
|
if (StringUtils.isNotEmpty(captcha) && smsService.check(m.getMobile(), 9, captcha) != 1) {
|
|
|
return -3;
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(password)) {
|
|
|
String loginPassword = MD5.GetMD5Code(password + m.getSalt());
|
|
|
if (!loginPassword.equals(m.getPassword())) {
|
|
|
return -3;
|
|
|
}
|
|
|
}
|
|
|
// 添加自己与对方的关系
|
|
|
PatientFamilyMember fm = memberDao.findByPatientAndFamilyMember(patient, member);
|
|
|
// 家庭关系已存在时,不重复添加
|
|
@ -100,6 +110,7 @@ public class FamilyMemberService extends BaseService {
|
|
|
* @param relation 关系
|
|
|
* @return
|
|
|
*/
|
|
|
|
|
|
public int modifyFamilyRelation(String patient, String member, int relation) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
Patient m = patientDao.findByCode(member);
|
|
@ -176,10 +187,12 @@ public class FamilyMemberService extends BaseService {
|
|
|
Patient p = patientDao.findByIdcard(idcard);
|
|
|
|
|
|
if (p == null) {
|
|
|
result.put("isRegister",0);
|
|
|
result.put("isRegister", 0);
|
|
|
} else {
|
|
|
result.put("isRegister",1);
|
|
|
result.put("patient",p);
|
|
|
result.put("isRegister", 1);
|
|
|
result.put("mobile", p.getMobile());
|
|
|
result.put("name", p.getName());
|
|
|
result.put("code", p.getCode());
|
|
|
}
|
|
|
|
|
|
return result;
|