فهرست منبع

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

叶仕杰 4 سال پیش
والد
کامیت
7f23507710

+ 41 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/sign/CapacityDoctorDO.java

@ -0,0 +1,41 @@
package com.yihu.jw.entity.care.sign;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description: 能力评估医生关联表
 */
@Entity
@Table(name = "base_capacity_doctor")
public class CapacityDoctorDO extends UuidIdentityEntity {
    private String capacityId;
    private String doctorId;
    @Column(name = "capacity_id")
    public String getCapacityId() {
        return capacityId;
    }
    public void setCapacityId(String capacityId) {
        this.capacityId = capacityId;
    }
    @Column(name = "doctor_id")
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
}

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityAssessmentRecordDao.java

@ -2,14 +2,18 @@ package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * Created by yeshijie on 2021/2/25.
 */
public interface CapacityAssessmentRecordDao extends PagingAndSortingRepository<CapacityAssessmentRecordDO, String>,
        JpaSpecificationExecutor<CapacityAssessmentRecordDO> {
    CapacityAssessmentRecordDO findByPatient(String patient);
    @Query("select c from CapacityAssessmentRecordDO c where c.patient=?1 and c.assessmentTime>=?2 ")
    CapacityAssessmentRecordDO findByPatient(String patient,Date assessmentTime);
}

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/sign/CapacityDoctorDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.sign;
import com.yihu.jw.entity.care.sign.CapacityDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/8
 * @Description:
 */
public interface CapacityDoctorDao extends PagingAndSortingRepository<CapacityDoctorDO, String>, JpaSpecificationExecutor<CapacityDoctorDO> {
    CapacityDoctorDO findByCapacityIdAndDoctorId(String capacityId, String doctorId);
}

+ 5 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -163,6 +163,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            }
            return success( "授权成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("授权失败",-1);
        }
    }
@ -256,6 +257,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            JSONObject result = familyMemberService.isRegister(idcard, getUID());
            return ObjEnvelop.getSuccess( "查询成功",  result);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError( "查询失败");
        }
    }
@ -272,6 +274,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
            JSONObject result = familyMemberService.checkFamilyMember(memberCode);
            return ObjEnvelop.getSuccess( "验证成功",  result);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError( "验证失败");
        }
    }
@ -308,6 +311,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return success( "添加成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "添加失败",-1);
        }
    }
@ -357,6 +361,7 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return success( "添加成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return failed( "添加失败",-1);
        }
    }

+ 17 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -7,9 +7,7 @@ import com.yihu.jw.care.dao.sign.CapacityAssessmentRecordDao;
import com.yihu.jw.care.service.sign.ArchiveService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
@ -21,12 +19,9 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -290,6 +285,23 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "synCapacityRecord" )
    @ApiOperation(value = "同步能力评估报告")
    @ObserverRequired
    public Envelop synCapacityRecord(
            @ApiParam(name = "patient", value = "患者id", required = true)
            @RequestParam String patient,
            @ApiParam(name = "doctorId", value = "医生id", required = true)
            @RequestParam String doctorId) {
        try{
            capacityAssessmentRecordService.synCapacityRecord(patient,doctorId);
            return success("同步成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("同步失败",-1);
        }
    }
    @PostMapping(value = "capacityAssessmentByPatient" )
    @ApiOperation(value = "通过患者id生成当年能力评估报告")
    @ObserverRequired

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -365,9 +365,9 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
                "    t2.id in (select family_member from base_patient_family_member where patient = ? ) " +
                "    and t1.patient = ? " +
                "    and t1.family_member = t2.id ";
        if(isContacts != null){
/*        if(isContacts != null){
            sql += " and t1.is_contacts = "+ isContacts;
        }
        }*/
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, patient});
        if (result != null && result.size() > 0) {

+ 31 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -75,14 +75,17 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
    private PatientBedApplyDao patientBedApplyDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private CapacityDoctorDao capacityDoctorDao;
    /**
     * 按id查找评估明细
     * @param patient
     * @return
     */
    public CapacityAssessmentRecordDO findAssessmentByPatientId(String patient)  {
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient);
    public CapacityAssessmentRecordDO findAssessmentByPatientId(String patient) throws Exception {
        Date assessmentTime =  DateUtil.dateTimeParse(DateUtil.getNowYear() + "-01-01 00:00:00");
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient,assessmentTime);
        recordDO.setLevelConclusionName(dictService.fingByNameAndCode(ConstantUtil.DICT_LEVEL_CONCLUSION,String.valueOf(recordDO.getLevelConclusion())));
        return recordDO;
    }
@ -152,11 +155,11 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
                "c.`status`,c.level_conclusion levelConclusion,c.org_code orgCode,c.org_name orgName,p.name,p.photo,p.mobile,p.sex,p.idcard  ";
        String countSql = "SELECT count(*) ";
        String filters = "from base_capacity_assessment_record c,base_patient p " +
        String filters = "from base_capacity_assessment_record c left join base_capacity_doctor d on c.id =d.capacity_id ,base_patient p " +
                "WHERE  c.patient = p.id  and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01'";
        if(StringUtils.isNoneBlank(doctorId)){
            filters += " and c.doctor = '"+doctorId+"' ";
            filters += " and (c.doctor = '"+doctorId+"' or d.doctor_id = '"+doctorId+"')";
        }
        if(status!=null){
            filters += " and c.status = "+status;
@ -271,6 +274,30 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        return result;
    }
    /**
     * 同步能力评估
     * @param patient
     * @param doctorId
     * @throws Exception
     */
    public void synCapacityRecord(String patient,String doctorId) throws Exception{
        Date assessmentTime =  DateUtil.dateTimeParse(DateUtil.getNowYear() + "-01-01 00:00:00");
        CapacityAssessmentRecordDO recordDO = capacityAssessmentRecordDao.findByPatient(patient,assessmentTime);
        if(recordDO == null){
            throw new Exception("居民不存在有效的能力评估报告");
        }
        if(doctorId.equals(recordDO.getDoctor())){
           return;
        }
        CapacityDoctorDO capacityDoctorDO = capacityDoctorDao.findByCapacityIdAndDoctorId(recordDO.getId(),doctorId);
        if(capacityDoctorDO == null){
            capacityDoctorDO = new CapacityDoctorDO();
            capacityDoctorDO.setCapacityId(recordDO.getId());
            capacityDoctorDO.setDoctorId(doctorId);
            capacityDoctorDao.save(capacityDoctorDO);
        }
    }
    /**
     * 通过患者id 生成当年评估报告
     * @param patient