Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

huangwenjie 5 rokov pred
rodič
commit
3f6a4137be

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java

@ -16,7 +16,7 @@ public interface DoctorWorkTimeDao extends PagingAndSortingRepository<WlyyDoctor
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.endTime > ?2 and a.endTime < ?3 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTime(String doctor, Date startTime, Date endTime);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.workDate like ?2 order by a.startTime asc")
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.date like ?2 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTimeByMonth(String doctor, String date);
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.startTime >= ?2 and a.startTime <= ?3 order by a.startTime asc")

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

@ -242,7 +242,7 @@ public class WorkTimeService {
        String workDate = date+"-"+day;
        logger.info("workDate:"+workDate);
        workTimeDO.setWorkDate(workDate);
        workTimeDO.setDate(workDate);
        workTimeDO.setCreateTime(new Date());
        //上午

+ 30 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -3,6 +3,7 @@ package com.yihu.jw.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxPayLogDO;
@ -16,6 +17,7 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
import com.yihu.jw.order.dao.ConsultDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -64,6 +66,9 @@ public class BusinessOrderService {
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private ConsultDao consultDao;
    /**
@ -77,6 +82,13 @@ public class BusinessOrderService {
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setUploadStatus(0);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/zjzx");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/consult");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/twzs");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/review");
        }
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
@ -433,6 +445,7 @@ public class BusinessOrderService {
    public Map<String,String> getWxPayResultNotify(String result) {
        Map<String,String> rs = new HashedMap();
        Map<String,Object> wxrs =  XMLUtil.xmltoMap(result);
        logger.info("回调参数");
        if("SUCCESS".equals(wxrs.get("return_code").toString())){
            // 我方 订单号+时间差
            String seqNo = wxrs.get("out_trade_no")+"";
@ -445,6 +458,13 @@ public class BusinessOrderService {
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(seqNo);
            businessOrderDO.setPayTime(DateUtil.strToDate(timeEnd,DateUtil.YYYY_MM_DD_HH_MM_SS));
            businessOrderDO.setStatus(1);
            if (businessOrderDO!=null){
                if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
                    ConsultDo consultDo = consultDao.findOne(businessOrderDO.getRelationCode());
                    consultDo.setPayStatus(1);
                    consultDao.save(consultDo);
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
            //操作微信日志表记录
            List<WxPayLogDO> wxPayLogDOs = wxPayLogDao.findBySeqNo(seqNo);
@ -480,7 +500,16 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,doctorMappingDO.getMappingCode(),payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
            }
        }
        String response = ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        return response;
    }

+ 30 - 0
business/base-service/src/main/java/com/yihu/jw/order/dao/ConsultDao.java

@ -0,0 +1,30 @@
package com.yihu.jw.order.dao;
import com.yihu.jw.entity.base.im.ConsultDo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 咨询表DAO类
 * @author huangwenjie
 */
public interface ConsultDao extends PagingAndSortingRepository<ConsultDo, String>, JpaSpecificationExecutor<ConsultDo> {
	
//	@Query("from ConsultDo a where a.relationCode = ?1")
//	ConsultDo findByRelationCode(String outpatientid);
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, String id, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	Page<Object> findByPatient(String patient, String title, PageRequest pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.id < ?2 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, String id, Pageable pageRequest);
//
//	// 查询患者咨询记录
//	@Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.team,b.evaluate,a.signCode  from ConsultDo a,ConsultTeamDo b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.type<>8 order by a.czrq desc")
//	Page<Object> findByPatient(String patient, Pageable pageRequest);
}

+ 28 - 18
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -45,6 +45,7 @@ import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
@ -157,6 +158,9 @@ public class ImService {
	
	@Autowired
	private StringRedisTemplate redisTemplate;
	@Autowired
	private HibenateUtils hibenateUtils;
	
	
	
@ -170,35 +174,36 @@ public class ImService {
	 * @param status 状态
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status) {
	public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,Integer payStatus) {
		if(page >=1){
	/*	if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		}*/
		
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS doctorName," +
				"d.photo AS doctorphoto," +
				"d.job_title_name AS jobTitleName, " +
				"h.dept_name AS deptName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"doctorName\"," +
				"d.photo AS \"doctorphoto\"," +
				"d.job_title_name AS \"jobTitleName\", " +
				"h.dept_name AS \"deptName\" " +
				"a.pay_status AS \"payStatus\","+
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d, " +
				"base_doctor_hospital h " +
				"WHERE a.id=b.consult and d.id = h.doctor_code " +
				"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+")";
		List<ConsultVO> result = new ArrayList<>();
		/*List<ConsultVO> result = new ArrayList<>();*/
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
@ -219,10 +224,13 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		if (!StringUtils.isEmpty(payStatus)) {
			sql += " and a.pay_status = " + payStatus + "";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
		/*result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));*/
		return result;
	}
	
@ -938,6 +946,7 @@ public class ImService {
		re.put("patient",patient);
		re.put("patientName",tempPatient.getName());
		re.put("patient_idcard",tempPatient.getIdcard());
		re.put("consult",consult.getId());
		return re;
		
	}
@ -959,6 +968,7 @@ public class ImService {
		consult.setSymptoms(symptoms);
		consult.setImages(images);
		consult.setType(type);
		consult.setPayStatus(0);
		return consultDao.save(consult);
	}
	

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultDo.java

@ -36,6 +36,8 @@ public class ConsultDo extends UuidIdentityEntity {
	private Date endTime;
	//关联业务表的code
	private String relationCode;
	//支付状态
	private Integer payStatus;
	
	public String getPatient() {
		return patient;
@ -117,4 +119,12 @@ public class ConsultDo extends UuidIdentityEntity {
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
	public Integer getPayStatus() {
		return payStatus;
	}
	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}
}

+ 17 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -1,7 +1,9 @@
package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
@ -72,6 +74,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Value("${iHealth.user-info-uri}")
    private String iHealthUserInfoUrl;//失败重试次数
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private ClientDetailsService clientDetailsService;
@ -574,7 +579,18 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    }
    public void updateOpenIdAndWechatId(String openid, String userId,String wechatId) {
        this.getJdbcTemplate().update("update base_patient_wechat p set p.openid = ? where p.patient_id= ? and p.wechat_id", openid, userId,wechatId);
        List<BasePatientWechatDo> patientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,userId);
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){
            this.getJdbcTemplate().update("update base_patient_wechat p set p.openid = ? where p.patient_id= ? and p.wechat_id= ? ", openid, userId,wechatId);
        }else {
            BasePatientWechatDo basePatientWechatDo=new BasePatientWechatDo();
            basePatientWechatDo.setCreateTime(new Date());
            basePatientWechatDo.setOpenid(openid);
            basePatientWechatDo.setPatientId(userId);
            basePatientWechatDo.setWechatId(wechatId);
            basePatientWechatDao.save(basePatientWechatDo);
        }
    }
    public String getSynPath(String wxId){

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

@ -8,10 +8,12 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.im.ConsultVO;
@ -86,6 +88,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	FileUploadService fileUploadService;
	@Autowired
	private BusinessOrderService businessOrderService;
	
	public FileUtil fileUtil;
	
@ -100,6 +105,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	@Value("${qywx.id}")
	private String qywxId;
	@Value("${wechat.id}")
	private String wxId;
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
@ -114,15 +122,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@RequestParam(value = "type",required = true) String type,
								@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
								@RequestParam(value = "status",required = false) Integer status,
								@ApiParam(name = "payStatus", value = "支付状态0支付1已支付")
								@RequestParam(value = "payStatus",required = false) Integer payStatus,
								@ApiParam(name = "page", value = "第几页")
								@RequestParam(value = "page",required = false) int page,
								@ApiParam(name = "pagesize", value = "分页大小")
								@RequestParam(value = "pagesize",required = false) int pagesize
								)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status);
		List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus);
		
		if (data != null) {
		/*if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
@ -152,7 +162,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				
				array.add(json);
			}
		}
		}*/
		
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		
@ -412,9 +422,30 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			hospitalSystemMessageService.saveMessage(systemMessageDO);
			BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			//眼科支付订单
			if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
				if (type==1||type==2){
					BusinessOrderDO businessOrderDO = new BusinessOrderDO();
					businessOrderDO.setDoctor(doctor);
					businessOrderDO.setPatient(patient);
					businessOrderDO.setPatientName(re.getString("patientName"));
					businessOrderDO.setDescription("专家咨询费");
					businessOrderDO.setOrderCategory("1");
					if (type==1){
						businessOrderDO.setOrderType(1);
					}else if (type==17){
						businessOrderDO.setOrderType(3);
						businessOrderDO.setRelationCode(re.getString("consult"));
						businessOrderDO.setRelationName("新增专家咨询");
					}
					businessOrderService.saveOrder(businessOrderDO);
				}
			}
			//发送企业号推送
			try{