Browse Source

床位申请 建档修改

liubing 4 years ago
parent
commit
0b2c814d3f

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

@ -24,6 +24,9 @@ public interface BaseDoctorHospitalDao extends PagingAndSortingRepository<BaseDo
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.doctorCode = ?1 and bdo.del=1")
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.doctorCode = ?1 and bdo.del=1")
    List<BaseDoctorHospitalDO> findByDoctorCode(String doctorCode);
    List<BaseDoctorHospitalDO> findByDoctorCode(String doctorCode);
    @Query("select bdo from BaseDoctorHospitalDO bdo where bdo.doctorCode = ?1 and bdo.del=1 group by bdo.orgCode")
    List<BaseDoctorHospitalDO> findDistinctOrgByDoctorCode(String doctorCode);
    List<BaseDoctorHospitalDO> findByOrgCode(String orgCode);
    List<BaseDoctorHospitalDO> findByOrgCode(String orgCode);

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/apply/PatientBedApplyDao.java

@ -14,7 +14,7 @@ import java.util.List;
public interface PatientBedApplyDao extends PagingAndSortingRepository<PatientBedApplyDo,String>,
public interface PatientBedApplyDao extends PagingAndSortingRepository<PatientBedApplyDo,String>,
        JpaSpecificationExecutor<PatientBedApplyDo> {
        JpaSpecificationExecutor<PatientBedApplyDo> {
    PatientBedApplyDo findByPatientAndOrgCodeAndStatus(String patient,String orgCode,Integer status);
    PatientBedApplyDo findByIdcardAndOrgCodeAndStatus(String idcard,String orgCode,Integer status);
    List<PatientBedApplyDo> findByOrgCodeAndStatusIn(String orgCode,Integer[] status ,Sort sort);
    List<PatientBedApplyDo> findByOrgCodeAndStatusIn(String orgCode,Integer[] status ,Sort sort);

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

@ -7,6 +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.ArchiveService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
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.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
import com.yihu.jw.entity.care.archive.ArchiveDO;
@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -363,11 +365,14 @@ public class SignEndpoint extends EnvelopRestEndpoint {
            String idcard = patientDO.getIdcard();
            String idcard = patientDO.getIdcard();
            if(patientDao.existsByIdcardAndDel(idcard,"1")){
            if(patientDao.existsByIdcardAndDel(idcard,"1")){
                ArchiveDO archiveDO = archiveDao.findByIdcardAndDoctorCode(idcard,doctorId);
                ArchiveDO archiveDO = archiveDao.findByIdcardAndDoctorCode(idcard,doctorId);
                if(archiveDO!=null){
                if(archiveDO!=null){//医生已经为患者建档
                    return failed("您所提交的居民信息已存在,请勿重复建档",-1);
                    return failed("您所提交的居民信息已存在,请勿重复建档",-1);
                }else {//查询最近的一条建档记录
                }else {//该医生未对患者建档 查询最近的一条建档记录
                    archiveDO  = archiveDao.findByIdcard(idcard);
                    archiveDO  = archiveDao.findByIdcard(idcard);
                    return success(archiveDO);
                    if (archiveDO!=null){//有其他医生对其建档,返回最近建档信息,共前端同步
                        return success(archiveDO);
                    }
                    //其他医生对其建档 该医生对其建档
                }
                }
            }
            }
            archiveService.createArchive(patientDO,doctorId);
            archiveService.createArchive(patientDO,doctorId);

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/apply/PatientBedApplyService.java

@ -87,7 +87,7 @@ public class PatientBedApplyService extends BaseJpaService<PatientBedApplyDo, Pa
        List<Map<String,Object>> result = new ArrayList<>();
        List<Map<String,Object>> result = new ArrayList<>();
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorDO.getLevel()==2){//助老员
        if (doctorDO.getLevel()==2){//助老员
            List<BaseDoctorHospitalDO> hospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doctor);
            List<BaseDoctorHospitalDO> hospitalDOS = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
            for (BaseDoctorHospitalDO obj:hospitalDOS){
            for (BaseDoctorHospitalDO obj:hospitalDOS){
                String sql="select ap.id,p.id patientCode,p.name,p.sex,p.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_patient_bed_apply ap INNER JOIN base_patient p where ap.idcard = p.idcard and org_code='"+obj.getOrgCode()+"' " +
                String sql="select ap.id,p.id patientCode,p.name,p.sex,p.idcard,p.photo,ap.status,DATE_FORMAT(ap.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_patient_bed_apply ap INNER JOIN base_patient p where ap.idcard = p.idcard and org_code='"+obj.getOrgCode()+"' " +
                    "and ap.status <> -1 and ap.status<>0";
                    "and ap.status <> -1 and ap.status<>0";

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -51,7 +51,7 @@ public class DoctorMessageService {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"患者今年已做过能力评估报告,不可重复操作");
            result.put(ResponseContant.resultMsg,"患者今年已做过能力评估报告,不可重复操作");
        }
        }
        List<BaseDoctorHospitalDO> hospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctor);
        List<BaseDoctorHospitalDO> hospitalDO = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctor);
        Integer count;
        Integer count;
        if (typeNull||type.equals("10")){//床位申请-未完成
        if (typeNull||type.equals("10")){//床位申请-未完成
            JSONObject tmpJson = new JSONObject();
            JSONObject tmpJson = new JSONObject();

+ 7 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ArchiveService.java

@ -137,7 +137,9 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        patientDO.setCreateTime(new Date());
        patientDO.setCreateTime(new Date());
        patientDO.setUpdateTime(new Date());
        patientDO.setUpdateTime(new Date());
        patientDO.setPatientStatus("1");
        patientDO.setPatientStatus("1");
        patientDao.save(patientDO);
        if(!patientDao.existsByIdcardAndDel(idcard,"1")){
            patientDao.save(patientDO);
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        ArchiveDO archiveDO = new ArchiveDO();
        ArchiveDO archiveDO = new ArchiveDO();
@ -151,9 +153,9 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        archiveDao.save(archiveDO);
        archiveDao.save(archiveDO);
        //床位申请修改状态
        //床位申请修改状态
        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctorId);
        if (hospitalDOs.size()>0){
        if (hospitalDOs.size()>0){
            PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByPatientAndOrgCodeAndStatus(patientDO.getIdcard(),hospitalDOs.get(0).getOrgCode(),1);
            PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByIdcardAndOrgCodeAndStatus(patientDO.getIdcard(),hospitalDOs.get(0).getOrgCode(),1);
            if (bedApplyDo!=null){
            if (bedApplyDo!=null){
                bedApplyDo.setStatus(2);
                bedApplyDo.setStatus(2);
                patientBedApplyDao.save(bedApplyDo);
                patientBedApplyDao.save(bedApplyDo);
@ -178,9 +180,9 @@ public class ArchiveService extends BaseJpaService<ArchiveDO, ArchiveDao> {
        archiveDO.setCreateTime(new Date());
        archiveDO.setCreateTime(new Date());
        archiveDao.save(archiveDO);
        archiveDao.save(archiveDO);
        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorId);
        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findDistinctOrgByDoctorCode(doctorId);
        if (hospitalDOs.size()>0){
        if (hospitalDOs.size()>0){
            PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByPatientAndOrgCodeAndStatus(patientDO.getIdcard(),hospitalDOs.get(0).getOrgCode(),1);
            PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByIdcardAndOrgCodeAndStatus(patientDO.getIdcard(),hospitalDOs.get(0).getOrgCode(),1);
            if (bedApplyDo!=null){
            if (bedApplyDo!=null){
                bedApplyDo.setStatus(2);
                bedApplyDo.setStatus(2);
                patientBedApplyDao.save(bedApplyDo);
                patientBedApplyDao.save(bedApplyDo);

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

@ -385,7 +385,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        capacityAssessmentRecordDao.save(recordDO);
        capacityAssessmentRecordDao.save(recordDO);
        //完成评估 修改床位生请状态为已完成
        //完成评估 修改床位生请状态为已完成
        PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByPatientAndOrgCodeAndStatus(recordDO.getIdcard(),recordDO.getOrgCode(),2);
        PatientBedApplyDo bedApplyDo = patientBedApplyDao.findByIdcardAndOrgCodeAndStatus(recordDO.getIdcard(),recordDO.getOrgCode(),2);
        if (bedApplyDo!=null) {
        if (bedApplyDo!=null) {
            bedApplyDo.setStatus(0);
            bedApplyDo.setStatus(0);
            patientBedApplyDao.save(bedApplyDo);
            patientBedApplyDao.save(bedApplyDo);