Browse Source

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

huangwenjie 5 years ago
parent
commit
5fa52ced4f

+ 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);
}

+ 4 - 1
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -479,7 +479,10 @@ public class WlyyBusinessService {
                                doctor.setCityName(doctorJson.getString("cityName"));
                                doctor.setExpertise(doctorJson.getString("expertise"));
                                doctor.setIntroduce(doctorJson.getString("introduce"));
//                                String salt = randomString(5);
//                                String pw = idcard.substring(idcard.length() - 6);
//                                doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
//                                doctor.setSalt(salt);
                                String jobName = doctorJson.getString("jobName");
                                doctor.setJobTitleCode(getDutysCode(dutys, jobName));

+ 18 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -704,5 +704,23 @@ public class ImUtil {
			return 0;
		}
	}
	
	/**
	 *按会话类型获取会话总数
	 * @param userid
	 * @param type
	 * @param status
	 * @return
	 */
	public Integer SessionsUnreadMessageCount(String userid,Integer type){
		String url = im_host + "api/v2//sessions/unread_message_count?user_id="+userid;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
		if(obj.getInteger("status") ==200){
			return obj.getInteger("count");
		}else{
			return 0;
		}
	}
}

+ 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("操作成功!");
	}
}

+ 4 - 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,
@ -200,6 +200,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            Integer zjCount = imService.sessionCountByType(doctor.getId(),1,0);
            //全科医生求助专科
            Integer zjqzCount = imService.sessionCountByType(doctor.getId(),15,0);
    
            //专家咨询
//            Integer unreadMessageCount = imService.sessionCountByType(doctor,1,0);
            result.put("zjCount",zjCount+zjqzCount);//专家咨询数量
        }else{
            result.put("zjCount",0);//专家咨询数量