Przeglądaj źródła

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

zdm 5 lat temu
rodzic
commit
1f2d0e58d1

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

@ -19,4 +19,6 @@ public interface DoctorWorkTimeDao extends PagingAndSortingRepository<WlyyDoctor
    @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")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTimeByTime(String doctor, Date startDate,Date endDate);
}

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

@ -958,7 +958,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String serialNo = (String)rs.get("serial_no");
            outpatientDO.setRegisterNo(serialNo);
            String conNo = (String)rs.get("@times");
            outpatientDO.setCardNo(conNo);
            outpatientDO.setConNo(conNo);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
@ -2034,11 +2034,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    
        if(StringUtils.isNotBlank(jobTitleNameKey)){
            sql+=" AND d.job_title_name AS = '"+jobTitleNameKey+"' ";
            sql+=" AND d.job_title_name  = '"+jobTitleNameKey+"' ";
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND d.outpatient_type AS = '"+outpatientType+"' ";
            sql+=" AND d.outpatient_type = '"+outpatientType+"' ";
        }
    
        if(StringUtils.isNotBlank(keyName)){
@ -2225,10 +2225,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param date
     * @return
     */
    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTimeByMonth(String doctor,String date){
        List<WlyyDoctorWorkTimeDO> times = doctorWorkTimeDao.findDoctorWorkTimeByMonth(doctor,"%"+date+"%");
        List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
        return convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class);
    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTimeByMonth(String doctor,String date,String startDate,String endDate){
        if(StringUtils.isNotBlank(date)){
            List<WlyyDoctorWorkTimeDO> times = doctorWorkTimeDao.findDoctorWorkTimeByMonth(doctor,"%"+date+"%");
            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
            return convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class);
        }else{
            List<WlyyDoctorWorkTimeDO> times = doctorWorkTimeDao.findDoctorWorkTimeByTime(doctor,DateUtil.stringToDate(startDate+" 00:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate+" 23:59:59","yyyy-MM-dd HH:mm:ss"));
            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
            return convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class);
        }
    }
    public Map<String,Object> findPatientInfo(String patient){
@ -2249,26 +2256,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
//    @Autowired
//    private HttpClientUtil httpClientUtil;
    @Autowired
    private HttpClientUtil httpClientUtil;
    public String test() {
//        List<NameValuePair> params = new ArrayList<>();
////        params.add(new BasicNameValuePair("clientId", "ihealth_pa8DIRJasL"));
////        params.add(new BasicNameValuePair("clientSecret", "jkzl1h7aj39dnasyi23fnkv92"));
////        params.add(new BasicNameValuePair("code", "b60bab0617c04b23b7fa0a059cc83eb6"));
//        params.add(new BasicNameValuePair("openid","o0hubt3byGmNYLyC-UvmSVyUuZkI"));
//        //String res = httpClientUtil.post("http://www.xmtyw.cn/wlyy/iHealth/userInfo", params, "UTF-8");
//        //https://wx.xmzsh.com
//        String res = httpClientUtil.post("https://wx.xmzsh.com/interface/getUserInfoByOpenId.htm", params, "UTF-8");
//        return res;
//
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("method", "ehc.ehealthcard.authurl"));
        params.add(new BasicNameValuePair("app_id", "1BQA48ETK000A718A8C000001FFAA482"));
        params.add(new BasicNameValuePair("term_id", "b60bab0617c04b23b7fa0a059cc83eb6"));
        params.add(new BasicNameValuePair("version","o0hubt3byGmNYLyC-UvmSVyUuZkI"));
        params.add(new BasicNameValuePair("timestamp", "ihealth_pa8DIRJasL"));
        params.add(new BasicNameValuePair("sign_type", "jkzl1h7aj39dnasyi23fnkv92"));
        params.add(new BasicNameValuePair("sign", "b60bab0617c04b23b7fa0a059cc83eb6"));
        params.add(new BasicNameValuePair("enc_type","o0hubt3byGmNYLyC-UvmSVyUuZkI"));
        params.add(new BasicNameValuePair("biz_content", "ihealth_pa8DIRJasL"));
        String res = httpClientUtil.post("http://172.16.1.21:6601/ehcService/gateway.do", params, "UTF-8");
        return res;
//        com.alibaba.fastjson.JSONObject jsonObject=new com.alibaba.fastjson.JSONObject();
//        jsonObject.put("openId","o0hubt3byGmNYLyC-UvmSVyUuZkI");
//        String responseMsg =httpClientUtil.sendPost("https://wx.xmzsh.com/interface/getUserInfoByOpenId.htm",jsonObject.toString());
//        com.alibaba.fastjson.JSONObject object1 = com.alibaba.fastjson.JSONObject.parseObject(responseMsg);
//        return object1.toString();
        return null;
    }
    
    

+ 60 - 2
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -12,9 +12,12 @@ import com.yihu.jw.entity.base.im.ConsultTeamLogDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
@ -25,6 +28,7 @@ import com.yihu.jw.im.dao.ConsultTeamLogDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.im.util.ImageCompress;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -78,6 +82,9 @@ public class ImService {
	@Autowired
	public BaseEvaluateDao baseEvaluateDao;
	
	@Autowired
	private HospitalWaitingRoomDao hospitalWaitingRoomDao;
	
	@Autowired
	public ImUtil imUtil;
	
@ -127,8 +134,12 @@ public class ImService {
	 * @param title 标题关键字
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByPatient(String patient, String id,Integer type, int pagesize, String title) {
	public List<ConsultVO>  findConsultRecordByPatient(String patient, String id,Integer type, int page,int pagesize, String title) {
		if(page <= 0){
			pagesize = 1;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
@ -160,13 +171,50 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.id desc limit 0,"+pagesize+"";
		sql += " ORDER BY a.czrq desc limit "+page+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		return result;
	}
	
	/**
	 * 查询患者所有的咨询记录总数
	 * @param patient 患者标识
	 * @param id 会话ID(等同IM表topicId)
	 * @param type 咨询会话类型
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @return
	 */
	public Long countConsultRecordByPatient(String patient, String id,Integer type, String title) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d " +
				"WHERE a.id=b.consult " +
				"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type="+type;
		List<ConsultVO> result = new ArrayList<>();
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
		}
		
		return count;
	}
	
	/**
	 * 查询居民与某个医生未结束的咨询
	 *
@ -940,6 +988,15 @@ public class ImService {
			wlyyOutpatientDO.setConDate(new Date());
			outpatientDao.save(wlyyOutpatientDO);
			
			//修改候诊室状态为已诊
			List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
			if(roomDOs!=null&&roomDOs.size()>0){
				for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
					roomDO.setVisitStatus(2);//修改候诊室状态为已诊
					hospitalWaitingRoomDao.save(roomDO);
				}
			}
			
			return result;
		}
	}
@ -1187,6 +1244,7 @@ public class ImService {
			evaluateScoreDO = baseEvaluateScoreDao.save(evaluateScoreDO);
			
			for(BaseEvaluateDO baseEvaluateDO :baseEvaluateDOS){
				baseEvaluateDO.setRelationCode(evaluateScoreDO.getId());
				baseEvaluateDao.save(baseEvaluateDO);
			}
			

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

@ -597,4 +597,20 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        return buffer.toString();
    }
    public JSONObject getHLWyyUser(String openid){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("openId",openid);
        try {
            String res = httpClientUtil.sendPost(getSynPath("xm_zsyy_wx"), jsonObject.toString());
            JSONObject object1 = JSONObject.parseObject(res);
            if (null != object1&&null!=object1.get("status") && "200".equals(object1.get("status").toString())) {
                JSONObject patient = object1.getJSONObject("userinfo");
                return patient;
            }
        }catch (Exception e){
            logger.error(e);
        }
        return null;
    }
}

+ 19 - 9
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -625,18 +625,12 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    @RequestMapping(value = "/oauth/getHwlyyDecrypt", method = RequestMethod.POST)
    public ObjEnvelop getHwlyyDecrypt(String openid,String idcard,String wechatId){
    public ObjEnvelop getHwlyyDecrypt(String openid,String idcard,String wechatId,HttpSession httpSession){
        Map<String,Object> rs = new HashedMap();
        try{
            OauthKeypairDO keypairDO = oauthKeypairDao.findByCode("hwlyyKey");
            KeyPair keyPair = (KeyPair)SerializeUtil.unSerialize(keypairDO.getKeyPair());
            //解密openid
            if(org.apache.commons.lang3.StringUtils.isNotBlank(openid)){
                rs.put("openid",com.yihu.jw.security.utils.RSAUtils.decryptBase64(openid, keyPair));
            }else {
                rs.put("openid",openid);
            }
            //解密idcard
            //解密idcard,中山医院id通过openid获取,i健康通过直接加密传输
            if(org.apache.commons.lang3.StringUtils.isNotBlank(idcard)){
                rs.put("idcard",com.yihu.jw.security.utils.RSAUtils.decryptBase64(idcard, keyPair));
            }else {
@ -644,10 +638,26 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            }
            //解密wechatId
            if(org.apache.commons.lang3.StringUtils.isNotBlank(wechatId)){
                rs.put("wechatId",com.yihu.jw.security.utils.RSAUtils.decryptBase64(wechatId, keyPair));
                String wxid =com.yihu.jw.security.utils.RSAUtils.decryptBase64(wechatId, keyPair);
                rs.put("wechatId",wxid);
                //解密openid
                if(org.apache.commons.lang3.StringUtils.isNotBlank(openid)){
                    String opid = com.yihu.jw.security.utils.RSAUtils.decryptBase64(openid, keyPair);
                    rs.put("openid",opid);
                    if("xm_zsyy_wx".equals(wxid)){
                        JSONObject patient =  userDetailsService.getHLWyyUser(opid);
                        rs.put("idcard",patient.getString("idcard"));
                        rs.put("mobile",patient.getString("mobile"));
                    }
                }else {
                    rs.put("openid",openid);
                }
            }else {
                rs.put("wechatId",wechatId);
            }
        }catch (Exception e){
            logger.error(e);
        }

Plik diff jest za duży
+ 17 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java


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

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.patient.service.BasePatientService;
@ -14,6 +15,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.service.WechatInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -46,9 +48,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private WechatInfoService wechatInfoService;
	
	@Autowired
	private WechatDao wechatDao;
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
	public ListEnvelop records(
	public Envelop records(
								@ApiParam(name = "patient", value = "居民id")
								@RequestParam(value = "patient",required = true) String patient,
								@ApiParam(name = "title", value = "咨询标题关键字")
@ -57,11 +62,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@RequestParam(value = "id",required = false) String id,
								@ApiParam(name = "type", value = "咨询类型")
								@RequestParam(value = "type",required = true) Integer type,
								@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, pagesize, title);
		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
@ -91,7 +99,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				array.add(json);
			}
		}
		return success(array);
		
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		return success(result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedConsult)
@ -314,7 +328,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getEvaluationByConsultCode)
	@ApiOperation(value = "评价咨询", notes = "评价咨询")
	@ApiOperation(value = "根据咨询CODE获取评价", notes = "根据咨询CODE获取评价")
	public ListEnvelop getEvaluationByConsultCode(
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = true) String consult)throws Exception{
@ -333,6 +347,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
		
		String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
		WxWechatDO wxWechatDO = wechatDao.findById(wxId);
		Map<Object, Object> map = new HashMap<Object, Object>();
		if (ticket != null) {
			String noncestr = UUID.randomUUID().toString();
@ -344,6 +359,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			map.put("noncestr", noncestr);
			map.put("timestamp", timestamp);
			map.put("signature", signature);
			map.put("appid", wxWechatDO.getAppId());
			return success(PatientRequestMapping.Wechat.api_success,map);
		}
		return failed(PatientRequestMapping.Wechat.api_error);

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

@ -439,9 +439,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop findDoctorWorkTimeByMonth(@ApiParam(name = "doctor", value = "医生code")
                                                 @RequestParam(value = "doctor", required = true)String doctor,
                                                 @ApiParam(name = "date", value = "年份和月份,yyyy-MM")
                                                 @RequestParam(value = "date", required = true)String date) {
        return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date));
                                                 @RequestParam(value = "date", required = false)String date,
                                                 @ApiParam(name = "startDate", value = "yyyy-MM-dd")
                                                 @RequestParam(value = "startDate", required = false)String startDate,
                                                 @ApiParam(name = "endDate", value = "yyyy-MM-dd")
                                                 @RequestParam(value = "endDate", required = false)String endDate) {
        return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date,startDate,endDate));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkRule)

+ 15 - 7
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/WlyyPatientExpressageAddrService.java

@ -84,14 +84,22 @@ public class WlyyPatientExpressageAddrService extends BaseJpaService<WlyyPatient
        boolean defaultAddrExist = patientExpressageAddrDao.existsByPatientAndIsDefault(patient,1);
        if(defaultAddrExist){
            List<WlyyPatientExpressageAddrDO> defaultAddrDOList = patientExpressageAddrDao.queryByPatientAndIsDefault(patient,1);
            WlyyPatientExpressageAddrDO defaultAddrDO = defaultAddrDOList.get(0);
            if(StringUtils.equals(addrDO.getId(),defaultAddrDO.getId())){
                return;
            if(defaultAddrDOList != null && defaultAddrDOList.size()>0){
                for (WlyyPatientExpressageAddrDO wlyyPatientExpressageAddrDO:defaultAddrDOList) {
                    wlyyPatientExpressageAddrDO.setIsDefault(0);
                    this.save(wlyyPatientExpressageAddrDO);
                }
//
//                WlyyPatientExpressageAddrDO defaultAddrDO = defaultAddrDOList.get(0);
//                if(StringUtils.equals(addrDO.getId(),defaultAddrDO.getId())){
//                    return;
//                }
//                defaultAddrDO.setIsDefault(0);
                addrDO.setIsDefault(1);
                this.save(addrDO);
            }
            defaultAddrDO.setIsDefault(0);
            addrDO.setIsDefault(1);
            this.save(defaultAddrDO);
            this.save(addrDO);
            return ;
        }
    }

+ 5 - 5
svr/svr-internet-hospital/src/main/resources/application.yml

@ -128,8 +128,8 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
# 上传文件临时路径配置
FileTempPath:
@ -181,8 +181,8 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
# 上传文件临时路径配置
FileTempPath:
@ -232,7 +232,7 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.26.0.118:3000/
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im
# 上传文件临时路径配置