Explorar el Código

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

wangzhinan hace 5 años
padre
commit
7189bba4bf

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java

@ -27,8 +27,8 @@ public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO,
    BaseDoctorDO findById(String id);
    @Modifying
    @Query("update BaseDoctorDO p set p.introduce = ?2,p.expertise = ?3,p.outpatientType = ?4 where p.id = ?1")
    void update(String doctorId,String introduce,String expertise,String outpatientType);
    @Query("update BaseDoctorDO p set p.introduce = ?2,p.expertise = ?3,p.photo = ?4,p.outpatientType = ?5 where p.id = ?1")
    void update(String doctorId,String introduce,String expertise,String photo,String outpatientType);
    @Modifying
    @Query("update BaseDoctorDO p set p.del = ?2 where p.id = ?1")

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/DoctorSpecialDiseaseDao.java

@ -22,4 +22,5 @@ public interface DoctorSpecialDiseaseDao extends PagingAndSortingRepository<Doct
    @Modifying
    @Query("delete from DoctorSpecialDiseaseDo p where p.doctorCode=?1")
    void deleteByDoctorCode(String doctorCode);
}

+ 26 - 6
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorService.java

@ -122,11 +122,13 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                " a.job_title_name AS \"jobTitleName\", " +
                " a.introduce AS \"introduce\", " +
                " a.expertise AS \"expertise\", " +
                " a.photo AS \"photo\", " +
                " a.outpatient_type AS \"outpatientType\", " +
                " b.dept_name AS \"deptName\", " +
                " b.org_name AS \"orgName\", " +
                " c.mapping_code AS \"jobNumber\", " +
                " d.disease_name AS \"diseaseName\", " +
                " d.disease_code AS \"diseaseCode\", " +
                " e.req_fee AS \"money\" " +
                " FROM " +
                " base_doctor a " +
@ -156,23 +158,41 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        String doctorId = jsonObject.get("doctorId").toString();
        String introduce = jsonObject.get("introduce").toString();
        String expertise = jsonObject.get("expertise").toString();
        String photo = jsonObject.get("photo").toString();
        String outpatientType = jsonObject.get("outpatientType").toString();
        String newSpecialDisease = jsonObject.get("specialDisease").toString();
        String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
        //医生简介、擅长不为空
        if (null == introduce || null == expertise){
            return false;
        }
        baseDoctorDao.update(doctorId,introduce,expertise,outpatientType);
        baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
        //删除医生旧专病门诊,保存新专病门诊
        List<DoctorSpecialDiseaseDo> oldSpecialDisease = specialDiseaseDao.findByDoctorCode(doctorId);
        if (null != oldSpecialDisease && oldSpecialDisease.size()>0){
        //List<DoctorSpecialDiseaseDo> oldSpecialDisease = specialDiseaseDao.findByDoctorCode(doctorId);
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " wlyy_doctor_special_disease a " +
                " WHERE " +
                " 1 = 1";
        sqlTotal += " AND a.doctor_code =:doctorId";
        params.put("doctorId",doctorId);
        Long count = 0L;
        List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
        //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        if (count > 0){
            specialDiseaseDao.deleteByDoctorCode(doctorId);
        }
        DoctorSpecialDiseaseDo specialDiseaseDo = new DoctorSpecialDiseaseDo();
        String[] split = newSpecialDisease.split(",");
        for (String diseaseName : split) {
        String[] splitCode = newSpecialDiseaseCode.split(",");
        for (int i=0;i<split.length;i++ ){
            DoctorSpecialDiseaseDo specialDiseaseDo = new DoctorSpecialDiseaseDo();
            specialDiseaseDo.setDoctorCode(doctorId);
            specialDiseaseDo.setDiseaseName(diseaseName);
            specialDiseaseDo.setDiseaseName(split[i]);
            specialDiseaseDo.setDiseaseCode(splitCode[i]);
            specialDiseaseDao.save(specialDiseaseDo);
        }

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/DoctorSpecialDiseaseDo.java

@ -24,6 +24,11 @@ public class DoctorSpecialDiseaseDo extends IntegerIdentityEntity {
     */
    private String diseaseName;
    /**
     * 关联专病code
     */
    private String diseaseCode;
    @Column(name = "doctor_code")
    public String getDoctorCode() {
        return doctorCode;
@ -39,4 +44,12 @@ public class DoctorSpecialDiseaseDo extends IntegerIdentityEntity {
    public void setDiseaseName(String diseaseName) {
        this.diseaseName = diseaseName;
    }
    @Column(name = "disease_code")
    public String getDiseaseCode() {
        return diseaseCode;
    }
    public void setDiseaseCode(String diseaseCode) {
        this.diseaseCode = diseaseCode;
    }
}