Bläddra i källkod

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

wangzhinan 4 år sedan
förälder
incheckning
7f9fc5fa03
15 ändrade filer med 250 tillägg och 134 borttagningar
  1. 2 0
      business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java
  2. 3 3
      business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java
  3. 17 1
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  4. 6 1
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  5. 16 11
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  6. 12 8
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  7. 23 16
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  8. 2 2
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  9. 16 3
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  10. 8 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  11. 45 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java
  12. 2 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionDeleteService.java
  13. 92 79
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java
  14. 4 1
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  15. 2 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/PrivateDictEndpoint.java

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java

@ -13,4 +13,6 @@ public interface PrivateDictDao extends PagingAndSortingRepository<PrivateDictDO
    List<PrivateDictDO> findoneByCodeAndWechatId(String hospitalCode, String dictCode);
    @Query("from PrivateDictDO t where t.isDel = 1")
    List<PrivateDictDO> findALL();
    @Query("from PrivateDictDO t where t.dictCode= ?1 and t.isDel = 1")
    List<PrivateDictDO> findoneByCode(String dictCode);
}

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java

@ -22,9 +22,9 @@ public class PrivateDictService extends BaseJpaService<PrivateDictDO, PrivateDic
    @Autowired
    private HibenateUtils hibenateUtils;
    //查找隐私策略
    public List<PrivateDictDO> findByHospitalCodeAndDictCode(String hospitalCode,String dictCode){
        if (StringUtils.isNotBlank(hospitalCode)&&StringUtils.isNotBlank(dictCode)){
            return privateDictDao.findoneByCodeAndWechatId(hospitalCode,dictCode);
    public List<PrivateDictDO> findByHospitalCodeAndDictCode(String dictCode){
        if (StringUtils.isNotBlank(dictCode)){
            return privateDictDao.findoneByCode(dictCode);
        }else {
            return privateDictDao.findALL();
        }

+ 17 - 1
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -372,7 +372,23 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
            return true;
        }else {
            return false;
            BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
            String orgPwMd5 = MD5.md5Hex(orgPw + "{" + doctorDO.getSalt() + "}");
            if(!orgPwMd5.equals(doctorDO.getPassword())){
                return false;
            }
            //认证信息设置
            String salt = randomString(5);
            doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
            doctorDO.setSalt(salt);
            baseDoctorDao.save(doctorDO);
            //设置更新时间
            saveDoctorPwlimitDate(id);
            return true;
        }
    }

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

@ -122,15 +122,20 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                patientMappingDO.setCreateTime(new Date());
                patientMappingDao.save(patientMappingDO);
                resultMap.put("patientId",patientId);
                resultMap.put("familyId",patientNewId);
                resultMap.put("familyMember",patientNewId);
                resultMap.put("idCard",idCard);
                resultMap.put("phoneNum",phoneNum);
                resultMap.put("relationName",dictName);
                resultMap.put("name",familyName);
                resultMap.put("cardType",cardType);
                List<Map<String,Object>> resultList = new ArrayList();
                resultList.add(resultMap);
                mixEnvelop.setStatus(200);
                mixEnvelop.setMessage("添加成功");
                mixEnvelop.setDetailModelList(resultList);
            }else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法添加");
            }
        }
        else {

+ 16 - 11
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -26,6 +26,7 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
@ -257,17 +258,17 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        List<Map<String, Object>> returnList = new ArrayList<>();
        for (Map<String, Object> map : list) {
            Map<String,Object> returnMap = new HashMap<>();
            String relationCode = map.get("relation_code").toString();
            String id =  map.get("id").toString();
            String patientID = map.get("sender").toString();
            String relationCode = null==map.get("relation_code")?"":map.get("relation_code").toString();
            String id =  null==map.get("id")?"":map.get("id").toString();
            String patientID = null==map.get("sender")?"":map.get("sender").toString();
            BaseUserMessageDO baseUserMsgDO =new BaseUserMessageDO();
            baseUserMsgDO.setId(id);
            if (map.get("type")!=null){
                baseUserMsgDO.setType(Integer.valueOf(map.get("type").toString()));
            }
            baseUserMsgDO.setReceiver(map.get("receiver").toString());
            baseUserMsgDO.setReceiverName(map.get("receiver_name").toString());
            baseUserMsgDO.setSender(map.get("sender").toString());
            baseUserMsgDO.setReceiver(null==map.get("receiver")?"":map.get("receiver").toString());
            baseUserMsgDO.setReceiverName(null==map.get("receiver_name")?"":map.get("receiver_name").toString());
            baseUserMsgDO.setSender(null==map.get("sender")?"":map.get("sender").toString());
            List<BaseSensitiveDO> baseSensitiveDOS = baseSensitiveDao.getSensitiveWords();
            String content = map.get("content")==null?"":map.get("content").toString();
            for (BaseSensitiveDO sensitiveDO:baseSensitiveDOS){
@ -279,11 +280,11 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
            }
            baseUserMsgDO.setContent(content);
            baseUserMsgDO.setRelationCode(map.get("relation_code").toString());
            baseUserMsgDO.setRelationType(Integer.valueOf(map.get("relation_type").toString()));
            baseUserMsgDO.setRelationName(map.get("relation_name").toString());
            baseUserMsgDO.setStatus(Integer.valueOf(map.get("status").toString()));
            BasePatientDO patientDO = basePatientDao.findById(map.get("sender").toString());
            baseUserMsgDO.setRelationCode(null==map.get("relation_code")?"":map.get("relation_code").toString());
            baseUserMsgDO.setRelationType(null==map.get("relation_type")?0:Integer.valueOf(map.get("relation_type").toString()));
            baseUserMsgDO.setRelationName(null==map.get("relation_name")?"":map.get("relation_name").toString());
            baseUserMsgDO.setStatus(null==map.get("status")?0:Integer.valueOf(map.get("status").toString()));
            BasePatientDO patientDO = basePatientDao.findById(null==map.get("sender")?"":map.get("sender").toString());
            List<BaseBannerDoctorDO> ba =  baseBannerDoctorDao.getBanners(baseUserMsgDO.getReceiver(),baseUserMsgDO.getSender(),baseUserMsgDO.getRelationCode());
            if(ba.size()>0){
                List<BaseBannerDO> bannerLits= new ArrayList<>();
@ -527,4 +528,8 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        return true;
    }
    public static void main(String[] args) throws Exception {
        String sex = IdCardUtil.getSexForIdcard_new("411526199410084833");
        System.out.println(sex);
    }
}

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

@ -7874,11 +7874,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            JSONObject data = new JSONObject();
            Integer age = 0;
            String gender = "";
            if (StringUtils.isNoneBlank(prescriptionDO.getIdcard())) {
                age = IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard());
                gender = IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard());
            }
            BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
            if (null!=patientDO&&StringUtils.isNotBlank(patientDO.getIdcard())) {
                age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
                gender = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            }
            data.put("name", prescriptionDO.getPatientName());
            data.put("age", age);
            data.put("gender", gender);
@ -8514,8 +8514,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String uid = userAgent.getUID();
        StringBuffer sql = new StringBuffer(" SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        sql.append(uid).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(uid).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNotEmpty(status)) {
            status = status.substring(1, status.length() - 1);
@ -8578,8 +8578,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.info("MySql=" + sql.toString());
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }
        for (WlyyPrescriptionVO singlePre:list){
            List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(singlePre.getId(),1);
            List<WlyyPrescriptionInfoVO> infoVOS = new ArrayList<>();
            BeanUtils.copyProperties(infoDOs,infoVOS);
            singlePre.setInfoVOs(infoVOS);
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        logger.info("countSql=" + countSql.toString());
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());

+ 23 - 16
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -1727,6 +1727,9 @@ public class XzzxEntranceService{
        }
        return personInfoVOS;
    }
    public String replaceHtml(String demoData,String oldChar,String newChar){
        return demoData.replace(oldChar,null==newChar?"无":newChar);
    }
    /**
     * 同步门诊病历
     * @return
@ -1746,22 +1749,22 @@ public class XzzxEntranceService{
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("EMRHTMLDEMO");
            if (null!=wlyyHospitalSysDictDO){
                htmlDeo = wlyyHospitalSysDictDO.getDictValue();
                htmlDeo = htmlDeo.replace("@patientName@",jsonObject.getString("patientName"));
                htmlDeo = htmlDeo.replace("@patientAge@",jsonObject.getString("patientAge"));
                htmlDeo = htmlDeo.replace("@patientsex@",jsonObject.getString("patientsex"));
                htmlDeo = htmlDeo.replace("@deptCode@",jsonObject.getString("deptCode"));
                htmlDeo = htmlDeo.replace("@r+outpatientCode@",jsonObject.getString("outpatientCode"));
                htmlDeo = htmlDeo.replace("@patientClan@",jsonObject.getString("patientClan"));
                htmlDeo = htmlDeo.replace("@Special@",prescriptionEmrDO.getSpecialHistory());
                htmlDeo = replaceHtml(htmlDeo,"@patientName@",jsonObject.getString("patientName"));
                htmlDeo = replaceHtml(htmlDeo,"@patientAge@",jsonObject.getString("patientAge"));
                htmlDeo = replaceHtml(htmlDeo,"@patientsex@",jsonObject.getString("patientsex"));
                htmlDeo = replaceHtml(htmlDeo,"@deptCode@",jsonObject.getString("deptCode"));
                htmlDeo = replaceHtml(htmlDeo,"@r+outpatientCode@",jsonObject.getString("outpatientCode"));
                htmlDeo = replaceHtml(htmlDeo,"@patientClan@",jsonObject.getString("patientClan"));
                htmlDeo = replaceHtml(htmlDeo,"@Special@",prescriptionEmrDO.getSpecialHistory());
                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:MM");
                htmlDeo = htmlDeo.replace("@createTime@",sf.format(prescriptionEmrDO.getCreateTime()));
                htmlDeo = htmlDeo.replace("@complaint@",prescriptionEmrDO.getComplaint());
                htmlDeo = htmlDeo.replace("@medicalHistory@",prescriptionEmrDO.getMedicalHistory());
                htmlDeo = htmlDeo.replace("@popularHistory@",prescriptionEmrDO.getPopularHistory());
                htmlDeo = htmlDeo.replace("@pastHistory@",prescriptionEmrDO.getPastHistory());
                htmlDeo = htmlDeo.replace("@allergicHistory@",prescriptionEmrDO.getAllergicHistory());
                htmlDeo = htmlDeo.replace("@physicalExamination@",prescriptionEmrDO.getPhysicalExamination());
                htmlDeo = htmlDeo.replace("@assistExamination@",prescriptionEmrDO.getAssistExamination());
                htmlDeo = replaceHtml(htmlDeo,"@createTime@",sf.format(prescriptionEmrDO.getCreateTime()));
                htmlDeo = replaceHtml(htmlDeo,"@complaint@",prescriptionEmrDO.getComplaint());
                htmlDeo = replaceHtml(htmlDeo,"@medicalHistory@",prescriptionEmrDO.getMedicalHistory());
                htmlDeo = replaceHtml(htmlDeo,"@popularHistory@",prescriptionEmrDO.getPopularHistory());
                htmlDeo = replaceHtml(htmlDeo,"@pastHistory@",prescriptionEmrDO.getPastHistory());
                htmlDeo = replaceHtml(htmlDeo,"@allergicHistory@",prescriptionEmrDO.getAllergicHistory());
                htmlDeo = replaceHtml(htmlDeo,"@physicalExamination@",prescriptionEmrDO.getPhysicalExamination());
                htmlDeo = replaceHtml(htmlDeo,"@assistExamination@",prescriptionEmrDO.getAssistExamination());
                condition+="<content>"+htmlDeo+"</content>";
            }
        }
@ -3919,7 +3922,11 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        if (null != patientMappingDO && null != basePatientDO) {
            jsonObject.put("PATIENT_ID", patientMappingDO.getMappingCode());
            jsonObject.put("GENDER", basePatientDO.getSex()==1?"男":"女");
            if (null!=basePatientDO.getSex()){
                jsonObject.put("GENDER", 1==basePatientDO.getSex()?"男":"女");
            }else{
                jsonObject.put("GENDER", "男");
            }
            jsonObject.put("BIRTH", sdf.format(basePatientDO.getBirthday()));
        }
        jsonObject.put("FEE_TYPE", "1".equalsIgnoreCase(payType) ? "医保" : "自费");

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

@ -244,10 +244,10 @@ 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() + "}");
        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,"");

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

@ -3,6 +3,7 @@ package com.yihu.jw.im.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ibm.mq.jmqi.MQPD;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
@ -2254,7 +2255,7 @@ public class ImService {
				sql = "SELECT " +
						"a.id AS \"id\"," +
						"op.pay_status AS \"payStatus\"," +
						"case op.type  when 1 then 9 when 2 then 16 else op.type end type," +
						"case op.type  when '1' then '9' when '2' then '16' else op.type end type," +
						"op.description AS \"title\"," +
						"op.description AS \"symptoms\",";
				if ("xm_ykyy_wx".equals(wxId)) {
@ -2278,7 +2279,7 @@ public class ImService {
						"op.id as \"outpatientId\"," +
						"op.type as \"consultType\"," +
						"op.general_doctor as \"generalDoctor\"," +
						"op.icd10_name as \"icd10Name\"," +
							"op.icd10_name as \"icd10Name\"," +
						"d.photo AS \"patientPhoto\" , " +
						"op.doctor as \"doctor\" ," +
						"op.source as \"source\"  " +
@ -2484,7 +2485,19 @@ public class ImService {
				}
			}
			if (map.get("id")!=null){
				if("1".equals(type) || "15".equals(type) || type.contains(",")){
				if("1".equals(type) || "15".equals(type) || type.contains(",")|| "17".equals(type)){
					String consultCode = map.get("id").toString();
					List<WlyyConsultAdvice> consultAdvices = wlyyConsultAdviceDao.getByConsult(consultCode);
					StringBuffer content = new StringBuffer();
					for (WlyyConsultAdvice consultAdvice:consultAdvices){
						content.append(consultAdvice.getAdviceValue()+",");
					}
					if (content!=null&&content.length()>0){
						System.out.println("content+====="+content);
						content.deleteCharAt(content.length()-1);
					}
					map.put("icd10Name",content);
				}else if ("0".equals(type)&&null!=map.get("type")&&"17".equalsIgnoreCase(map.get("type").toString())){
					String consultCode = map.get("id").toString();
					List<WlyyConsultAdvice> consultAdvices = wlyyConsultAdviceDao.getByConsult(consultCode);
					StringBuffer content = new StringBuffer();

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

@ -1516,7 +1516,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        }else {
            try {
                Map<String,Object> rs = registerService.registerPatient(name,mobile,idcard,ssc,pw,openid,wxId,captcha);
                Map<String,Object> rs = registerService.registerPatient(mobile,pw);
                String code = rs.get("code").toString();
                if(!"1".equals(code)){
                    ObjEnvelop objEnvelop = new ObjEnvelop();
@ -1532,7 +1532,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                Map<String, String> parameters = new HashedMap();
                parameters.put("username",patientDO.getIdcard());
                parameters.put("username",patientDO.getMobile());
                parameters.put("grant_type", "ihealthCode");
                TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
@ -1658,12 +1658,13 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        String captcha = parameters.get("captcha");
        String loginType = parameters.get("login_type");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            }
        }
        String username = parameters.get("username");
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
@ -1755,6 +1756,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                    }
                }
                parameters.remove("password");
            } else if (!StringUtils.isEmpty(loginType)&&"3".equalsIgnoreCase(loginType)){
                if (wlyyRedisVerifyCodeService.verification(client_id, username, captcha)) {
                    //验证码正确
                }
            } else {
                //第三方同步账号模式登录
                parameters.put("grant_type", "ihealthCode");
@ -1792,7 +1797,6 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        //更新患者openId

+ 45 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -113,6 +113,51 @@ public class RegisterService {
        rs.put("mes","保存用户信息失败");
        return rs;
    }
    public Map<String,Object> registerPatient(String mobile,String pw)throws Exception{
        Map<String,Object> rs = new HashedMap();
        try{
            List<BasePatientDO> p2 = basePatientDao.findByMobileAndDel(mobile,"1");
            if(p2!=null&&p2.size()>0){
                rs.put("code","-2");
                rs.put("mes","手机号已经存在");
                return rs;
            }
            BasePatientDO patient = new BasePatientDO();
            String salt = UUID.randomUUID().toString().substring(0,5);
            patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
            patient.setSalt(salt);
            patient.setMobile(mobile);
            patient.setDel("1");
            patient.setEnabled(1);
            patient.setLocked(0);
            patient.setCreateTime(new Date());
            patient.setUpdateTime(new Date());
            BasePatientDO temp = basePatientDao.save(patient);
            PatientMedicareCardDO medicareCardDO = new PatientMedicareCardDO();
            medicareCardDO.setDel("1");
            medicareCardDO.setParentType("A");
            medicareCardDO.setType("A_01");
            medicareCardDO.setPatientCode(temp.getId());
            basePatientMedicareCardDao.save(medicareCardDO);
            /*if (org.apache.commons.lang3.StringUtils.isNoneBlank(wxId)&&wxId.equalsIgnoreCase("xm_ykyy_wx")){
                ykyyService.registerYkt(temp.getId(),pw,captcha);
            }*/
            rs.put("code","1");
            rs.put("mes","ok");
            rs.put("patient",temp);
            return rs;
        }catch (Exception e){
            e.printStackTrace();
        }
        rs.put("code","-3");
        rs.put("mes","保存用户信息失败");
        return rs;
    }
    public String updatePatientPw(String pw,String mobile){

+ 2 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionDeleteService.java

@ -41,10 +41,11 @@ public class PrescriptionDeleteService {
    public void deletePrescription() throws Exception{
        Calendar ca = Calendar.getInstance();//得到一个Calendar的实例
        ca.setTime(new Date()); //设置时间为当前时间
        ca.add(Calendar.DATE, -1); //年份减1
        ca.add(Calendar.DATE, -1); //天数减1
        Date d = ca.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String s = sdf.format(d);
        logger.info("开始日期:"+s);
        List<WlyyPrescriptionDO> prescriptionDOS = prescriptionDao.findListByCheckStatus(DateUtil.strToDate(s+" 00:00:00"),DateUtil.strToDate(s+" 23:59:59"));
        if (null!=prescriptionDOS&&prescriptionDOS.size()>0){
            for (WlyyPrescriptionDO prescriptionDO:prescriptionDOS){

+ 92 - 79
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/TimeoutOverDueService.java

@ -97,90 +97,103 @@ public class TimeoutOverDueService {
                        if (currentTime-outpatientTime>24*60*60*1000){
                            logger.info("时间满足条件");
                            String outPatientId = wlyyOutpatientDO.getId();
                            ConsultDo consultDo = consultDao.findByRelationCode(outPatientId);
                            if (null!=consultDo){
                                ConsultTeamDo consultTeamDo = consultTeamDao.findByConsult(consultDo.getId());
                                if (null!=consultTeamDo){
                                    consultTeamDo.setStatus(-1);
                                    consultTeamDao.save(consultTeamDo);
                                }
                            }
                            //判断医生是否接诊
                            List<WlyyHospitalWaitingRoomDO> roomDOs = hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
                            if (roomDOs != null && roomDOs.size() > 0) {
                                for (WlyyHospitalWaitingRoomDO roomDO : roomDOs) {
                                    if (roomDO.getVisitStatus() == 2) {
                                        logger.info("id为:"+outPatientId+"的门诊已被医生接诊");
                                    } else {
                                        roomDO.setVisitStatus(-1);
                                        logger.info("修改候诊室状态,将候诊病人移除候诊室");
                                        hospitalWaitingRoomDao.save(roomDO);
                            String consultCode ="";
                            try {
                                consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
                                logger.info("consultCode"+consultCode);
                                if(StringUtils.isNoneBlank(consultCode)){
                                    imService.finish(consultCode,"admin",2);
                                    //医生未回复可以退费
                                    businessOrderService.consultRefund(consultCode,wechatId);
                                    wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
                                    wlyyOutpatientDO.setDoctorCancelType("6");
                                    wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
                                    wlyyOutpatientDO.setEndTime(new Date());
                                    wlyyOutpatientDO.setOperator("system");
                                    outpatientDao.save(wlyyOutpatientDO);
                                    logger.info(wlyyOutpatientDO.getId()+"的门诊记录设置为取消");
                                }else{
                                    //判断医生是否接诊
                                    List<WlyyHospitalWaitingRoomDO> roomDOs = hospitalWaitingRoomDao.findByOutpatientId(outPatientId);
                                    if (roomDOs != null && roomDOs.size() > 0) {
                                        for (WlyyHospitalWaitingRoomDO roomDO : roomDOs) {
                                            if (roomDO.getVisitStatus() == 2) {
                                                logger.info("id为:"+outPatientId+"的门诊已被医生接诊");
                                            } else {
                                                roomDO.setVisitStatus(-1);
                                                logger.info("修改候诊室状态,将候诊病人移除候诊室");
                                                hospitalWaitingRoomDao.save(roomDO);
                                            }
                                        }
                                    }
                                }
                            }
                            //更改门诊状态
                            wlyyOutpatientDO.setStatus("-1");
                            String description = null;
                            wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
                            wlyyOutpatientDO.setDoctorCancelType("6");
                            wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
                            wlyyOutpatientDO.setEndTime(new Date());
                            wlyyOutpatientDO.setOperator("system");
                            description = cancelValue;
                            //系统消息
                            SystemMessageDO messageDO = new SystemMessageDO();
                            messageDO.setTitle("超时订单系统自动取消");
                            messageDO.setType("13");
                            messageDO.setSender(wlyyOutpatientDO.getDoctor());
                            messageDO.setSenderName(wlyyOutpatientDO.getDoctorName());
                            messageDO.setRelationCode(wlyyOutpatientDO.getId());
                            messageDO.setReceiver(wlyyOutpatientDO.getPatient());
                            messageDO.setReceiverName(wlyyOutpatientDO.getPatientName());
                            net.sf.json.JSONObject data = new net.sf.json.JSONObject();
                            data.put("name", wlyyOutpatientDO.getPatientName());
                            data.put("age", IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard()));
                            data.put("gender", IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard()));
                            data.put("question", wlyyOutpatientDO.getIcd10Name());
                            String msg = "";
                            if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                                data.put("type", "9");
                                msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被系统取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                                prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "systemCancelRemind", cancelRemark);
                            }
                            if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                                data.put("type", "16");
                                msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被系统取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                                prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "systemCancelRemind", cancelRemark);
                            }
                            data.put("msg", msg);
                            messageDO.setData(data.toString());
                            systemMessageService.saveMessage(messageDO);
                            //推送消息到眼科通
                            BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient());
                            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                                logger.info("推送消息到眼科通");
                                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
                            }
                            logger.info("修改保存的门诊记录:"+wlyyOutpatientDO.getId());
                            //删除门诊号源
                            List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
                            if (list != null && list.size() > 0) {
                                patientRegisterTimeDao.delete(list);
                            }
                            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                                businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                                //眼科接诊时更新眼科通状态
                                if (businessOrderDO!=null){
                                    ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                                }
                            } else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")) {
                                    //更改门诊状态
                                    wlyyOutpatientDO.setStatus("-1");
                                    String description = null;
                                    wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
                                    wlyyOutpatientDO.setDoctorCancelType("6");
                                    wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
                                    wlyyOutpatientDO.setEndTime(new Date());
                                    wlyyOutpatientDO.setOperator("system");
                                    description = cancelValue;
                                    //系统消息
                                    SystemMessageDO messageDO = new SystemMessageDO();
                                    messageDO.setTitle("超时订单系统自动取消");
                                    messageDO.setType("13");
                                    messageDO.setSender(wlyyOutpatientDO.getDoctor());
                                    messageDO.setSenderName(wlyyOutpatientDO.getDoctorName());
                                    messageDO.setRelationCode(wlyyOutpatientDO.getId());
                                    messageDO.setReceiver(wlyyOutpatientDO.getPatient());
                                    messageDO.setReceiverName(wlyyOutpatientDO.getPatientName());
                                    net.sf.json.JSONObject data = new net.sf.json.JSONObject();
                                    data.put("name", wlyyOutpatientDO.getPatientName());
                                    data.put("age", IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard()));
                                    data.put("gender", IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard()));
                                    data.put("question", wlyyOutpatientDO.getIcd10Name());
                                    String msg = "";
                                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                                        data.put("type", "9");
                                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被系统取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                                        prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "systemCancelRemind", cancelRemark);
                                    }
                                    if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                                        data.put("type", "16");
                                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被系统取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                                        prescriptionService.sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "systemCancelRemind", cancelRemark);
                                    }
                                    data.put("msg", msg);
                                    messageDO.setData(data.toString());
                                    systemMessageService.saveMessage(messageDO);
                                    //推送消息到眼科通
                                    BasePatientDO patient = basePatientDao.findById(wlyyOutpatientDO.getPatient());
                                    if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                                        logger.info("推送消息到眼科通");
                                        ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
                                    }
                                    //删除门诊号源
                                    List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
                                    if (list != null && list.size() > 0) {
                                        patientRegisterTimeDao.delete(list);
                                    }
                                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
                                    if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                                        businessOrderService.orderRefund(wechatId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                                        //眼科接诊时更新眼科通状态
                                        if (businessOrderDO!=null){
                                            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"2");
                                        }
                                    } else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")) {
        /*
                            businessOrderService.ylzOrderRefund(wechatId, wlyyOutpatientDO.getPatient(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
        */
                                    }
                                    outpatientDao.save(wlyyOutpatientDO);
                                    logger.info(wlyyOutpatientDO.getId()+"的门诊记录设置为取消");
                                }
                            }catch(Exception e)  {
                                e.printStackTrace();
                                logger.info("自动结束咨询报错 consultCode: "+consultCode);
                            }
                            outpatientDao.save(wlyyOutpatientDO);
                            logger.info(wlyyOutpatientDO.getId()+"的门诊记录设置为取消");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();

+ 4 - 1
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -265,7 +265,7 @@ jobs:
spring:
  profiles: xzprod
  datasource:
    url: jdbc:mysql://172.16.100.240:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://172.16.100.240:7306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: jkzl
    password: jkzl@2020
@ -294,10 +294,13 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: xm_xzzx_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
jobs:
  schedule: 0 */30 * * * ?
---
spring:

+ 2 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/PrivateDictEndpoint.java

@ -26,11 +26,9 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("查询隐私策略")
    @PostMapping(value= BaseHospitalRequestMapping.PatientNoLogin.findPrivateDict)
    public Envelop findPrivateDict(@ApiParam(name = "dictCode", value = "隐私code")
                                    @RequestParam(value = "dictCode", required = false) String dictCode,
                                    @ApiParam(name = "hospitalCode", value = "医院code")
                                    @RequestParam(value = "hospitalCode", required = false) String hospitalCode){
                                    @RequestParam(value = "dictCode", required = false) String dictCode){
        return success(privateDictService.findByHospitalCodeAndDictCode(hospitalCode,dictCode));
        return success(privateDictService.findByHospitalCodeAndDictCode(dictCode));
    }
    @PostMapping(value= BaseHospitalRequestMapping.PatientNoLogin.savePrivateDict)