Pārlūkot izejas kodu

医生列表增加关注状态

huangwenjie 5 gadi atpakaļ
vecāks
revīzija
24c32429df

+ 25 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -8,6 +8,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
@ -37,6 +38,7 @@ import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
@ -155,6 +157,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private SystemMessageService systemMessageService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDoctorPatientFollowDao baseOrgPatientDao;
    @Value("${demo.flag}")
@ -2927,7 +2931,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param consutlSort
     * @return
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String orgCode, String dept,
    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept,
                                                                          String diseaseKey, String doctorNameKey,
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
@ -2954,10 +2958,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.outpatient_type AS outpatientType," +
                " a.total as consultTotal," +
                " h.org_name as orgName," +
                " follow.patient as followid," +
                " h.org_code as orgCode" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
                " Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient='"+patientid+"'"+
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
                
        if(StringUtils.isNotBlank(workingTime)){
@ -4394,4 +4400,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return list;
    }
    
    public void followOrgByPatient(String patientid, String doctorid, String type) {
        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(patientid,doctorid);
        if("1".equals(type)){//关注
            if(list.isEmpty()){
                BaseDoctorPatientFollowDO baseOrgPatientFollowDO = new BaseDoctorPatientFollowDO();
                baseOrgPatientFollowDO.setDoctor(doctorid);
                baseOrgPatientFollowDO.setPatient(patientid);
                baseOrgPatientDao.save(baseOrgPatientFollowDO);
            }
        }else if("0".equals(type)){//取消关注
            if(!list.isEmpty()){
                for (BaseDoctorPatientFollowDO baseOrgPatientFollowDO:list){
                    baseOrgPatientDao.delete(baseOrgPatientFollowDO.getId());
                }
            }
        }else{}
    }
}

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BaseDoctorPatientFollowDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author huangwenjie
 * @date 2020/3/9 09:57
 */
public interface BaseDoctorPatientFollowDao extends PagingAndSortingRepository<BaseDoctorPatientFollowDO, String>, JpaSpecificationExecutor<BaseDoctorPatientFollowDO> {
	
	List<BaseDoctorPatientFollowDO> findByDoctorAndPatient(String doctor, String patient);
}

+ 38 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseDoctorPatientFollowDO.java

@ -0,0 +1,38 @@
package com.yihu.jw.entity.base.org;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 居民医院关注列表
 * @author huangwenjie
 * @date 2020/3/9 09:39
 */
@Entity
@Table(name = "base_doctor_patient_follow")
public class BaseDoctorPatientFollowDO extends UuidIdentityEntity {
	
	private String patient;
	
	private String doctor;
	
	
	public String getPatient() {
		return patient;
	}
	
	public void setPatient(String patient) {
		this.patient = patient;
	}
	
	public String getDoctor() {
		return doctor;
	}
	
	public void setDoctor(String doctor) {
		this.doctor = doctor;
	}
}

+ 5 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -92,6 +92,11 @@ public class BaseHospitalRequestMapping {
         */
        public static final String findDoctorByHospitalAndDiseaseAndDept = "/findDoctorByHospitalAndDiseaseAndDept";
    
        /**
         * 居民关注医院
         */
        public static final String followOrgByPatient = "/followOrgByPatient";
    
        /**
         * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
         */

+ 18 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -283,6 +283,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
	public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "机构code")
																 @RequestParam(value = "iswork", required = false)String iswork,
	                                                         @ApiParam(name = "patientid", value = "居民ID")
	                                                         @RequestParam(value = "patientid", required = false)String patientid,
			                                       @ApiParam(name = "orgCode", value = "机构code")
	                                               @RequestParam(value = "orgCode", required = false)String orgCode,
	                                               @ApiParam(name = "dept", value = "部门code")
@ -312,7 +314,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	) throws Exception{
		logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
		return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,
		return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
				orgCode,dept,
				diseaseKey,doctorNameKey,
				jobTitleNameKey,outpatientType,
@ -611,4 +613,19 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		return success("查询成功",imService.getDoctorConsultCount(doctorids));
		
	}
	
	
	@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
	@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
	public Envelop followOrgByPatient(
			@ApiParam(name = "patientid", value = "发送者id", defaultValue = "")
			@RequestParam(value = "patientid", required = true) String patientid,
			@ApiParam(name = "orgid", value = "发送者姓名", defaultValue = "")
			@RequestParam(value = "orgid", required = true) String orgid,
			@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
			@RequestParam(value = "type", required = true) String type
	)throws Exception{
		prescriptionService.followOrgByPatient(patientid,orgid,type);
		return success("操作成功!");
	}
}

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -87,7 +87,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(null,
        return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(null,null,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,