Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

chenyongxing 6 years ago
parent
commit
38ba4fdb2b

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/message/dao/MessageDao.java

@ -19,4 +19,6 @@ public interface MessageDao extends PagingAndSortingRepository<BaseMessageDO, St
    @Query("select count(m.id) from BaseMessageDO m where m.platform=?1 and m.receiver=?2 and m.saasId=?3 and m.del=1 and m.msgTypeCode like ?4 and m.readState=1")
    Integer countMessage(Integer platform, String code, String saasId,String msgTypeCode);
    BaseMessageDO findById(Integer id);
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/message/service/MessageService.java

@ -166,4 +166,8 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
        }
    }
    public BaseMessageDO findById(Integer id){
        return messageDao.findById(id);
    }
}

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/myFamily/PatientApplyLog.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.myFamily;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -23,7 +24,9 @@ public class PatientApplyLog extends IntegerIdentityEntity {
    private Date createTime;//创建时间
    private String createUser;//申请人
    private String createUserName;//申请人姓名
    private Integer remindType;//提醒方式(1、打电话,2、发短信,3、微信)
    @Column(name = "patient_family_member_name")
    public String getPatientFamilyMemberName() {
        return patientFamilyMemberName;
    }
@ -32,6 +35,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.patientFamilyMemberName = patientFamilyMemberName;
    }
    @Column(name = "patient_family_member_code")
    public String getPatienyFamilyMemberCode() {
        return patienyFamilyMemberCode;
    }
@ -40,6 +44,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.patienyFamilyMemberCode = patienyFamilyMemberCode;
    }
    @Column(name = "qr_code")
    public String getQrCode() {
        return qrCode;
    }
@ -48,6 +53,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.qrCode = qrCode;
    }
    @Column(name = "failure_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getFailureTime() {
        return failureTime;
@ -57,6 +63,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.failureTime = failureTime;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
@ -65,6 +72,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.status = status;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
@ -73,6 +81,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.del = del;
    }
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
@ -82,6 +91,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.createTime = createTime;
    }
    @Column(name = "create_user")
    public String getCreateUser() {
        return createUser;
    }
@ -90,6 +100,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
@ -97,4 +108,13 @@ public class PatientApplyLog extends IntegerIdentityEntity {
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name = "remind_type")
    public Integer getRemindType() {
        return remindType;
    }
    public void setRemindType(Integer remindType) {
        this.remindType = remindType;
    }
}

+ 7 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/myFamily/PatientApplyLogDao.java

@ -2,10 +2,17 @@ package com.yihu.jw.patient.dao.myFamily;
import com.yihu.jw.entity.myFamily.PatientApplyLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author liuwenbin on 2018/11/30.
 */
public interface PatientApplyLogDao extends PagingAndSortingRepository<PatientApplyLog, String>, JpaSpecificationExecutor<PatientApplyLog> {
    @Modifying
    @Query("update PatientApplyLog t set t.remindType = ?1 where t.id=?2 ")
    int updateRemindTypeById(Integer remindType, Integer patientApplyLogId);
}

+ 48 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/MyFamilyService.java

@ -1,5 +1,6 @@
package com.yihu.jw.patient.service.myFamily;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
@ -12,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@ -84,7 +86,18 @@ public class MyFamilyService {
        return resultList;
    }
    public void bindingMyFamily(HttpServletRequest request,String wechatId, String saasId, String patient, String familyMobile, Integer platform) throws Exception{
    /**
     * 一键绑定
     * @param request
     * @param wechatId
     * @param saasId
     * @param patient
     * @param familyMobile
     * @param platform
     * @throws Exception
     */
    @Transactional(rollbackFor = Exception.class)
    public PatientApplyLog bindingMyFamily(HttpServletRequest request,String wechatId, String saasId, String patient, String familyMobile, Integer platform) throws Exception{
        BasePatientDO patientDO = patientService.findByIdAndDel(patient);
        //1、检验手机号码是否有存在账号,
@ -94,7 +107,7 @@ public class MyFamilyService {
        BasePatientDO familyPatient = null;
        //3、生成申请绑定的记录,二维码
        createFamilyQrCode(request,familyPatient,wechatId,patient);
        PatientApplyLog patientApplyLog = createFamilyQrCode(request,familyPatient,wechatId,patient);
        //4、发送绑定家人的系统消息
        BaseMessageDO messageDO = new BaseMessageDO();
        messageDO.setSaasId(saasId);
@ -115,6 +128,7 @@ public class MyFamilyService {
        messageDO.setDel("1");
        messageDO.setCreateTime(new Date());
        messageService.save(messageDO);
        return patientApplyLog;
    }
    /**
@ -126,7 +140,8 @@ public class MyFamilyService {
     * @return
     * @throws Exception
     */
    public String createFamilyQrCode(HttpServletRequest request,BasePatientDO familyPatient,String wechatId, String patient) throws Exception{
    @Transactional(rollbackFor = Exception.class)
    public PatientApplyLog createFamilyQrCode(HttpServletRequest request,BasePatientDO familyPatient,String wechatId, String patient) throws Exception{
        BasePatientDO patientDO = patientService.findByIdAndDel(patient);
        PatientApplyLog patientApplyLog = new PatientApplyLog();
        patientApplyLog.setPatientFamilyMemberName(familyPatient.getName());
@ -145,12 +160,41 @@ public class MyFamilyService {
        patientApplyLog.setCreateUser(familyPatient.getId());
        patientApplyLog.setCreateUserName(patientDO.getName());
        patientApplyLogService.save(patientApplyLog);
        return qrCode;
        return patientApplyLog;
    }
    /**
     * 更新提醒方式
     * @param patientApplyLogId
     * @param remindType
     * @throws Exception
     */
    public void remindMyFamily(Integer patientApplyLogId,Integer remindType) throws Exception{
        int i = patientApplyLogService.updateRemindTypeById(remindType,patientApplyLogId);
        if(i<0){
            throw new Exception("update data failur !");
        }
    }
    public void confirmApply(Integer messageId,Integer patientApplyLogId){
        BaseMessageDO messageDO = null;
        if(messageId!=null){
            messageDO = messageService.findById(messageId);
        }
        if(messageDO!=null&&patientApplyLogId==null){
            String json = messageDO.getRelationData();
            JSONObject jsonObject = JSONObject.parseObject(json);
            patientApplyLogId = (Integer)jsonObject.get("patientApplyLogId");
            messageDO.setReadState(1);
            messageDO.setReadTime(new Date());
            messageService.save(messageDO);
        }
    }
    /**
     * 家庭关系转换

+ 13 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/PatientApplyLogService.java

@ -3,6 +3,7 @@ package com.yihu.jw.patient.service.myFamily;
import com.yihu.jw.entity.myFamily.PatientApplyLog;
import com.yihu.jw.patient.dao.myFamily.PatientApplyLogDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -11,4 +12,16 @@ import org.springframework.stereotype.Service;
@Service
public class PatientApplyLogService extends BaseJpaService<PatientApplyLog, PatientApplyLogDao> {
    @Autowired
    private PatientApplyLogDao patientApplyLogDao;
    /**
     * 更新提醒方式
     * @param remindType 提醒方式(1、打电话,2、发短信,3、微信)
     * @param patientApplyLogId
     * @return
     */
    public int updateRemindTypeById(Integer remindType, Integer patientApplyLogId){
        return  patientApplyLogDao.updateRemindTypeById(remindType,patientApplyLogId);
    }
}

+ 1 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/PatientFamilyMemberService.java

@ -2,8 +2,8 @@ package com.yihu.jw.patient.service.myFamily;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.myFamily.PatientFamilyMemberDao;
import com.yihu.jw.patient.dao.personal_info.BasePatientDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;