Prechádzať zdrojové kódy

居民修改,关联卡修改

LiTaohong 6 rokov pred
rodič
commit
ef6d85795e

+ 27 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -145,6 +145,16 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
     */
    private String liveTownName;
    /**
     * 居住街道代码
     */
    private String liveStreetCode;
    /**
     * 居住街道名称
     */
    private String liveStreetName;
    /**
     * 居住居委会代码
     */
@ -608,4 +618,21 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
    @Column(name = "live_street_code")
    public String getLiveStreetCode() {
        return liveStreetCode;
    }
    public void setLiveStreetCode(String liveStreetCode) {
        this.liveStreetCode = liveStreetCode;
    }
    @Column(name = "live_street_name")
    public String getLiveStreetName() {
        return liveStreetName;
    }
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
}

+ 27 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/BasePatientVO.java

@ -174,6 +174,17 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "居住区县名称", example = "参考区县名称")
    private String liveTownName;
    /**
     * 居住街道代码
     */
    @ApiModelProperty(value = "居住街道代码", example = "参考居住街道代码")
    private String liveStreetCode;
    /**
     * 居住街道名称
     */
    @ApiModelProperty(value = "居住街道名称", example = "参考居住街道名称")
    private String liveStreetName;
    /**
     * 居委会代码
     */
@ -624,4 +635,20 @@ public class BasePatientVO extends UuidIdentityVOWithOperator {
    public void setLiveTownName(String liveTownName) {
        this.liveTownName = liveTownName;
    }
    public String getLiveStreetCode() {
        return liveStreetCode;
    }
    public void setLiveStreetCode(String liveStreetCode) {
        this.liveStreetCode = liveStreetCode;
    }
    public String getLiveStreetName() {
        return liveStreetName;
    }
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java

@ -20,13 +20,13 @@ public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO
    BasePatientDO findByIdAndDel(String id,String del);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,liveStreetName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    List<Map<String,Object>> findByIdcard(String idcard, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,liveStreetName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,concat(liveProvinceName,liveCityName,liveTownName,liveStreetName,committeeName) as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
}

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java

@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * Created by Trick on 2018/8/31.
@ -15,5 +16,5 @@ public interface PatientMedicareCardDao extends PagingAndSortingRepository<Patie
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);
    @Query("select id from PatientMedicareCardDO where patientCode = ?1")
    List<Object> findIdListByPatientCode(String patientCode);
    Set<Object> findIdListByPatientCode(String patientCode);
}

+ 10 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java

@ -138,16 +138,20 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        // 保存修改的居民信息
        this.save(basePatientDO);
        // 一条一条修改居民相关的卡的信息
        for (Object obj: patientMedicareCards){
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(),PatientMedicareCardDO.class);
        Set<Object> cardIdList = patientMedicardCardService.findIdListByPatientCode(basePatientDO.getId());
        // 有些卡可能是新增或修改的,一条一条修改居民相关的卡的信息
        for (Object obj : patientMedicareCards) {
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(), PatientMedicareCardDO.class);
            card.setPatientCode(basePatientDO.getId());
            if(StringUtils.isEmpty(basePatientDO.getId())){
                return ConstantUtils.FAIL;
            if(cardIdList.contains(card.getId())){
                cardIdList.remove(card.getId());
            }
            patientMedicardCardService.save(card);
        }
        // 有些卡可能是删除的
        if(cardIdList.size() > 0){
            patientMedicardCardService.delete(cardIdList.toArray());
        }
        return ConstantUtils.SUCCESS;
    }
}

+ 14 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java

@ -8,7 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 
@ -41,6 +43,17 @@ public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCa
        return patientMedicareCardDao.findByPatientCode(patientCode);
    }
    /**
     * 根据居民标识获取关联卡id列表
     * @param patientCode
     * @return
     */
    public Set<Object> findIdListByPatientCode(String patientCode){
        Set<Object> result = new HashSet<>();
        if(StringUtils.isEmpty(patientCode)){
            return result;
        }
        return patientMedicareCardDao.findIdListByPatientCode(patientCode);
    }
}