Просмотр исходного кода

我的家庭模块代码提交

liuwenbin 6 лет назад
Родитель
Сommit
26411b6953

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

@ -19,7 +19,7 @@ public class PatientApplyLog extends IntegerIdentityEntity {
    private String familyMemberCode;//家庭成员code
    private String qrCode;//二维码地址
    private Date failureTime;//失效时间
    private Integer status;//1、添加家人(默认),2、邀请登录,3、通过,4、拒绝
    private Integer status;//1、添加家人(默认),2、邀请登录,3、通过,4、拒绝,5、申请人主动终止申请
    private Integer del;//删除标志(1正常,0删除)申请人主动终止申请
    private Date createTime;//创建时间
    private String createUser;//申请人

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

@ -1,13 +1,12 @@
package com.yihu.jw.patient.dao.myFamily;
import com.sun.tools.javac.util.List;
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;
import static org.springframework.data.jpa.domain.AbstractPersistable_.id;
/**
 * @author liuwenbin on 2018/11/30.
 */
@ -20,6 +19,7 @@ public interface PatientApplyLogDao extends PagingAndSortingRepository<PatientAp
    PatientApplyLog findById(Integer id);
    @Modifying
    @Query("update PatientApplyLog t set t.del = ?1 where t.id=?2 ")
    int updateDelById(Integer del,Integer id);
    @Query("update PatientApplyLog t set t.status = ?1 where t.id=?2 ")
    int updateStatusById(Integer status,Integer id);
}

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

@ -102,7 +102,7 @@ public class MyFamilyEndpoint extends EnvelopRestEndpoint {
    }
    @PostMapping(value = PatientRequestMapping.MyFamily.remindMyFamily)
    @ApiOperation(value = "签约界面已绑定家人信息")
    @ApiOperation(value = "绑定家人界面提醒家人通过")
    public Envelop remindMyFamily(
            @ApiParam(name = "patientApplyLogId", value = "patientApplyLogId", required = true)
            @RequestParam(value = "patientApplyLogId",required = true) Integer patientApplyLogId,

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

@ -290,6 +290,42 @@ public class MyFamilyService {
        return resultList;
    }
    public void myFamilyBindList(String patient) throws Exception{
        //已绑定的
        List<BasePatientFamilyMemberDO> bindList = patientFamilyMemberService.getByPatientAndFamilyMember(patient);
        BasePatientDO patientDO = patientService.findByIdAndDel(patient);//绑定人
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(BasePatientFamilyMemberDO one:bindList){
            Map<String,Object> map = new HashedMap();
            if(patient.equals(one.getPatient())){
                BasePatientDO familyMember = patientService.findByIdAndDel(one.getFamilyMember());
                map.put("photo",familyMember.getPhoto());//头像
                map.put("name",familyMember.getName());//姓名
                map.put("roleName",role.get(one.getFamilyRelation()+1));//角色名称
                map.put("mobile",familyMember.getMobile());//手机号码
                map.put("isAuthorize",one.getIsAuthorize());//0:未授权,1:已授权
                map.put("familyMemberId",one.getId());
                map.put("patientId",familyMember.getId());
                map.put("type",1);
            }else{
                Integer familyRelation = familyRelationTrans(one.getFamilyRelation(),patientDO.getSex());
                BasePatientDO familyMember = patientService.findByIdAndDel(one.getPatient());
                map.put("photo",familyMember.getPhoto());//头像
                map.put("name",familyMember.getName());//姓名
                map.put("roleName",role.get(familyRelation+1));//角色名称
                map.put("mobile",familyMember.getMobile());//手机号码
                map.put("isAuthorize",one.getIsAuthorize());//0:未授权,1:已授权
                map.put("familyMemberId",one.getId());
                map.put("patientId",familyMember.getId());
                map.put("type",1);
            }
            resultList.add(map);
        }
        //已邀请的
//        patientApplyLogService.
        //已取消的
    }
    /**
     * 有效的申请绑定消息
     * @param patient
@ -329,7 +365,7 @@ public class MyFamilyService {
     */
    @Transactional(rollbackFor = Exception.class)
    public void cancelApply(Integer patientApplyLogId) throws Exception{
        int i= patientApplyLogService.updateDelById(0, patientApplyLogId);
        int i= patientApplyLogService.updateStatusById(5, patientApplyLogId);
        if(i<0){
            throw new Exception("update data failur !");
        }

+ 16 - 3
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/myFamily/PatientApplyLogService.java

@ -2,10 +2,16 @@ 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.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author liuwenbin on 2018/11/30.
 */
@ -14,6 +20,8 @@ public class PatientApplyLogService extends BaseJpaService<PatientApplyLog, Pati
    @Autowired
    private PatientApplyLogDao patientApplyLogDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 更新提醒方式
@ -31,11 +39,16 @@ public class PatientApplyLogService extends BaseJpaService<PatientApplyLog, Pati
    /**
     * 更新是否取消申请
     * @param del 1正常,0删除
     * @param patientApplyLogId
     * @return
     */
    public int updateDelById(Integer del, Integer patientApplyLogId){
        return  patientApplyLogDao.updateDelById(del,patientApplyLogId);
    public int updateStatusById(Integer status, Integer patientApplyLogId){
        return  patientApplyLogDao.updateStatusById(status,patientApplyLogId);
    }
    //invalid 无效 valid 有效
    public List<Map<String, Object>> findValidByPatient(String patient){
        String sql = "select l.* from patient_apply_for_log l where l.create_user='"+patient+"' and l.del=1 and l.status in (1,2) and l.failure_time>="+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss");
        return jdbcTemplate.queryForList(sql);
    }
}