Browse Source

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

wangzhinan 4 years ago
parent
commit
a530ba3937

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

@ -6660,6 +6660,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("photo", basePatientDO.getPhoto());
        rs.put("address", basePatientDO.getAddress());
        rs.put("cardType",basePatientDO.getCardType());
        rs.put("healthStatus","");
        rs.put("diseaseType","");
        if (patientMedicareCardDO != null) {
            rs.put("ssc", patientMedicareCardDO.getCode());
        } else {
@ -6957,7 +6959,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return waitCount.toString();
    }
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord) {
    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord,String patientId) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){
@ -7010,12 +7012,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+="  AND room.consult_type= 2 and room.reservation_type in (1,2)";
        } else if (StringUtils.isNotBlank(outpatientType)&&"4".equalsIgnoreCase(outpatientType)) {
            sql+="  AND room.consult_type= 2 and room.reservation_type = 3";
        } else {
        } else if (StringUtils.isNotBlank(outpatientType)&&"2".equalsIgnoreCase(outpatientType)) {
            sql+="  and room.reservation_type = 2 ";
        }else {
            sql += " AND room.consult_type= 2 ";
        }
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND outpatient.patient_name like '%"+keyWord+"%'";
        }
        if (StringUtils.isNotBlank(patientId)){
            sql += " AND room.patient_id = '"+patientId+"'";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){
                sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
@ -12072,7 +12079,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
        sql += " order by t.appointment_time desc ";
        sql += " order by t.create_time desc ";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, pageSize);
        List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sql);
        logger.info("查询数据" + sql);

+ 8 - 9
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1360,7 +1360,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")&&businessOrderDO.getStatus()==0){
            if ("0".equalsIgnoreCase(changeflag)){
                ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                consultDo.setPayStatus(1);
@ -1396,7 +1396,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                }
                if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                    String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                }else if(wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1405,7 +1405,6 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
                }
                System.out.println("发送企业模板消息成功");
                try {
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
@ -1428,7 +1427,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
           }catch (Exception e){
               e.printStackTrace();
           }
           if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
           if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()==0){
               //发送企业模板消息给医生
               BasePatientDO patientDO = new BasePatientDO();
               patientDO = patientDao.findById(outpatientDO.getPatient());
@ -1456,7 +1455,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                   }
               }
               if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                       String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
               }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                   String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1516,7 +1515,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                wlyyOutpatientDO.setPayStatus(1);
                WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
                if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
                if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()==0){
                    //发送企业模板消息给医生
                    BasePatientDO patientDO = new BasePatientDO();
                    patientDO = patientDao.findById(outpatientDO.getPatient());
@ -1541,7 +1540,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        }
                    }
                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                        String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                    }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                        String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1561,7 +1560,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
            if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
            if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()==0){
                //发送企业模板消息给医生
                BasePatientDO patientDO = new BasePatientDO();
                patientDO = patientDao.findById(outpatientDO.getPatient());
@ -1587,7 +1586,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                }
                if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                    String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                    String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();

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

@ -73,7 +73,7 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    @Autowired
    private ObjectMapper objectMapper;
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired

+ 23 - 3
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -7,12 +7,15 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseTokenDO;
import com.yihu.jw.entity.hospital.enterprise.WxEnterpriseUserDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseDao;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseTokenDao;
import com.yihu.jw.wechat.enterprise.dao.WxEnterpriseUserDao;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,6 +50,8 @@ public class EnterpriseService {
    private WxEnterpriseDao wxEnterpriseDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    public String getToken(String enterpriseId)throws Exception{
@ -169,15 +174,30 @@ public class EnterpriseService {
        }
        return "";
    }
    public String sendTWMesByDoctor(String enterpriseId,String doctor,String title,String description,String url)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        String res = "";
        if(baseDoctorDO!=null&&StringUtils.isNotBlank(baseDoctorDO.getMobile())){
            WxEnterpriseUserDO user = wxEnterpriseUserDao.findByEnterpriseIdAndMobile(enterpriseId,baseDoctorDO.getMobile());
            if(user!=null){
                return sendTWMes(enterpriseId,user.getUserid(),title,description,url);
                res =sendTWMes(enterpriseId,user.getUserid(),title,description,url);
                try {
                    if (StringUtils.isNoneBlank(url)){
                        String outPatientId = url.substring(url.lastIndexOf("=")+1,url.length());
                        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                        wlyyHttpLogDO.setDoctor(doctor);
                        wlyyHttpLogDO.setRequest(url);
                        wlyyHttpLogDO.setName(title);
                        wlyyHttpLogDO.setCode(outPatientId);
                        wlyyHttpLogDO.setRequest("enterpriseId:"+enterpriseId+",doctor:"+doctor+",url:"+url);
                        wlyyHttpLogDO.setResponse(res);
                        wlyyHttpLogDao.save(wlyyHttpLogDO);
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
                return res;
            }
        }
        return "";

+ 5 - 2
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -16,6 +16,7 @@ import com.yihu.jw.es.util.SaveModel;
import com.yihu.jw.evaluate.score.service.BaseEvaluateScoreService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -55,6 +56,8 @@ public class StatisticsEsService {
    private BaseCityDao cityDao;
    @Autowired
    private BaseEvaluateScoreService baseEvaluateScoreService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.id}")
    private String wxId;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -1265,8 +1268,8 @@ public class StatisticsEsService {
        }else if (flag ==2) {
            List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, null, "6");
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where hd.ORG_CODE ='" + area + "' and CONSULT_DEPT_FLAG=1";
            List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
            String deptSql = "select hd.CODE as \"code\",hd.NAME as \"name\" from DICT_HOSPITAL_DEPT hd where hd.ORG_CODE ='" + area + "' and hd.CONSULT_DEPT_FLAG=1";
            List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(deptSql);
            List<JSONObject> result = new ArrayList<>();
            for (SaveModel saveModel : saveModels) {
                List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = doctorHospitalDao.findByDoctorCode(saveModel.getDoctor());

+ 8 - 13
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4505,10 +4505,8 @@ public class ImService {
				"  t.name as \"name\"," +
				"  t.idcard as \"idcard\"," +
				"  t.mobile as \"mobile\"," +
				"  op.doctor as \"doctor\"," +
				"  op.doctor_name as \"doctorName\"," +
				"  op.outpatient_type as \"outpatientType\"" +
				" from base_patient t left join wlyy_outpatient op " +
				"  op.doctor as \"doctor\"" +
				" from wlyy_outpatient op left join base_patient t " +
				" on t.id = op.patient where t.del ='1' and op.status!= -1";
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
			sql+=" and op.doctor = '"+doctor+"'";
@ -4546,19 +4544,17 @@ public class ImService {
		return list;
	}
	@Transactional(readOnly = true)
	public List<Map<String,Object>>  findRecordCountByDoctor(String doctor,
	public Map<String,Object>  findRecordCountByDoctor(String doctor,
														String type, String patientIdCard,String patientName) {
		String[] outpatientType = type.split(",");
		List<Map<String,Object>> resultList = new ArrayList<>();
		Map map = new HashMap();
		for (int i=0;i<outpatientType.length;i++){
			String  sql = "select DISTINCT t.id as \"id\"," +
					"  t.name as \"name\"," +
					"  t.idcard as \"idcard\"," +
					"  t.mobile as \"mobile\"," +
					"  op.doctor as \"doctor\"," +
					"  op.doctor_name as \"doctorName\"," +
					"  op.outpatient_type as \"outpatientType\"" +
					" from base_patient t left join wlyy_outpatient op " +
					"  op.doctor as \"doctor\"" +
					" from wlyy_outpatient op left join  base_patient t " +
					" on t.id = op.patient where t.del ='1' and op.status!= -1";
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
				sql+=" and op.doctor = '"+doctor+"'";
@ -4571,7 +4567,7 @@ public class ImService {
			}
			//咨询类型
			String mapKey = "";
			Map map = new HashMap();
			if(!StringUtils.isEmpty(outpatientType[i])){
				if (outpatientType[i].equalsIgnoreCase("1")){
					sql +=" AND  op.outpatient_type = 1";
@ -4590,11 +4586,10 @@ public class ImService {
				List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql);
				map.put(mapKey,list==null?0:list.size());
			}
			resultList.add(map);
		}
		return resultList;
		return map;
	}
}

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

@ -603,9 +603,11 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "type", value = "1在线复诊2协同3专家咨询")
			@RequestParam(value = "type",required = false) String type,
            @ApiParam(name = "keyWord", value = "病人姓名")
            @RequestParam(value = "keyWord",required = false) String keyWord
            @RequestParam(value = "keyWord",required = false) String keyWord,
			@ApiParam(name = "patient", value = "病人id")
			@RequestParam(value = "patient",required = false) String patient
            )throws Exception{
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor,wxId,type,keyWord));
		return success("请求成功",prescriptionService.getWaitingForVisitVideoPrescriptionByDoctor(doctor,wxId,type,keyWord,patient));
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.pickVideoPrescripitonWaitingPeople)
@ -1277,7 +1279,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public ObjEnvelop findRecordByDoctor(@ApiParam(name = "doctor", value = "医生id")
											 @RequestParam(value = "doctor",required = false) String doctor,
										 @ApiParam(name = "type", value = "咨询类型")
											 @RequestParam(value = "type",required = true) String type,
											 @RequestParam(value = "type",required = false) String type,
										 @ApiParam(name = "patientName", value = "patientName")
											 @RequestParam(value = "patientName",required = false) String patientName,
										 @ApiParam(name = "idcard", value = "idcard")
@ -1296,13 +1298,13 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public ObjEnvelop findRecordCountByDoctor(@ApiParam(name = "doctor", value = "医生id")
										 @RequestParam(value = "doctor",required = false) String doctor,
										 @ApiParam(name = "type", value = "咨询类型多个用逗号隔开")
										 @RequestParam(value = "type",required = true) String type,
										 @RequestParam(value = "type",required = false) String type,
										 @ApiParam(name = "patientName", value = "patientName")
										 @RequestParam(value = "patientName",required = false) String patientName,
										 @ApiParam(name = "idcard", value = "idcard")
										 @RequestParam(value = "idcard",required = false) String idcard)throws Exception {
		List<Map<String,Object>> list = imService.findRecordCountByDoctor(doctor,type,idcard,patientName);
		return ObjEnvelop.getSuccess("操作成功",list);
		return ObjEnvelop.getSuccess("操作成功",imService.findRecordCountByDoctor(doctor,type,idcard,patientName));
	}
}