wangjun 4 лет назад
Родитель
Сommit
169d89d99b

+ 0 - 6
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -469,12 +469,6 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }
    }
    public static void main(String[] args) {
        String ss ="561657600000";
        Date da = new Date(Long.parseLong(ss));
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(simpleDateFormat.format(da));
    }
    private static int getAgeByBirth(Date birthday) {
        int age = 0;
        try {

+ 7 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java

@ -15,11 +15,15 @@ import java.util.List;
 */
public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatientDO, String>, JpaSpecificationExecutor<WlyyOutpatientDO> {
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.status in(0,1)")
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType <> '3' and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and  a.outpatientType = '3' and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientAndDoctorList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType =?2 and a.status in(3) order by a.createTime desc ")
    List<WlyyOutpatientDO> findByPatientListByStatus(String patient,String outpatientType);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType <> '3' and a.status in(3) order by a.createTime desc ")
    List<WlyyOutpatientDO> findByPatientListByStatus(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = ?2  and a.status in(3) order by a.createTime desc ")
    List<WlyyOutpatientDO> findByPatientListByStatusAndType(String patient,String outpatientType);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.hisStatus=1 and a.createTime>=?2 and a.createTime<=?3")
    List<WlyyOutpatientDO> findByPatientListNoStatus(String patient,Date startDate,Date endDate);

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

@ -1140,18 +1140,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag,String outpatientType) throws Exception {
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        Map<String, Object> rs = new HashedMap();
        //1.余额判断改到前端判断
        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount");
        String accountControl = "0";
        if (null!=wlyyHospitalSysDictDO){
            accountControl = wlyyHospitalSysDictDO.getDictValue();
        }
        //1.判断
        //net.sf.json.JS余额判断改到前端ONObject json = entranceService.qutpatientBalance(cardNo,demoFlag);
        if (flag){
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByPatientListByStatus(patient,outpatientType);
                List<WlyyOutpatientDO> outpatientDOS = new ArrayList<>();
                if (StringUtils.isNotBlank(outpatientType)){
                    outpatientDOS = outpatientDao.findByPatientListByStatusAndType(patient,outpatientType);
                }else {
                    outpatientDOS = outpatientDao.findByPatientListByStatus(patient);
                }
                if (outpatientDOS!=null&&outpatientDOS.size()!=0){
                    WlyyOutpatientDO outpatientDO = outpatientDOS.get(0);
                    if (outpatientDO.getHisStatus()!=null){
                    if (outpatientDO.getHisStatus()!=null&&"0".equalsIgnoreCase(accountControl)){
                        logger.info("您上一次就诊进入"+outpatientDO.getHisStatus());
                        if(outpatientDO.getHisStatus()!=1&&outpatientDO.getHisStatus()!=-1){
                            logger.info("您上一次就诊进入======"+outpatientDO.getHisStatus());
@ -1169,7 +1178,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            return rs;
                        }
                    }else if (outpatientDO.getHisStatus()==null){
                    }else if (outpatientDO.getHisStatus()==null&&"0".equalsIgnoreCase(accountControl)){
                        rs.put("outpatient", outpatientDO);
                        rs.put("code", -3);
                        rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。");
@ -1187,16 +1196,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        //2.判断是否有未结束的
        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
        List<WlyyOutpatientDO> list = new ArrayList<>();
        if(StringUtils.isNotBlank(outpatientType)&&outpatientType.equalsIgnoreCase("3")){
            list = outpatientDao.findByPatientAndDoctorList(patient);
        }else{
            list = outpatientDao.findByPatientList(patient);
        }
        if (list != null && list.size() > 0) {
            rs.put("outpatient", list.get(0));
            rs.put("code", -2);
            rs.put("mes", "存在未结束的诊断");
            return rs;
            if(!list.get(0).getOutpatientType().equalsIgnoreCase("3")){
                rs.put("outpatient", list.get(0));
                rs.put("code", -2);
                rs.put("mes", "存在未结束的诊断");
                return rs;
            }else {
                rs.put("outpatient", list.get(0));
                rs.put("code", -2);
                rs.put("mes", "存在未结束的咨询");
                return rs;
            }
        }
        rs.put("code", 1);
        rs.put("mes", "验证通过");
@ -4520,7 +4539,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " AND room.reservation_type=2 ";
        } else if (4==type){
            //专家咨询
            sql += " AND room.reservation_type=2 AND room.consult_type in (1,2,3)";
            sql += " AND room.reservation_type=3 AND room.consult_type in (1,2,3)";
        } else {
            //在线复诊
            sql += " AND room.reservation_type=1 AND room.consult_type=" + type;
@ -4569,8 +4588,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                       if (StringUtils.isNotBlank(basePatientDO.getIdcard())){
                           patientAge = DateUtil.getAgeForIdcard(basePatientDO.getIdcard());
                           outpatient.put("patientAge", DateUtil.getAgeForIdcard(basePatientDO.getIdcard()));
                           patientSex =basePatientDO.getSex();
                       }
                       patientSex =basePatientDO.getSex();
                   }
                }
                outpatient.put("patientAge", patientAge);
@ -5975,7 +5994,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND outpatient.type= 2 and outpatient.outpatient_type ="+outpatientType;
        }else {
            sql+="AND room.consult_type= 2 ";
            sql+=" AND room.consult_type= 2 ";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){

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

@ -202,7 +202,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                businessOrderDO.setOrderType(1);
                businessOrderDO.setOrderCategory("1");
            } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
                businessOrderDO.setOrderType(3);
                businessOrderDO.setOrderType(17);
                businessOrderDO.setOrderCategory("1");
            }
        }else {

+ 54 - 6
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -743,11 +743,22 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
            WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
            String changeflag="0";
            if(null!=changeMethod){
                changeflag = changeMethod.getDictValue();
            }
            if (businessOrderDO!=null){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                    consultDo.setPayStatus(1);
                    consultOrderDao.save(consultDo);
                    if ("0".equalsIgnoreCase(changeflag)){
                        ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                        consultDo.setPayStatus(1);
                        consultOrderDao.save(consultDo);
                    }else {
                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                        wlyyOutpatientDO.setPayStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                    }
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
@ -1116,13 +1127,50 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    public BusinessOrderDO updatePayStatus(String orderNo) throws Exception {
        logger.info("入参:"+orderNo);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
        if(null!=changeMethod){
            changeflag = changeMethod.getDictValue();
        }
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
           ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
           consultDo.setPayStatus(1);
           consultOrderDao.save(consultDo);
            if ("0".equalsIgnoreCase(changeflag)){
                ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                consultDo.setPayStatus(1);
                consultOrderDao.save(consultDo);
            }else {
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                wlyyOutpatientDO.setPayStatus(1);
                WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
                //发送企业模板消息给医生
                BasePatientDO patientDO = new BasePatientDO();
                patientDO = patientDao.findById(outpatientDO.getPatient());
                String msg = "";
                String name=outpatientDO.getPatientName();
                String sex = "";
                String age="";
                String date = "";
                String title = "";
                String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                if (patientDO!=null){
                    sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                    age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
                }
                if (outpatientDO!=null){
                    if (outpatientDO.getType().equalsIgnoreCase("1")){
                        title = "图文咨询";
                        msg = name+"("+sex+" "+age+"岁)向您发起了图文咨询,点击查看";
                    }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                        title = "视频咨询";
                        date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                        msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频咨询,点击查看";
                    }
                }
                enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                System.out.println("发送企业模板消息成功");
            }
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
           WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
           wlyyOutpatientDO.setPayStatus(1);

+ 4 - 4
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -244,10 +244,6 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    public Boolean updatePatientPw(String id,String pw,String orgPw){
        BasePatientDO patientDO = basePatientDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        //认证信息设置
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            String response =ykyyService.updatePatientPassword(patientDO.getMobile(),pw,"");
@ -263,6 +259,10 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
                return true;
            }
        }
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        String salt = randomString(5);
        patientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        patientDO.setSalt(salt);

+ 46 - 3
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -326,6 +326,33 @@ public class ImService {
		logger.info("未结束判断语句"+totalSql+"======consultCode"+consultCode);
		return consultCode;
	}
	/**
	 * 查询居民与某个医生未结束的专家咨询
	 *
	 * @param patient 居民
	 * @param doctor  医生
	 * @return
	 */
	public String  getUnfinishedConsult2(String patient, String doctor) {
		String totalSql = "SELECT a.id as \"consultCode\" " +
				"FROM wlyy_outpatient a " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND a.doctor='" +doctor+"' "+
				"AND a.type in (1,2 )" +
				"AND a.status in (0,1)" +
				"AND a.outpatient_type = 3";
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String consultCode = null;
		if (rstotal != null && rstotal.size() > 0) {
			consultCode = rstotal.get(0).get("consultCode").toString();
		}
		logger.info("未结束判断语句"+totalSql+"======consultCode"+consultCode);
		return consultCode;
	}
	/**
	 * 根据咨询Code,查询咨询详情
@ -1397,7 +1424,11 @@ public class ImService {
		// 查询患者信息
		BasePatientDO p = basePatientDao.findById(patient);
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("title", p.getName() + "申请复诊");
		if("3".equals(wlyyOutpatientDO.getOutpatientType())){
			jsonObject.put("title", p.getName() + "申请咨询");
		}else{
			jsonObject.put("title", p.getName() + "申请复诊");
		}
		jsonObject.put("content",wlyyOutpatientDO.getDescription());
		jsonObject.put("age",DateUtil.getAgeForIdcard(p.getIdcard()));
		jsonObject.put("sex",p.getSex());
@ -1420,7 +1451,6 @@ public class ImService {
			users.put(wlyyOutpatientDO.getGeneralDoctor(),0);
			ct.setType(12);
			consultTitle = "申请协同门诊";
			JSONObject consultName = new JSONObject();
			consultName.put("patientName",p.getName());
			consultName.put("doctorName",doctor.getName());
@ -1500,7 +1530,7 @@ public class ImService {
		}else if("3".equals(wlyyOutpatientDO.getOutpatientType())){
			messages = imUtil.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(), doctorCode);
			//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+9(图文,视频,图文+视频)
			//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+1,17.15图文,视频,家医
			sessionId = patient + "_" + outpatientCode + "_" + ct.getType();
			if("1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
@ -3635,6 +3665,19 @@ public class ImService {
		}
		return consultCount;
	}
	public Long doctorConsultsNew(String doctorCode){
		String sql=  "SELECT count(1) AS \"total\"  " +
				" FROM wlyy_outpatient a " +
				" WHERE a.outpatient_type = 3 " +
				" AND b.doctor='" + doctorCode + "' AND a.type in (1,2,3) and a.status in (0,1) and a.pay_status=1" +
				" ORDER BY a.create_time desc ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long consultCount = 0l;
		if (rstotal != null && rstotal.size() > 0) {
			consultCount = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		return consultCount;
	}
	/**
	 * 医生待办事项列表
	 * @param doctorCode

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

@ -873,6 +873,8 @@ public class BaseHospitalRequestMapping {
    
        //查询居民与某个医生是否存在未结束的咨询
        public static final String isExistsUnfinishedConsult ="/isExistsUnfinishedConsult";
        //查询居民与某个医生是否存在未结束的咨询
        public static final String isExistsUnfinishedOutpatient ="/isExistsUnfinishedOutpatient";
        
        //获取会话成员
        public static final String participants ="/participants";
@ -1019,6 +1021,8 @@ public class BaseHospitalRequestMapping {
        //医生端:进行中的专家咨询人数
        public static final String doctorSpecialistConsultCountNew="doctorSpecialistConsultCountNew";
        //医生端:进行中的专家咨询人数
        public static final String doctorSpecialistConsultCountNew2="doctorSpecialistConsultCountNew2";
    
        //医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量
        public static final String doctorReviewConsultCount="doctorReviewConsultCount";

+ 9 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -821,6 +821,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("zjCount",imService.doctorConsults(doctor));//专家咨询数量
		return success("请求成功",result);
	}
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorSpecialistConsultCountNew2)
	@ApiOperation(value = "医生端:进行中的专家咨询数量", notes = "医生端:进行中的专家咨询数量")
	public Envelop doctorSpecialistConsultCountNew2(@ApiParam(name = "doctor", value = "医生CODE")
												   @RequestParam(value = "doctor",required = true) String doctor){
		//专家咨询
		JSONObject result = new JSONObject();
		result.put("zjCount",imService.doctorConsultsNew(doctor));//专家咨询数量
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorReviewConsultCount)
	@ApiOperation(value = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量", notes = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量")

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

@ -237,6 +237,21 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		String consultCode = imService.getUnfinishedConsult(patient, doctor);
		return success("请求成功",consultCode);
	}
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedOutpatient)
	@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
	public Envelop isExistsUnfinishedOutpatient(
			@ApiParam(name = "doctor", value = "医生CODE")
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
		if(StringUtils.isEmpty(patient)){
			patient= getUID();
		}
		String consultCode = imService.getUnfinishedConsult2(patient, doctor);
		return success("请求成功",consultCode);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.participants)
	@ApiOperation(value = "获取会话成员")

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -266,7 +266,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "patient", required = true)String patient,
                                      @ApiParam(name = "flag", value = "标识是否开启结算")
                                      @RequestParam(value = "flag", required = false)boolean flag,
                                      @ApiParam(name = "outpatientType", value = "1:在线问诊;2协同;3专家咨询")
                                      @ApiParam(name = "outpatientType", value = "1在线复诊 2 协同 3 专家咨询")
                                          @RequestParam(value = "outpatientType", required = false)String outpatientType)throws Exception{
        return success(prescriptionService.checkOutpatient(patient,wxId,flag,outpatientType));
    }