Browse Source

Merge branch 'dev' of liuwenbin/wlyy2.0 into dev

liuwenbin 6 năm trước cách đây
mục cha
commit
8f4e16db25

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

@ -1,6 +1,7 @@
package com.yihu.jw.message.dao;
package com.yihu.jw.message.dao;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
@ -26,6 +27,10 @@ public interface MessageDao extends PagingAndSortingRepository<BaseMessageDO, St
    @Query("update BaseMessageDO t set t.readState = ?1 where t.id=?2 ")
    @Query("update BaseMessageDO t set t.readState = ?1 where t.id=?2 ")
    int updateStatusById(Integer readState,Integer id);
    int updateStatusById(Integer readState,Integer id);
//    List<BaseMessageDO> getBy(String receiver,String sender,String msgTypeCode,Integer platform);
    @Query("select m from BaseMessageDO m where m.receiver=?1 and m.sender=?2 and m.msgTypeCode like ?3 and m.platform=?4 and m.del='1'")
    List<BaseMessageDO> getAllByPatient(String receiver,String sender,String msgTypeCode,Integer platform,Pageable pageRequest);
    @Query("select m from BaseMessageDO m where m.receiver=?1  and m.msgTypeCode like ?2 and m.platform=?3 and m.del='1'")
    List<BaseMessageDO> getAllByPatient(String receiver,String msgTypeCode,Integer platform,Pageable pageRequest);
}
}

+ 31 - 3
business/base-service/src/main/java/com/yihu/jw/message/service/MessageService.java

@ -2,13 +2,16 @@ package com.yihu.jw.message.service;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.LinkedList;
import java.util.LinkedList;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -58,12 +61,16 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
        applyMap.put("name","应用消息");
        applyMap.put("name","应用消息");
        applyMap.put("count",applyReadCount);
        applyMap.put("count",applyReadCount);
        applyMap.put("message",applyList.size()>0?applyList.get(0).getMsgContent():null);
        applyMap.put("message",applyList.size()>0?applyList.get(0).getMsgContent():null);
        applyMap.put("createTime", applyList.size()>0?DateUtil.dateToStr(applyList.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"):null);
        applyMap.put("type","01");
        resultList.add(applyMap);
        resultList.add(applyMap);
        Map<String,Object> systemMap = new HashedMap();
        Map<String,Object> systemMap = new HashedMap();
        systemMap.put("name","系统消息");
        systemMap.put("name","系统消息");
        systemMap.put("count",systemReadCount);
        systemMap.put("count",systemReadCount);
        systemMap.put("message",systemList.size()>0?systemList.get(0).getMsgContent():null);
        systemMap.put("message",systemList.size()>0?systemList.get(0).getMsgContent():null);
        systemMap.put("createTime", systemList.size()>0?DateUtil.dateToStr(systemList.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"):null);
        applyMap.put("type","02");
        resultList.add(systemMap);
        resultList.add(systemMap);
        Integer unReadPageSize = pageSize;
        Integer unReadPageSize = pageSize;
        if(page==0){
        if(page==0){
@ -77,7 +84,11 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
            unReadMap.put("patientCode",one.get("sender"));
            unReadMap.put("patientCode",one.get("sender"));
            unReadMap.put("name",one.get("sender_name"));
            unReadMap.put("name",one.get("sender_name"));
            unReadMap.put("count",one.get("num"));
            unReadMap.put("count",one.get("num"));
            unReadMap.put("message",one.get("msg_content"));
            unReadMap.put("message",one.get("msg_content"));//create_time
            unReadMap.put("createTime", DateUtil.dateToStr((Date)one.get("create_time"),"yyyy-MM-dd HH:mm:ss"));
            unReadMap.put("senderPhoto", one.get("sender_photo"));
            unReadMap.put("senderSex", one.get("sex"));
            applyMap.put("type","03");
            resultList.add(unReadMap);
            resultList.add(unReadMap);
        }
        }
        if(unReadResult.size()<unReadPageSize){
        if(unReadResult.size()<unReadPageSize){
@ -90,6 +101,10 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
                readMap.put("name",one.get("sender_name"));
                readMap.put("name",one.get("sender_name"));
                readMap.put("count",one.get("num"));
                readMap.put("count",one.get("num"));
                readMap.put("message",one.get("msg_content"));
                readMap.put("message",one.get("msg_content"));
                readMap.put("createTime", DateUtil.dateToStr((Date)one.get("create_time"),"yyyy-MM-dd HH:mm:ss"));
                readMap.put("senderPhoto", one.get("sender_photo"));
                readMap.put("senderSex", one.get("sex"));
                applyMap.put("type","03");
                resultList.add(readMap);
                resultList.add(readMap);
            }
            }
        }
        }
@ -115,7 +130,7 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
    private List<Map<String, Object>> messageListSql(Integer platform,String code,Integer readState,Integer page,Integer pageSize){
    private List<Map<String, Object>> messageListSql(Integer platform,String code,Integer readState,Integer page,Integer pageSize){
        String sql =" SELECT " +
        String sql =" SELECT " +
                " a.*, b.msg_content " +
                " a.*, b.msg_content ,b.sender_photo ,p.sex " +
                " FROM " +
                " FROM " +
                " ( " +
                " ( " +
                "  SELECT " +
                "  SELECT " +
@ -130,6 +145,7 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
                "  AND m.receiver = '"+code+"' " +
                "  AND m.receiver = '"+code+"' " +
                "  AND m.del = 1 " +
                "  AND m.del = 1 " +
                "  AND m.read_state = "+readState+" " +
                "  AND m.read_state = "+readState+" " +
                "  AND m.msg_type_code like '03%'"+
                "  GROUP BY " +
                "  GROUP BY " +
                "   m.sender, " +
                "   m.sender, " +
                "   m.sender_name " +
                "   m.sender_name " +
@ -142,7 +158,8 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
                " AND b.receiver = '"+code+"' " +
                " AND b.receiver = '"+code+"' " +
                " AND b.del = 1 " +
                " AND b.del = 1 " +
                " AND b.read_state = "+readState+
                " AND b.read_state = "+readState+
                " AND b.msg_type_code like '%03%'";
                " AND b.msg_type_code like '03%'"+
                " LEFT JOIN base_patient p ON a.sender = p.id ";
        return jdbcTemplate.queryForList(sql);
        return jdbcTemplate.queryForList(sql);
    }
    }
@ -155,6 +172,7 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
                "  AND m.receiver = '"+code+"' " +
                "  AND m.receiver = '"+code+"' " +
                "  AND m.del = 1 " +
                "  AND m.del = 1 " +
                "  AND m.read_state = "+readState+" " +
                "  AND m.read_state = "+readState+" " +
                "  AND m.msg_type_code like '03%'"+
                "  GROUP BY " +
                "  GROUP BY " +
                "   m.sender, " +
                "   m.sender, " +
                "   m.sender_name " ;
                "   m.sender_name " ;
@ -185,4 +203,14 @@ public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
        }
        }
    }
    }
    public List<BaseMessageDO> getAllByPatient(String receiver,String sender,String msgTypeCode,Integer platform,Pageable pageRequest){
        return messageDao.getAllByPatient(receiver,sender,msgTypeCode,platform,pageRequest);
    }
    public List<BaseMessageDO> getAllByPatient(String receiver,String msgTypeCode,Integer platform,Pageable pageRequest){
        return messageDao.getAllByPatient(receiver,msgTypeCode,platform,pageRequest);
    }
}
}

+ 3 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/message/BaseMessageDO.java

@ -99,13 +99,12 @@ public class BaseMessageDO extends IntegerIdentityEntity {
    /**
    /**
     * 消息发送时间
     * 消息发送时间
     */
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    private Date createTime;
    /**
    /**
     * 消息阅读时间
     * 消息阅读时间
     */
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date readTime;
    private Date readTime;
    /**
    /**
@ -257,6 +256,7 @@ public class BaseMessageDO extends IntegerIdentityEntity {
        this.sessionName = sessionName;
        this.sessionName = sessionName;
    }
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    @Column(name = "create_time")
    public Date getCreateTime() {
    public Date getCreateTime() {
        return createTime;
        return createTime;
@ -266,6 +266,7 @@ public class BaseMessageDO extends IntegerIdentityEntity {
        this.createTime = createTime;
        this.createTime = createTime;
    }
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "read_time")
    @Column(name = "read_time")
    public Date getReadTime() {
    public Date getReadTime() {
        return readTime;
        return readTime;

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java

@ -82,6 +82,7 @@ public class PatientRequestMapping {
        public static final String PREFIX  = "/myMessage";
        public static final String PREFIX  = "/myMessage";
        public static final String messageList  = "/messageList";
        public static final String messageList  = "/messageList";
        public static final String myDoctorList  = "/myDoctorList";
        public static final String myDoctorList  = "/myDoctorList";
        public static final String messageDetailList  = "/messageDetailList";
    }
    }

+ 4 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/myFamily/MyFamilyEndpoint.java

@ -64,7 +64,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "patient",required = false) String patient,
            @RequestParam(value = "patient",required = false) String patient,
            @ApiParam(name = "familyMobile", value = "家人的手机号码", required = true)
            @ApiParam(name = "familyMobile", value = "家人的手机号码", required = true)
            @RequestParam(value = "familyMobile",required = true) String familyMobile,
            @RequestParam(value = "familyMobile",required = true) String familyMobile,
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true)
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶,2父亲,3母亲,4公公,5婆婆,6岳父,7岳母,8女婿,9儿媳,10子女", required = true)
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
        try{
        try{
            Map<String,Object> patientApplyLog = myFamilyService.bindingMyFamily( getUID(patient), familyMobile, 1,familyBindRole,null,null,null);
            Map<String,Object> patientApplyLog = myFamilyService.bindingMyFamily( getUID(patient), familyMobile, 1,familyBindRole,null,null,null);
@ -82,7 +82,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "patient",required = false) String patient,
            @RequestParam(value = "patient",required = false) String patient,
            @ApiParam(name = "wechatId", value = "wechatId", required = true)
            @ApiParam(name = "wechatId", value = "wechatId", required = true)
            @RequestParam(value = "wechatId",required = true) String wechatId,
            @RequestParam(value = "wechatId",required = true) String wechatId,
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true)
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶,2父亲,3母亲,4公公,5婆婆,6岳父,7岳母,8女婿,9儿媳,10子女", required = true)
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
        try{
        try{
            Map<String,Object> resultMap = myFamilyService.createFamilyQrCode(wechatId, getUID(patient),familyBindRole);
            Map<String,Object> resultMap = myFamilyService.createFamilyQrCode(wechatId, getUID(patient),familyBindRole);
@ -149,7 +149,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "applyPatient",required = true) String applyPatient,
            @RequestParam(value = "applyPatient",required = true) String applyPatient,
            @ApiParam(name = "familyPatient", value = "家人code", required = false)
            @ApiParam(name = "familyPatient", value = "家人code", required = false)
            @RequestParam(value = "familyPatient",required = false) String familyPatient,
            @RequestParam(value = "familyPatient",required = false) String familyPatient,
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true)
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶,2父亲,3母亲,4公公,5婆婆,6岳父,7岳母,8女婿,9儿媳,10子女", required = true)
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole,
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole,
            @ApiParam(name = "isAuthorize", value = "0:未授权,1:已授权", required = true)
            @ApiParam(name = "isAuthorize", value = "0:未授权,1:已授权", required = true)
            @RequestParam(value = "isAuthorize",required = true) Integer isAuthorize,
            @RequestParam(value = "isAuthorize",required = true) Integer isAuthorize,
@ -200,7 +200,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "applyPatient",required = true) String applyPatient,
            @RequestParam(value = "applyPatient",required = true) String applyPatient,
            @ApiParam(name = "familyPatient", value = "家人code", required = false)
            @ApiParam(name = "familyPatient", value = "家人code", required = false)
            @RequestParam(value = "familyPatient",required = false) String familyPatient,
            @RequestParam(value = "familyPatient",required = false) String familyPatient,
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女", required = true)
            @ApiParam(name = "familyBindRole", value = "家庭关系关系 1配偶,2父亲,3母亲,4公公,5婆婆,6岳父,7岳母,8女婿,9儿媳,10子女", required = true)
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
            @RequestParam(value = "familyBindRole",required = true) Integer familyBindRole) throws Exception {
        try{
        try{
            Map<String,Object> resultMap = myFamilyService.scanQRcode(applyPatient,getUID(familyPatient),familyBindRole);
            Map<String,Object> resultMap = myFamilyService.scanQRcode(applyPatient,getUID(familyPatient),familyBindRole);

+ 24 - 1
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/myMessage/MyMessageEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.patient.endpoint.myMessage;
package com.yihu.jw.patient.endpoint.myMessage;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.patient.service.message.MyDoctorListService;
import com.yihu.jw.patient.service.message.MyDoctorListService;
import com.yihu.jw.patient.service.message.MyMessageService;
import com.yihu.jw.patient.service.message.MyMessageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
@ -55,11 +56,33 @@ public class MyMessageEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "condition", value = "搜索条件,医生姓名/医院", required = false)
            @ApiParam(name = "condition", value = "搜索条件,医生姓名/医院", required = false)
            @RequestParam(value = "condition",required = false) String condition) throws Exception {
            @RequestParam(value = "condition",required = false) String condition) throws Exception {
        try{
        try{
            Map<String,Object> messageMap = myDoctorListService.myDoctorList(getUID(patient),condition);
            List<Map<String, Object>> messageMap = myDoctorListService.myDoctorList(getUID(patient),condition);
            return success(messageMap);
            return success(messageMap);
        }catch (Exception e){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return failed(e.getMessage());
            return failed(e.getMessage());
        }
        }
    }
    }
    @GetMapping(value = PatientRequestMapping.MyMessage.messageDetailList)
    @ApiOperation(value = "通知消息列表")
    public Envelop messageDetailList(
            @ApiParam(name = "patient", value = "居民code", required = false)
            @RequestParam(value = "patient",required = false) String patient,
            @ApiParam(name = "type", value = "系统消息01,应用消息02,其他医生消息03", required = true)
            @RequestParam(value = "type",required = true) String type,
            @ApiParam(name = "sender", value = "发送人code", required = false)
            @RequestParam(value = "sender",required = false) String sender,
            @ApiParam(name = "page", value = "页数从1开始", required = true)
            @RequestParam(value = "page",required = true) Integer page,
            @ApiParam(name = "pageSize", value = "每页总数", required = true)
            @RequestParam(value = "pageSize",required = true) Integer pageSize) throws Exception {
        try{
            List<BaseMessageDO> list = myMessageService.messageDetailList(type,getUID(patient),sender,page,pageSize);
            return success(list);
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
        }
    }
}
}

+ 78 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/message/MyDoctorListService.java

@ -1,11 +1,13 @@
package com.yihu.jw.patient.service.message;
package com.yihu.jw.patient.service.message;
import com.yihu.jw.patient.util.PinYinUtil;
import com.yihu.jw.patient.util.PinYinUtil;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -18,11 +20,18 @@ public class MyDoctorListService {
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    public Map<String,Object> myDoctorList(String patient, String condition)throws Exception{
        String sql = myDoctorListSql(patient,condition);
    public List<Map<String, Object>> myDoctorList(String patient, String condition)throws Exception{
        String sql = myDoctorListSql2(patient,condition);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = PinYinUtil.pingYinSort(list);
        Map<String,Object> map = PinYinUtil.pingYinSort(list);
        return map;
        List<Map<String,Object>> resultMap = new ArrayList<>();
        for (String key : map.keySet()) {
            Map<String,Object> one = new HashedMap();
            one.put("title",key);
            one.put("items",map.get(key));
            resultMap.add(one);
        }
        return resultMap;
    }
    }
    public String myDoctorListSql(String patient, String condition){
    public String myDoctorListSql(String patient, String condition){
@ -30,9 +39,11 @@ public class MyDoctorListService {
                " r.sign_doctor as doctor, " +
                " r.sign_doctor as doctor, " +
                " r.sign_doctor_name as name, " +
                " r.sign_doctor_name as name, " +
                " r.hospital as hospital, " +
                " r.hospital as hospital, " +
                " r.hospital_name as hospitalName" +
                " r.hospital_name as hospitalName, " +
                " d.photo as photo" +
                " FROM " +
                " FROM " +
                " base_service_package_sign_record r " +
                " base_service_package_sign_record r " +
                " left join base_doctor d on r.sign_doctor=d.id"+
                " WHERE " +
                " WHERE " +
                " ( " +
                " ( " +
                "  r.patient IN ( " +
                "  r.patient IN ( " +
@ -55,4 +66,67 @@ public class MyDoctorListService {
        return sql;
        return sql;
    }
    }
    public String myDoctorListSql2(String patient, String condition){
        String conditionSql = "";
        if(!StringUtils.isEmpty(condition)){
            conditionSql+=" AND r.sign_doctor_name like '%"+condition+"%' " +
                    " AND r.hospital_name like '%"+condition+"%'";
        }
        String sql ="SELECT " +
                " r.sign_doctor AS doctor, " +
                " r.sign_doctor_name AS name, " +
                " r.hospital AS hospital, " +
                " r.hospital_name AS hospitalName, " +
                " d.photo AS photo, " +
                " d.sex as sex, " +
                " h.dept_name as deptName, " +
                " h.doctor_duty_name as dutyName, " +
                " h.org_name as orgName" +
                " FROM " +
                " base_service_package_sign_record r " +
                " LEFT JOIN base_doctor d ON r.sign_doctor = d.id " +
                " LEFT JOIN ( " +
                " SELECT " +
                "  min(d.id) AS id, " +
                "  sign_doctor " +
                " FROM " +
                "  base_service_package_sign_record r " +
                " LEFT JOIN base_doctor_hospital d ON r.sign_doctor = d.doctor_code " +
                " AND d.del = 1 " +
                " WHERE " +
                "  ( " +
                "   r.patient IN ( " +
                "    SELECT " +
                "     m.family_member " +
                "    FROM " +
                "     base_patient_family_member m " +
                "    WHERE " +
                "     m.patient = '"+patient+"' " +
                "    AND m.del = 1 " +
                "    AND m.is_authorize = 1 " +
                "   ) " +
                "   OR r.patient = '"+patient+"' " +
                "  ) " +
                " AND r. STATUS = 2 " + conditionSql+
                ") c ON c.sign_doctor = d.id " +
                "LEFT JOIN base_doctor_hospital h ON h.id = c.id " +
                "WHERE " +
                " ( " +
                "  r.patient IN ( " +
                "   SELECT " +
                "    m.family_member " +
                "   FROM " +
                "    base_patient_family_member m " +
                "   WHERE " +
                "    m.patient = '"+patient+"' " +
                "   AND m.del = 1 " +
                "   AND m.is_authorize = 1 " +
                "  ) " +
                "  OR r.patient = '"+patient+"' " +
                " ) " +
                "AND r. STATUS = 2" +conditionSql;
        return sql;
    }
}
}

+ 24 - 2
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/message/MyMessageService.java

@ -1,7 +1,11 @@
package com.yihu.jw.patient.service.message;
package com.yihu.jw.patient.service.message;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.message.service.MessageService;
import com.yihu.jw.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -26,7 +30,25 @@ public class MyMessageService {
        messageService.updateStatusById(readState,id);
        messageService.updateStatusById(readState,id);
    }
    }
    public void messagedetailList(Integer type,String reciever,String sender){
        
    /**
     *
     * @param type 系统消息 01,应用消息 02,其他医生消息 03
     * @param receiver
     * @param sender
     * @param page
     * @param pageSize
     * @return
     */
    public List<BaseMessageDO> messageDetailList(String type,String receiver,String sender,Integer page,Integer pageSize){
        String msgTypeCode = type+"%";
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        Pageable pageRequest = new PageRequest(page-1,pageSize,sort);
        List<BaseMessageDO> list = null;
        if("01".equals(type)||"02".equals(type)){
            list = messageService.getAllByPatient(receiver,msgTypeCode,1,pageRequest);
        }else{
            list = messageService.getAllByPatient(receiver,sender,msgTypeCode,1,pageRequest);
        }
        return list;
    }
    }
}
}

+ 22 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/MyFamilyService.java

@ -204,6 +204,9 @@ public class MyFamilyService {
            familyPatient.setPatientStatus("1");
            familyPatient.setPatientStatus("1");
            familyPatient.setName(familyName);
            familyPatient.setName(familyName);
            familyPatient.setIdcard(idcard);
            familyPatient.setIdcard(idcard);
            if(!StringUtils.isEmpty(idcard)){
                familyPatient.setSex(IdCardUtil.getAgeForIdcard(idcard));
            }
            familyPatient = patientService.save(familyPatient);
            familyPatient = patientService.save(familyPatient);
            //生成绑定信息
            //生成绑定信息
            BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO();
            BasePatientFamilyMemberDO patientFamilyMember = new BasePatientFamilyMemberDO();
@ -353,8 +356,21 @@ public class MyFamilyService {
        BasePatientDO apply = patientService.findByIdAndDel(applyPatient);
        BasePatientDO apply = patientService.findByIdAndDel(applyPatient);
        BasePatientDO family = patientService.findByIdAndDel(familyPatient);
        BasePatientDO family = patientService.findByIdAndDel(familyPatient);
        Integer converRole = familyRelationTrans(familyBindRole,apply.getSex());
        Integer converRole = familyRelationTrans(familyBindRole,apply.getSex());
        BasePatientFamilyMemberDO familyMemberDO = patientFamilyMemberService.findByPatientAndFamilyMemberAndDel(applyPatient,familyPatient);
        map.put("applyPhoto",apply.getPhoto());
        map.put("applyPhoto",apply.getPhoto());
        map.put("applyMobile",apply.getMobile());
        map.put("applyToFamilyRole",familyBindRole);
        map.put("applyNonage",this.nonageByIdcard(apply.getIdcard()));//1成年,2未成年
        map.put("familyPhoto",family.getPhoto());
        map.put("familyPhoto",family.getPhoto());
        map.put("familyMobile",family.getMobile());
        map.put("familyToApplyRole",converRole);
        map.put("familyNonage",this.nonageByIdcard(family.getIdcard()));//1成年,2未成年
        if(familyMemberDO!=null){
            map.put("isBinding",1);
        }else{
            map.put("isBinding",0);
        }
        map.put("explain","您的"+role.get(converRole-1)+apply.getName()+"邀请您绑定家人账号");
        map.put("explain","您的"+role.get(converRole-1)+apply.getName()+"邀请您绑定家人账号");
        return map;
        return map;
    }
    }
@ -418,6 +434,7 @@ public class MyFamilyService {
            }
            }
        }
        }
        map.put("nonage",this.nonageByIdcard(basePatientDO.getIdcard()));//1成年,2未成年
        resultList.add(map);
        resultList.add(map);
        //家人
        //家人
        for(BasePatientFamilyMemberDO one:list){
        for(BasePatientFamilyMemberDO one:list){
@ -444,6 +461,7 @@ public class MyFamilyService {
                }
                }
            }
            }
            map.put("nonage",this.nonageByIdcard(basePatientDO.getIdcard()));//1成年,2未成年
            map2.put("photo",basePatientDO.getPhoto());//头像
            map2.put("photo",basePatientDO.getPhoto());//头像
            map2.put("role",role.get(one.getFamilyRelation()-1));//角色
            map2.put("role",role.get(one.getFamilyRelation()-1));//角色
            //判断家人是否授权
            //判断家人是否授权
@ -463,6 +481,7 @@ public class MyFamilyService {
            Map<String,Object> map = new HashedMap();
            Map<String,Object> map = new HashedMap();
            BasePatientDO familyMember = patientService.findByIdAndDel(one.getFamilyMember());
            BasePatientDO familyMember = patientService.findByIdAndDel(one.getFamilyMember());
            map.put("photo",familyMember.getPhoto());//头像
            map.put("photo",familyMember.getPhoto());//头像
            map.put("nonage",this.nonageByIdcard(familyMember.getIdcard()));//1成年,2未成年
            map.put("name",familyMember.getName());//姓名
            map.put("name",familyMember.getName());//姓名
            map.put("roleName",role.get(one.getFamilyRelation()-1));//角色名称
            map.put("roleName",role.get(one.getFamilyRelation()-1));//角色名称
            map.put("mobile",familyMember.getMobile());//手机号码
            map.put("mobile",familyMember.getMobile());//手机号码
@ -479,6 +498,7 @@ public class MyFamilyService {
            Map<String,Object> map = new HashedMap();
            Map<String,Object> map = new HashedMap();
            BasePatientDO familyMember = patientService.findByIdAndDel(one.get("family_member_code")+"");
            BasePatientDO familyMember = patientService.findByIdAndDel(one.get("family_member_code")+"");
            map.put("photo",familyMember.getPhoto());//头像
            map.put("photo",familyMember.getPhoto());//头像
            map.put("nonage",this.nonageByIdcard(familyMember.getIdcard()));//1成年,2未成年
            map.put("name",familyMember.getName());//姓名
            map.put("name",familyMember.getName());//姓名
            map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")-1));//角色名称
            map.put("roleName",role.get(Integer.valueOf(one.get("family_bind_role")+"")-1));//角色名称
            map.put("mobile",familyMember.getMobile());//手机号码
            map.put("mobile",familyMember.getMobile());//手机号码
@ -551,7 +571,9 @@ public class MyFamilyService {
            map.put("messageId",Integer.valueOf(one.get("id")+""));
            map.put("messageId",Integer.valueOf(one.get("id")+""));
            map.put("patientApplyLogId",relationData);
            map.put("patientApplyLogId",relationData);
            map.put("patientPhoto",patientDO.getPhoto());
            map.put("patientPhoto",patientDO.getPhoto());
            map.put("patientNonage",this.nonageByIdcard(patientDO.getIdcard()));//1成年,2未成年
            map.put("applyPatientPhoto",createPatient.getPhoto());
            map.put("applyPatientPhoto",createPatient.getPhoto());
            map.put("applyPatientNonage",this.nonageByIdcard(createPatient.getIdcard()));//1成年,2未成年
            map.put("explain","您的"+role.get(converRole-1)+createPatient.getName()+"邀请您绑定家人账号");
            map.put("explain","您的"+role.get(converRole-1)+createPatient.getName()+"邀请您绑定家人账号");
            result.add(map);
            result.add(map);
            BaseMessageDO msg = messageService.findById(Integer.valueOf(one.get("id")+""));
            BaseMessageDO msg = messageService.findById(Integer.valueOf(one.get("id")+""));

+ 4 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -12,6 +12,7 @@ import com.yihu.jw.patient.util.CommonUtils;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.sms.service.BaseSmsService;
import com.yihu.jw.sms.service.BaseSmsService;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.utils.security.MD5;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.csource.common.MyException;
import org.csource.common.MyException;
@ -153,6 +154,9 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            patient.setPatientStatus("1");
            patient.setPatientStatus("1");
            patient.setName(name);
            patient.setName(name);
            patient.setIdcard(idcard);
            patient.setIdcard(idcard);
            if(!StringUtils.isEmpty(idcard)){
                patient.setSex(IdCardUtil.getAgeForIdcard(idcard));
            }
            patient = this.save(patient);
            patient = this.save(patient);
        }else{
        }else{
            patient = list.get(0);
            patient = list.get(0);