66 Commits 3d08a30c3c ... b5b64d4f45

Autor SHA1 Mensaje Fecha
  humingfen b5b64d4f45 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  humingfen 1cba7a24e2 添加药品字典相关功能 hace 4 años
  wangzhinan af792e4609 Merge branch 'dev' of wangjun/wlyy2.0 into dev hace 4 años
  wangjun 77c892d02b Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 1f5324faff 核酸字典配置 hace 4 años
  叶仕杰 d99e158dc5 Merge branch 'dev' of liubing/wlyy2.0 into dev hace 4 años
  liubing 54b5e805c4 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  liubing f083072ffc 代码修改 hace 4 años
  叶仕杰 0459a546b1 Merge branch 'dev' of liubing/wlyy2.0 into dev hace 4 años
  liubing 47783c39db 代码修改 hace 4 años
  liubing 2925d33bd8 代码修改 hace 4 años
  liubing 052441ce90 代码修改 hace 4 años
  liubing 8bfbaea2d2 代码修改 hace 4 años
  叶仕杰 3647cf7846 Merge branch 'dev' of liubing/wlyy2.0 into dev hace 4 años
  liubing 14c09e7cfc Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan c98f4b6603 Merge branch 'dev' of wangjun/wlyy2.0 into dev hace 4 años
  wangjun 91d8b16287 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 56a63b5fae 配置加入 hace 4 años
  liubing 9ae0d92d95 代码修改 hace 4 años
  wangzhinan c5d89b9555 Merge branch 'dev' of http://27.154.233.186:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 5dcbf85394 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  叶仕杰 615887a7f1 Merge branch 'dev' of yeshijie/wlyy2.0 into dev hace 4 años
  yeshijie a693dacd2c Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  yeshijie 4903e75f67 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  叶仕杰 60a499861b Merge branch 'dev' of yeshijie/wlyy2.0 into dev hace 4 años
  yeshijie fedbd86684 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  叶仕杰 2c3f449ded Merge branch 'dev' of yeshijie/wlyy2.0 into dev hace 4 años
  yeshijie 5bb4ca0427 111 hace 4 años
  叶仕杰 3beebac843 Merge branch 'dev' of liubing/wlyy2.0 into dev hace 4 años
  liubing 6e49ebda76 代码修改 hace 4 años
  liubing a375e9a88a 代码修改 hace 4 años
  liubing 7c29a12a53 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  liubing 3e6033306a 代码修改 hace 4 años
  叶仕杰 04dd12d17b Merge branch 'dev' of yeshijie/wlyy2.0 into dev hace 4 años
  yeshijie 9854bb6a2f 111 hace 4 años
  叶仕杰 5f01799188 Merge branch 'dev' of liubing/wlyy2.0 into dev hace 4 años
  liubing 2f22f95aba 代码修改 hace 4 años
  wangjun 1df43276f5 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 3305529bc0 充值卡支付 hace 4 años
  wangzhinan b83f80a083 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 193f8743ac Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 1498eb4251 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan a3ac707fb8 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 9112fcfe62 Merge branch 'dev' of wangjun/wlyy2.0 into dev hace 4 años
  wangjun 707fe889d4 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun b151750a2a 建档手机号修改 hace 4 años
  wangzhinan 7000c80133 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 65a6c7c2e2 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangzhinan 4274232e75 Merge branch 'dev' of wangjun/wlyy2.0 into dev hace 4 años
  wangjun cda25a6a99 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  humingfen 913a2813af Merge branch 'dev' of humingfen/wlyy2.0 into dev hace 4 años
  wangjun 0e4e6486f7 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 52c6e7157c 冲突解决 hace 4 años
  humingfen a591a07b9c Merge branch 'dev' of humingfen/wlyy2.0 into dev hace 4 años
  wangjun 3d925762e0 prescription冲突解决 hace 4 años
  humingfen 31f8b042be Merge branch 'dev' of humingfen/wlyy2.0 into dev hace 4 años
  wangjun 1c7347b124 短信发送 hace 4 años
  wangjun a3b4643321 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 4cb9c2ef54 短信发送 hace 4 años
  wangjun 6adca53efb Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun ac6736a5a3 类型转换 hace 4 años
  wangjun 7cf09922de Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 3aa239f1a8 类型转换 hace 4 años
  wangjun ff28296123 类型转换 hace 4 años
  wangjun 662e049826 Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev hace 4 años
  wangjun 5458b2ada4 建档修改 hace 4 años
Se han modificado 48 ficheros con 2235 adiciones y 524 borrados
  1. 6 0
      business/base-service/pom.xml
  2. 3 2
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  3. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  5. 40 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java
  6. 14 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNationalDrugDictDao.java
  7. 85 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/NationalDrugDictService.java
  8. 124 45
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  9. 5 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java
  10. 178 16
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  11. 53 11
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  12. 389 0
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  13. 3 3
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  14. 5 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java
  15. 266 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java
  16. 0 29
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyySMSService.java
  17. 115 0
      common/common-entity/src/main/java/com/yihu/jw/entity/UuidIdentityEntityWithOperatorAES.java
  18. 429 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNationalDrugDictDO.java
  19. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwTnCf01DO.java
  20. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwTnCf02DO.java
  21. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemDO.java
  22. 2 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemOperateLogDO.java
  23. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/GuidanceMessageLogDO.java
  24. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java
  25. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java
  26. 0 9
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  27. 103 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/TransforSqlUtl.java
  28. 4 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  29. 70 0
      common/common-util/src/main/java/com/yihu/jw/util/common/PingyinUtils.java
  30. 4 4
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  31. 6 6
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/TnyyController.java
  32. 11 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  33. 1 1
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  34. 16 30
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  35. 3 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  36. 51 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  37. 62 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/NationalDrugDictEndpoint.java
  38. 30 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  39. 1 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatCoreController.java
  40. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java
  41. 5 3
      svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt
  42. 8 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java
  43. 3 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java
  44. 0 13
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java
  45. 91 95
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  46. 2 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistServiceItemService.java
  47. 29 179
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  48. 3 45
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

+ 6 - 0
business/base-service/pom.xml

@ -191,6 +191,12 @@
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -103,7 +103,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        }
        if (StringUtils.isNotBlank(name)){
            name = "%"+name+"%";
            sqlTotal += " AND (a.name like:name or b.dept_name like:name)";
            sqlTotal += " AND (a.name like:name or b.dept_name like:name or c.mapping_code like :name)";
            params.put("name",name);
        }
        if (StringUtils.isNotBlank(type)){
@ -136,6 +136,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " b.dept_name AS \"deptName\", " +
                " e.req_fee AS \"money\", " +
                " a.charge_type as \"chargeType\", "+
                " c.mapping_code as \"mappingCode\", "+
                "\tm.req_fee as \"twfzFee\",\n" +
                "\tn.req_fee as \"spfzFee\",\n" +
                "\tp.req_fee as \"spzxFee\",\n" +
@ -170,7 +171,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
            sql += " AND a.del =:status";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " AND (a.name like:name or b.dept_name like:name)";
            sql += " AND (a.name like:name or b.dept_name like:name or c.mapping_code like:name)";
        }
        if (StringUtils.isNotBlank(type)){
            sql += " AND a.outpatient_type like:type";

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

@ -132,6 +132,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        mixEnvelop.setMessage("您所添加的家属的名称有误,无法添加");
                        return mixEnvelop;
                    }
                    basePatientDO.setMobile(phoneNum);
                    familyId= jsonObject.getString("brid");
                    birth= jsonObject.getString("csny");
                    long lt = new Long(birth);
@ -178,7 +179,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                        }
                    }else {
                        if (null!=basePatientDO1){
                            res = ykyyService.addYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,"1",basePatientDO1.getUserId(),birth);
                            res = ykyyService.addYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,clinicId,basePatientDO1.getUserId(),birth);
                        }
                        if (StringUtils.isNotEmpty(res)){
                            JSONObject jsonObject1 = JSONObject.parseObject(res);

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -91,7 +91,7 @@ public class PatientMappingService {
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
        }
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(rs!=null&&rs.size()>0){
            //获取居民信息

+ 40 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java

@ -2,12 +2,21 @@ package com.yihu.jw.hospital.message.service;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,6 +35,14 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    private SystemMessageDao systemMessageDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Value("${wechat.id}")
    private String wechatId;
    /**
@ -109,6 +126,29 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        }
        return null;
    }
    public String  sendDoctorRemindSms(ConsultDo consultDo){
        String msg = "";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (consultDo!=null){
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(consultDo.getRelationCode());
                if (wlyyOutpatientDO!=null){
                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
                    if (baseDoctorDO!=null){
                        ykyySMSService.sendSmsByTempcode("message_remind_paitent",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                        msg="发送成功";
                    }else{
                        msg="发送失败,医生不存在";
                    }
                }else {
                    msg="发送失败,门诊不存在";
                }
            }else {
                msg="发送失败,consult不存在";
            }
        }
        return msg;
    }
}

+ 14 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNationalDrugDictDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseNationalDrugDictDao extends PagingAndSortingRepository<BaseNationalDrugDictDO, Integer>, JpaSpecificationExecutor<BaseNationalDrugDictDO> {
    @Query("update BaseNationalDrugDictDO b set b.status = ?2 where b.id = ?1")
    @Modifying
    void updateStatusById(Integer id, Integer status);
}

+ 85 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/NationalDrugDictService.java

@ -0,0 +1,85 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import com.yihu.jw.hospital.prescription.dao.BaseNationalDrugDictDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.common.ConvertToSpellUtils;
import com.yihu.jw.util.common.PingyinUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
@Service
@Transactional
public class NationalDrugDictService extends BaseJpaService<BaseNationalDrugDictDO, BaseNationalDrugDictDao> {
    @Autowired
    private BaseNationalDrugDictDao nationalDrugDictDao;
    public BaseNationalDrugDictDO saveNationalDrug(BaseNationalDrugDictDO nationalDrugDictDO) {
        nationalDrugDictDO.setPyName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getName()));
        nationalDrugDictDO.setPyCommonName(ConvertToSpellUtils.changeToTonePinYin(nationalDrugDictDO.getCommonName()));
        //判断新增或编辑
        if (nationalDrugDictDO.getId() == null) {
            nationalDrugDictDO.setCreateTime(new Date());
            nationalDrugDictDO.setStatus(1);
            nationalDrugDictDO.setUpdateTime(new Date());
            return nationalDrugDictDao.save(nationalDrugDictDO);
        }else {
            BaseNationalDrugDictDO oldDurgDictDO =  nationalDrugDictDao.findOne(nationalDrugDictDO.getId());
            BeanUtils.copyProperties(nationalDrugDictDO, oldDurgDictDO, getNullPropertyNames(nationalDrugDictDO));
            oldDurgDictDO.setUpdateTime(new Date());
            return nationalDrugDictDao.save(oldDurgDictDO);
        }
    }
    /**
     * 获取药品列表
     *
     * @param name
     * @param number
     * @param hospital
     * @param status
     * @param page
     * @param pageSize
     * @return
     * @throws ParseException
     */
    public MixEnvelop getNationalDrugList(String name, String number, String hospital, Integer status, Integer page, Integer pageSize) throws ParseException {
        MixEnvelop mixEnvelop = new MixEnvelop();
        String filters = "";
        if (StringUtils.isNotBlank(name)) {
            filters += "name?" + name + ";";
        }
        if (StringUtils.isNotBlank(number)) {
            filters += "number?" + number + ";";
        }
        if (StringUtils.isNotBlank(hospital)) {
            filters += "hospital=" + hospital + ";";
        }
        if (status != null) {
            filters += "status=" + status + ";";
        }
        Integer count = this.search(null, filters, null).size();
        List<BaseNationalDrugDictDO> list = this.search(null, filters, null, page, pageSize);
        mixEnvelop.setMessage("获取成功!");
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    public void updateNationalDrugStatus(Integer id, Integer status) {
         nationalDrugDictDao.updateStatusById(id, status);
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.BaseDictJobTitleDao;
import com.yihu.jw.dict.dao.BaseJobCategoryDao;
import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
@ -17,8 +18,10 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
@ -74,6 +77,7 @@ import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
@ -91,6 +95,7 @@ import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.pinyin.PinyinUtil;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
@ -126,6 +131,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static javafx.scene.input.KeyCode.L;
/**
 * Created by Trick on 2019/5/17.
 */
@ -276,6 +283,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private BaseJobCategoryDao jobCategoryDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
@ -975,6 +986,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            outpatientDO.setPayStatus(1);
        } else {
            outpatientDO.setPayStatus(0);
            outpatientDO.setFee(price);
            outpatient = outpatientDao.save(outpatientDO);
        }
        if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
@ -1245,7 +1258,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            for (int i = 0; i < res.size(); i++) {
                JSONObject card = res.getJSONObject(i);
                String cardStat = card.getString("CARD_STAT");
                if ("激活".equals(cardStat)) {
                String name = card.getString("name");
                if ("激活".equals(cardStat)&&name.equalsIgnoreCase(patientDO.getName())) {
                    rs.add(card);
                }
            }
@ -2596,9 +2610,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatientDao.save(outpatientDO);
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                if(!demoFlag){
                if(!demoFlag) {
                    //同步his
                    ykyyEntranceService.findByRealOrder(prescription.getId(),demoFlag);
                    ykyyEntranceService.findByRealOrder(prescription.getId(), demoFlag);
                    List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                    if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
                        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
@ -2610,6 +2624,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        } else {
                            ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                        }
                        ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                    }
                }
@ -2621,6 +2636,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }else if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")) {
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                logger.info("开始同步");
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                if(!demoFlag){
@ -2633,8 +2649,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        logger.info("cfsb", wlyyPrescriptionDO.getRealOrder());
                    }
                }
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
@ -2666,13 +2680,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result1.put("mes", "开方提交成功");
                result1.put("prescriptionId",prescription.getId());
                return result1;
            }else if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")) {
                Double price = prescription.getDrugFee();
                businessOrderService.recharge(prescription.getId(), "处方收费", "4", "处方收费", prescription.getPatientCode(), prescription.getPatientName(), prescription.getDoctor(), price);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
                return result;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
@ -2792,6 +2799,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        try {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
            WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(), "6");
            return chargeDictDO.getReqFee();
        } catch (Exception e) {
            logger.error("getChargeFee:" + e.toString());
@ -7001,8 +7009,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                    msg = "您的视频咨询已预约成功。\n" +
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7038,6 +7046,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "16", "videoOrderRemind", "");
                }
                systemMessageDO.setReceiver(outpatient.getDoctor());
                systemMessageDO.setReceiverName(outpatient.getDoctorName());
@ -7073,6 +7082,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        JSONObject data = new JSONObject();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatient.getId());
        if (outpatient!=null){
            if("1".equalsIgnoreCase(outpatient.getOutpatientType())){
                if ("1".equals(outpatient.getType())) {
@ -7110,7 +7120,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            if (businessOrderDO!=null&&0!=businessOrderDO.getPayPrice()){
                sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
@ -7147,7 +7159,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } catch (Exception e) {
                e.printStackTrace();
            }
            sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            if (businessOrderDO!=null&&0!=businessOrderDO.getPayPrice()){
                sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
            }
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                ykyyService.pushNotificationToYktPatient(patientDO.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
            }
@ -10481,16 +10495,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        return null;
    }
    public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
    public Map saveNatAppointment(String chargeAmount,String inspectionName,String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushChannel,String pushFlag,String cardNoType,String consumer) throws Exception {
        Map returnMap = new HashMap();
        List<WlyyHospitalSysDictDO> natConfigList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
        String checkPart = "鼻/咽拭子";
        String chargeFlag = "2";
        String chargeCode = "361322";
        String icdCode = "Z00.000";
        Integer winNo = 6;
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:natConfigList){
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"checkPart".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                checkPart = wlyyHospitalSysDictDO.getDictValue();
            }
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"chargeFlag".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                chargeFlag = wlyyHospitalSysDictDO.getDictValue();
            }
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"chargeCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                chargeCode = wlyyHospitalSysDictDO.getDictValue();
            }
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"icdCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                icdCode = wlyyHospitalSysDictDO.getDictValue();
            }
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"winNo".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                winNo = Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
            }
        }
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            net.sf.json.JSONObject jsondate = new JSONObject();
            jsondate.put("checkPart","鼻/咽拭子");
            jsondate.put("checkPart",checkPart);
            jsondate.put("cardNo",mediaCard);
            jsondate.put("chargeFlag","2");
            jsondate.put("chargeCode","361322");
            jsondate.put("icdCode","Z00.000");
            jsondate.put("chargeFlag",chargeFlag);
            jsondate.put("chargeCode",chargeCode);
            jsondate.put("icdCode",icdCode);
            jsondate.put("socialNo",cardNo);
            jsondate.put("tellPhone",mobile);
            jsondate.put("address1",provinceName);
@ -10499,7 +10536,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsondate.put("address4",streetName);
            jsondate.put("address5",address);
            jsondate.put("area",townName);
            jsondate.put("winNo",6);
            jsondate.put("winNo",winNo);
            if (StringUtils.isNoneBlank(secondJobName)){
                jsondate.put("target",secondJobName);
            }else {
@ -10518,15 +10555,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    com.alibaba.fastjson.JSONObject jsonObject = object.getJSONObject("MsgInfo");
                    String Msg = jsonObject.getString("Msg");
                    if (Msg.contains("Error")){
                        returnMap.put("msg",Msg);
                        returnMap.put("status","-1");
                        return  returnMap;
                            returnMap.put("msg",Msg);
                            returnMap.put("status","-1");
                            return  returnMap;
                    }else {
                        flag = true;
                    }
                }
                if (flag){
                    BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                    baseNatAppointmentDO.setChargeAmount(chargeAmount);
                    baseNatAppointmentDO.setMedicare(mediaCard);
                    baseNatAppointmentDO.setName(name);
                    baseNatAppointmentDO.setCardNo(cardNo);
@ -10547,11 +10585,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    baseNatAppointmentDO.setPayStatus("0");
                    baseNatAppointmentDO.setCreateTime(new Date());
                    baseNatAppointmentDO.setMobile(mobile);
                    baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
                    baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
                    baseNatAppointmentDO.setIcdCode("Z00.000");
                    baseNatAppointmentDO.setChargeCode("361322");
                    baseNatAppointmentDO.setWinNo("6");
                    baseNatAppointmentDO.setInspectionCode(chargeCode);
                    baseNatAppointmentDO.setInspectionName(inspectionName);
                    baseNatAppointmentDO.setIcdCode(icdCode);
                    baseNatAppointmentDO.setChargeCode(chargeCode);
                    baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
                    baseNatAppointmentDO.setDept("3150000");
                    baseNatAppointmentDO.setDeptName("感染疾病科");
                    baseNatAppointmentDO.setAmpm(pm);
@ -10689,8 +10727,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            return returnMap;
        }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            Double natFee = 8000.0;
            if(StringUtils.isNoneBlank(chargeAmount)){
                natFee= Double.parseDouble(chargeAmount)*100;
            }
            BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
            baseNatAppointmentDO.setMedicare(mediaCard);
            baseNatAppointmentDO.setChargeAmount(chargeAmount);
            baseNatAppointmentDO.setName(name);
            baseNatAppointmentDO.setCardNo(cardNo);
            baseNatAppointmentDO.setCardType(cardType);
@ -10709,11 +10752,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            baseNatAppointmentDO.setPayStatus("0");
            baseNatAppointmentDO.setCreateTime(new Date());
            baseNatAppointmentDO.setMobile(mobile);
            baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
            baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
            baseNatAppointmentDO.setIcdCode("Z00.000");
            baseNatAppointmentDO.setChargeCode("361322");
            baseNatAppointmentDO.setWinNo("6");
            baseNatAppointmentDO.setInspectionCode(chargeCode);
            baseNatAppointmentDO.setInspectionName(inspectionName);
            baseNatAppointmentDO.setIcdCode(icdCode);
            baseNatAppointmentDO.setChargeCode(chargeCode);
            baseNatAppointmentDO.setWinNo(String.valueOf(winNo));
            baseNatAppointmentDO.setDept("3150000");
            baseNatAppointmentDO.setDeptName("感染疾病科");
            baseNatAppointmentDO.setAmpm(pm);
@ -10733,7 +10776,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            businessDO.setRelationName("核酸检测订单");
            businessDO.setOrderCategory("6");
            businessDO.setOrderType(12);
            businessDO.setPayPrice(8000.0);
            businessDO.setPayPrice(natFee);
            businessDO.setRematk("核酸检测订单");
            businessDO.setDescription("核酸检测订单");
            businessDO.setPayType(1);
@ -10950,6 +10993,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.id as \"id\"," +
                "t.card_no_type as \"cardNoType\"," +
                "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
                "t.charge_amount as \"chargeAmount\"," +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
        if (StringUtils.isNoneBlank(patientId)){
@ -11079,24 +11123,47 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                baseNatAppointmentDO.setCancelBy(patientId);
                                baseNatAppointmentDao.save(baseNatAppointmentDO);
                                if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                                    List<WlyyHospitalSysDictDO> natConfigList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
                                    String checkPart = "鼻/咽拭子";
                                    String chargeFlag = "2";
                                    String icdCode = "Z00.000";
                                    Integer winNo = 6;
                                    for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:natConfigList){
                                        if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"checkPart".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                                            checkPart = wlyyHospitalSysDictDO.getDictValue();
                                        }
                                        if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"chargeFlag".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                                            chargeFlag = wlyyHospitalSysDictDO.getDictValue();
                                        }
                                        if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"icdCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                                            icdCode = wlyyHospitalSysDictDO.getDictValue();
                                        }
                                        if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"winNo".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                                            winNo = Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
                                        }
                                    }
                                    //删除处方
                                    logger.info("删除处方开始");
                                    net.sf.json.JSONObject jsondate = new JSONObject();
                                    jsondate.put("checkPart","鼻/咽拭子");
                                    jsondate.put("checkPart",checkPart);
                                    jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                                    jsondate.put("chargeFlag","2");
                                    jsondate.put("chargeCode","361322");
                                    jsondate.put("icdCode","Z00.000");
                                    jsondate.put("chargeFlag",chargeFlag);
                                    jsondate.put("chargeCode",baseNatAppointmentDO.getChargeCode());
                                    jsondate.put("icdCode",icdCode);
                                    jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                                    jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                                    jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                                    jsondate.put("address2",baseNatAppointmentDO.getCityName());
                                    jsondate.put("address3",baseNatAppointmentDO.getTownName());
                                    jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                                    jsondate.put("address5",2);
                                    jsondate.put("area",baseNatAppointmentDO.getAddress());
                                    jsondate.put("winNo",6);
                                    jsondate.put("target",2);
                                    jsondate.put("address5",baseNatAppointmentDO.getAddress());
                                    jsondate.put("area",baseNatAppointmentDO.getTownName());
                                    jsondate.put("winNo",winNo);
                                    if (StringUtils.isNoneBlank(baseNatAppointmentDO.getSecondJobName())){
                                        jsondate.put("target",baseNatAppointmentDO.getSecondJobName());
                                    }else {
                                        jsondate.put("target",baseNatAppointmentDO.getFirstJobName());
                                    }
                                    jsondate.put("quantity",1);
                                    jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                                    jsondate.put("dept",baseNatAppointmentDO.getDept());
@ -11208,7 +11275,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public Envelop getNatAppointmentList(String realOrder, String name, String hospitalFlag, String mobile, String idcard, String payStatus, String medicare, String createTimeStart, String createTimeEnd, String appointmentTimeStart, String appointmentTimeEnd, Integer isSuccess, Integer page, Integer pageSize) {
    public Envelop getNatAppointmentList(String realOrder, String name, String hospitalFlag, String mobile, String idcard, String payStatus, String medicare, String createTimeStart, String createTimeEnd, String appointmentTimeStart, String appointmentTimeEnd, Integer isSuccess, Integer page, Integer pageSize,String orderNo) {
        String sql = "select t.name as \"name\"," +
                "t.card_no as \"cardNo\"," +
                "t.card_type as \"cardType\"," +
@ -11225,8 +11292,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.id as \"id\"," +
                "t.card_no_type as \"cardNoType\"," +
                "t.HOSPITAL_FLAG as \"hospitalFlag\"," +
                "m.order_no as \"orderNo\"," +
                "t.charge_amount as \"chargeAmount\"," +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
                " from base_nat_appointment t left join base_business_order_pay m ";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql+=" on to_char(t.id) = m.relation_code " +
                    " where 1=1 ";
        }else{
            sql+=" on cast(t.id as char) = m.relation_code " +
                    " where 1=1 ";
        }
        if (StringUtils.isNotBlank(realOrder)) {
            sql += " and t.real_order like '%" + realOrder + "%' ";
        }
@ -11239,6 +11315,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(idcard)) {
            sql += " and t.card_no like '%" + idcard + "%' ";
        }
        if (StringUtils.isNoneBlank(orderNo)){
            sql+=" and m.order_no = '"+orderNo+"' ";
        }
        //支付状态
        if (StringUtils.isNotBlank(payStatus)) {
            sql += " and t.pay_status ='" + payStatus + "' ";

+ 5 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java

@ -568,7 +568,7 @@ public class TnyyEntranceService {
        List<WlyyPrescriptionVO> wlyyPrescriptionVOList = new ArrayList<>();
        //处方数据
        String msd01 = "SELECT d.CFLX,d.BRID,d.BRXM,d.FPHM,d.MZXH,d.JZKH,d.JZXH,d.CFSB,d.CFHM,d.KSDM  FROM MS_CF01 d WHERE d.JZXH = '"+admNo+"'";
        String msd01 = "SELECT d.CFLX,d.BRID,d.BRXM,d.FPHM,d.MZXH,d.JZKH,d.JZXH,d.CFSB,d.CFHM,d.KSDM  FROM MS_CF01_YD d WHERE d.JZXH = '"+admNo+"'";
        JSONObject rs = new JSONObject();
        String content="";
        Map<String,Object> params = new HashedMap();
@ -601,7 +601,7 @@ public class TnyyEntranceService {
                wlyyPrescriptionVO.setRealOrder(object.getString("CFSB"));
                wlyyPrescriptionVO.setDept(object.getString("KSDM"));
                wlyyPrescriptionVO.setOriginRealOrder(object.getString("CFHM"));
                String msd02 = "SELECT d.YPXH,d.YPCD,d.YPSL,d.YPDJ,d.YFDW,d.YFDW,d.MRCS,d.YFBZ,d.YPYF,d.YYTS,d.SBXH,d.YFGG  FROM V_MS_DD02 d WHERE d.CFSB = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                String msd02 = "SELECT d.YPXH,d.YPCD,d.YPSL,d.YPDJ,d.YFDW,d.YFDW,d.MRCS,d.YFBZ,d.YPYF,d.YYTS,d.SBXH,d.YFGG  FROM MS_CF02_YD d WHERE d.CFSB = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                JSONObject rs1 =new JSONObject();
                Map<String,Object> params1 = new HashedMap();
@ -959,7 +959,7 @@ public class TnyyEntranceService {
        if (wlyyPrescriptionVO!=null){
            try {
                hlwCf01DO.setYFSB(3);
                hlwCf01DO.setYFSB(20);
                hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
                hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
                hlwCf01DO.setZFPB(0);
@ -1034,7 +1034,7 @@ public class TnyyEntranceService {
                }else {
                    cfsb = wlyyPrescriptionVO.getRealOrder();
                    String sql = "update v_ms_dd01 t set t.ZFPB=1,t.ZFSJ=to_date('"+DateUtil.getStringDate()+"','yyyy-mm-dd hh24:mi:ss')  where  t.CFSB ='"+cfsb+"' ";
                    String sql = "update MS_CF01_YD t set t.ZFPB=1  where  t.CFSB ='"+cfsb+"' ";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",sql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params1);
@ -1112,7 +1112,7 @@ public class TnyyEntranceService {
                        hlwCf02DO.setZFBL(1.0);//自负比例
                        hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                        hlwCf02DO.setMRCS(StringUtils.isNoneBlank(wlyyPrescriptionInfoVO.getGroupNo())?Integer.parseInt(wlyyPrescriptionInfoVO.getGroupNo()):0);//每日次数
                        hlwCf02DO.setYFBZ(3);
                        hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                        hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                        hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
                        hlwCf02DO.setSL(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity()));

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

@ -18,12 +18,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
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.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
@ -38,6 +40,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
@ -150,6 +153,10 @@ public class YkyyEntranceService {
    private FileUploadService fileUploadService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -1581,6 +1588,121 @@ public class YkyyEntranceService {
        return array;
    }
    /**
     * 获取his病人信息--身份证/卡号
     * @param ssc
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientBySscAndIdcard(String ssc,String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.jzkh = '"+ssc+"' and x.sfzh ='"+idcard+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    /**
     * 获取his病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientByIdCard(String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    /**
     * 获取his病人信息
     * @param medicare
@ -1743,6 +1865,13 @@ public class YkyyEntranceService {
            //同步检查检验
            if(null!=inspectionDOS&&inspectionDOS.size()>0){
                synInspect(inspectionDOS);
                WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                //向患者发送检查提醒短信
                if (wlyyOutpatientDO!=null){
                    ykyySMSService.sendSmsByTempcode("inspection_remind",wlyyOutpatientDO,null,"");
                }
            }
        }
@ -1901,8 +2030,29 @@ public class YkyyEntranceService {
    public void saveKsjc(BaseNatAppointmentDO natAppointmentDO,Boolean demoFlag) throws Exception {
        BigDecimal bigDecimal = new BigDecimal("80");
        if (StringUtils.isNoneBlank(natAppointmentDO.getChargeAmount())){
            bigDecimal= new BigDecimal(natAppointmentDO.getChargeAmount());
        }
        List<WlyyHospitalSysDictDO> natConfigList = wlyyHospitalSysDictDao.findByDictName("natConfigList");
        String chargeCode = "12220";
        String icdCode = "Z00.001";
        String inspectionName="新冠病毒核酸检测";
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:natConfigList){
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"chargeCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                chargeCode = wlyyHospitalSysDictDO.getDictValue();
            }
            if (StringUtils.isNoneBlank(wlyyHospitalSysDictDO.getDictValue())&&"icdCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                icdCode = wlyyHospitalSysDictDO.getDictValue();
            }
        }
        if (StringUtils.isNoneBlank(natAppointmentDO.getInspectionName())){
            inspectionName = natAppointmentDO.getInspectionName();
        }
        //挂号
        Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
        BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId());
        //PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
        Integer brid= 0;
@ -1910,7 +2060,7 @@ public class YkyyEntranceService {
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -2007,7 +2157,7 @@ public class YkyyEntranceService {
            hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }*/
        //V_HLW_ICD10.FLAG
        JSONArray jsonArray2 = findHisIcd10("Z00.001");
        JSONArray jsonArray2 = findHisIcd10(icdCode);
        if(jsonArray2!=null&&jsonArray2.size()>0){
            //获取居民信息
            JSONObject json = jsonArray2.getJSONObject(0);
@ -2038,7 +2188,7 @@ public class YkyyEntranceService {
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setYSDM(map.get("doctorCode").toString());
            hlwYsMzJbzdDO.setICD("Z00.001");
            hlwYsMzJbzdDO.setICD(icdCode);
            hlwYsMzJbzdDO.setMSZD("健康查体");
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(brid);
@ -2069,16 +2219,21 @@ public class YkyyEntranceService {
        List<YkEmrJcsqDO> ykEmrJcsqDOS = new ArrayList<>();
        YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
        ykEmrJcsqDO.setJzxh(jzxh);
        ykEmrJcsqDO.setXmid(Integer.valueOf("12220"));
        JSONArray jsonArray1 = this.findZlxm(null, "12220");
        ykEmrJcsqDO.setXmid(Integer.valueOf(chargeCode));
        String deptNo = null;
        /*JSONArray jsonArray1 = this.findZlxm(null, "12220");
        if (jsonArray1 != null && jsonArray1.size() > 0) {
            JSONObject deptobject = jsonArray1.getJSONObject(0);
            deptNo = deptobject.getString("dept");
        }*/
        if ("3".equalsIgnoreCase(natAppointmentDO.getHospitalFlag())){
            deptNo = "96";
        }else {
            deptNo="1111";
        }
        ykEmrJcsqDO.setZxks(deptNo == null ? 0 : Integer.parseInt(deptNo));
        ykEmrJcsqDO.setJcxm("新冠病毒核酸检测");
        ykEmrJcsqDO.setXmdj(new BigDecimal("80"));
        ykEmrJcsqDO.setJcxm(inspectionName);
        ykEmrJcsqDO.setXmdj(bigDecimal);
        ykEmrJcsqDO.setSqsl(1);
        ykEmrJcsqDO.setJclx(1);
        ykEmrJcsqDO.setXmdw("人次");
@ -2092,7 +2247,7 @@ public class YkyyEntranceService {
        Integer kdks = 0;
        /*Integer brid=0;*/
        String mzhm="0";
        JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray3 = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray3!=null&&jsonArray3.size()>0){
            //获取居民信息
@ -2138,6 +2293,8 @@ public class YkyyEntranceService {
            String yjxh = object.getString("yjxh");
            natAppointmentDO.setRealOrder(yjxh);
            natAppointmentDO.setIsSuccess("1");
            natAppointmentDO.setDoctorId(map.get("doctorCode").toString());
            natAppointmentDO.setDoctorName(map.get("doctorName").toString());
            baseNatAppointmentDao.save(natAppointmentDO);
        }else {
        }
@ -2204,7 +2361,7 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -2680,7 +2837,7 @@ public class YkyyEntranceService {
        String sql = "select t.ztmc as\"ztmc\",t.ztid as\"ztid\"," +
                "t.gslb as\"gslb\",t.gsdm as\"gsdm\"," +
                "t.pydm as\"pydm\",t.Mzsy as\"Mzsy\"" +
                "from portal_his.emr_yzzt@ykzxtest t where 1=1";
                "from portal_his.emr_yzzt@xec_link t where 1=1";
        if(StringUtils.isNotEmpty(gslb)){
            sql+=" and t.gslb = "+Integer.valueOf(gslb);
            }
@ -2704,7 +2861,7 @@ public class YkyyEntranceService {
    public JSONArray findZtmxByid(String ztId) throws Exception{
        String sql = "select t.ztid as \"ztid\",t.xmdm as \"code\"," +
                "t.xmmc as \"name\",t.mrsl as \"quantity\",t.zxks as \"dept\"" +
                "from portal_his.emr_ztmx@ykzxtest t where 1=1";
                "from portal_his.emr_ztmx@xec_link t where 1=1";
        if (StringUtils.isNotEmpty(ztId)){
            sql += " and t.ztid = '"+ztId+"'";
        }
@ -2797,6 +2954,7 @@ public class YkyyEntranceService {
    }
    //门诊开单操作
    public Map<String,Object> outPatientOrder(List<YkEmrJcsqDO> surveys,Boolean demoFlag,String doctor,String patient) throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNoneBlank(doctor)){
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
@ -2810,7 +2968,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        Map<String,Object> resultMap = new HashMap();
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
@ -2921,6 +3079,7 @@ public class YkyyEntranceService {
    public String outPatientOrderYk(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate,YkEmrJcsqDO.class);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNotEmpty(doctor)){
@ -2934,7 +3093,7 @@ public class YkyyEntranceService {
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -3075,7 +3234,7 @@ public class YkyyEntranceService {
    public void updatePatientJd(String patient,String address,String phone,Float zy, boolean demoFlag) throws Exception {
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),basePatientDO.getIdcard(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
@ -3095,7 +3254,8 @@ public class YkyyEntranceService {
    public String saveJdxx(String brxm,String csny,Float brxb,String czgh,String sfzh,Float sjhm,String ybkh,String lxdz,Float zy){
    public String saveJdxx(String brxm,String csny,Float brxb,String czgh,String sfzh,String sjhm,String ybkh,String lxdz,Float zy){
        logger.info("===========sjhm==================="+sjhm);
        return  hibenateUtils.saveJdxx(brxm,DateUtil.strToDateShort(csny),brxb,czgh,sfzh,sjhm,ybkh,lxdz,zy);
    }
@ -3107,6 +3267,9 @@ public class YkyyEntranceService {
    public String updateJzkh(Float brid,String jzkh){
        return  hibenateUtils.updateJzkh(brid,jzkh);
    }
    public String updateSfzh(Float brid,String sfzh){
        return  hibenateUtils.updateSfzh(brid,sfzh);
    }
    public String findInfoBysql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
@ -3247,5 +3410,4 @@ public class YkyyEntranceService {
        return res;
    }
}

+ 53 - 11
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -34,6 +34,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
@ -41,6 +42,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
@ -50,6 +52,7 @@ import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -127,6 +130,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private YkyySMSService ykyySMSService;
@ -453,12 +460,14 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    public Map<String,Object> selectOrderByRelationCode(String relationCode,String tradeType,String wechatId,boolean payFlag,String appletCode) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
        if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
            throw new Exception("订单已取消");
        }
        if (businessOrderDO!=null&&businessOrderDO.getStatus()==1){
            throw new Exception("订单已支付");
        if (NumberUtils.isDigits(relationCode) ){
            BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.valueOf(relationCode));
            if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
                throw new Exception("订单已取消");
            }
            if (businessOrderDO!=null&&businessOrderDO.getStatus()==1){
                throw new Exception("订单已支付");
            }
        }
        String body = businessOrderDO.getDescription();
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
@ -848,6 +857,12 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                    if (StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                        BaseDoctorDO baseDoctorDO= doctorDao.findById(wlyyOutpatientDO.getDoctor());
                        if (baseDoctorDO!=null){
                            ykyySMSService.sendSmsByTempcode("outpatient_remind",wlyyOutpatientDO,null,baseDoctorDO.getMobile());
                        }
                    }
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
@ -877,6 +892,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                            " where "+condition+" t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                    ykyyEntranceService.updateHisStatus(updatesql);
                                    logger.info("自取写入更新his");
                                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                                    ykyySMSService.sendSmsByTempcode("oneself_pick",wlyyOutpatientDO,wlyyPrescriptionDO,"");
                                }else {
                                    //向顺丰下单
                                    logger.info("向顺丰快递下单");
@ -1134,6 +1152,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        return businessOrderDO;
    }
    public BusinessOrderDO selectStatusById(Integer id){
        BusinessOrderDO businessOrderDO = businessOrderDao.findOne(id);
        return businessOrderDO;
    }
    public BaseNatAppointmentDO selectById(Integer relationCode){
        return  baseNatAppointmentDao.findOne(relationCode);
@ -1347,7 +1369,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="https://hlwyy.xmzsh.com/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="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1719,7 +1741,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @return
     * @throws Exception
     */
    public Map yktMedicalCardTopUp(String mzhm,Double jkje,Integer type,Integer paymentType,String patientId,String wechatId,String hospitalId,String wxPayType) throws Exception {
    public Map yktMedicalCardTopUp(String mzhm,Double jkje,Integer type,Integer paymentType,String patientId,String wechatId,String hospitalId,String wxPayType,String appletCode) throws Exception {
        BasePatientDO patientDO = patientDao.findById(patientId);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        businessOrderDO.setPatient(patientId);
@ -1757,18 +1779,38 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        List<BasePatientWechatDo> patientWechatDoList = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        String openid = "";
        if (StringUtils.isNotBlank(appletCode)){
            logger.info("appletCode不为空"+appletCode);
            Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
            if (objectMap!=null){
                openid = objectMap.get("openid").toString();
                logger.info("appletCode"+appletCode);
                logger.info("openid"+openid);
            }
        }else {
            logger.info("appletCode为空"+appletCode);
            if (StringUtils.isNoneBlank(patientId)){
                List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,patientId);
                if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                    openid = patientWechatDo.get(0).getOpenid();
                }
            }
        }
       /* List<BasePatientWechatDo> patientWechatDoList = patientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
        if (patientWechatDoList==null || patientWechatDoList.size()==0){
            map.put("error","无openId");
            logger.info("error=无openId");
            return map;
        }
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
     */
        String url = wxWechatDO.getBaseUrl();
        String notifyUrl =url;
        String price = (int)(businessOrderDO.getPayPrice()*100)+"";
        map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,patientWechatDoList.get(0).getOpenid(),businessOrderDO.getOrderNo(),notifyUrl,patientId);
        map = unifiedorder(wechatId,businessOrderDO.getDescription(),price,wxPayType,openid,businessOrderDO.getOrderNo(),notifyUrl,patientId);
        map.put("id",businessOrderDO.getId());
        logger.info("success="+JSONObject.toJSONString(map));
        return map;
    }

+ 389 - 0
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -0,0 +1,389 @@
package com.yihu.jw.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyySMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyySMSService.class);
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    @Autowired
    private WlyyInspectionDao inspectionDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
    }
    public void sendSmsByTempcode(String temlateCode, WlyyOutpatientDO wlyyOutpatientDO, WlyyPrescriptionDO wlyyPrescriptionDO,String doctorMobile){
        SmsTemplateDO smsTemplateDO =  null;
        String content="";
        String sex = "先生/女士";
        String mobile = "";
        //由于审方情况比较特殊单独标记下
        WxPushLogDO wxPushLogDO = null;
        WxPushLogDO wxPushLogDODoctor = null;
        //新增字典判断是否发送短信
        String sendMesControl = "1";//1 开启发送短信 0 关闭
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("ykSmsControl");
        if (wlyyHospitalSysDictDO!=null){
            sendMesControl = wlyyHospitalSysDictDO.getDictValue();
        }
        if("check_failed".equalsIgnoreCase(temlateCode)){
            wxPushLogDO = wxPushLogDao.findByTempNameAndOpenidAndReceiver(temlateCode,wlyyOutpatientDO.getId(),wlyyOutpatientDO.getPatient());
            wxPushLogDODoctor = wxPushLogDao.findByTempNameAndOpenidAndReceiver(temlateCode,wlyyOutpatientDO.getId(),wlyyOutpatientDO.getDoctor());
        }else {
            wxPushLogDO = wxPushLogDao.findByTempNameAndOpenid(temlateCode,wlyyOutpatientDO.getId());
        }
        if (wlyyOutpatientDO!=null){
            if (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
                if ("1".equalsIgnoreCase(sexNo)){
                    sex = "先生";
                }else if ("2".equalsIgnoreCase(sexNo)){
                    sex = "女士";
                }
            }
            BasePatientDO basePatientDO = basePatientDao.findById(wlyyOutpatientDO.getPatient());
            if (basePatientDO!=null&&StringUtils.isNoneBlank(basePatientDO.getMobile())){
                mobile = basePatientDO.getMobile();
            }else {
                mobile=wlyyOutpatientDO.getMobile();
            }
        }
        logger.info("temlateCode"+temlateCode+"==mobile:"+mobile);
        try {
            if ("prescription_remind".equalsIgnoreCase(temlateCode)){//开具处方提醒
                smsTemplateDO = smsTemplateDao.findByClientId("prescription_remind");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
            }else if ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                            ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                            wxPushLogDO = new WxPushLogDO();
                            wxPushLogDO.setTempName(temlateCode);
                            wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                            wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                            wxPushLogDO.setCreateTime(new Date());
                            wxPushLogDao.save(wxPushLogDO);
                        }
                    }
                }
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
                smsTemplateDO = smsTemplateDao.findByClientId("message_remind_paitent");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .replace("{{性别}}",sex);
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                    }
                }
            }else if("check_failed".equalsIgnoreCase(temlateCode)){//处方审核失败
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
                SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                if (smsTemplateDO1!=null){
                    String contentDoctor = smsTemplateDO1.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    if (wxPushLogDODoctor==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getDoctor());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(doctorMobile,smsTemplateDO1.getHeader()+contentDoctor);
                    }
                }
            }else if ("check_success_patient".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
            }else if ("inspection_remind".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    String medicard = "";
                    Integer brxb = 0;
                    String mzhm ="0";
                    //如果患者医保卡不为空则用社保卡 否则用mzhm
                    if(StringUtils.isNoneBlank(wlyyOutpatientDO.getCardNo())){
                        medicard = wlyyOutpatientDO.getCardNo();
                        JSONArray jsonArray3 = findHisPatient(medicard,false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }else {
                            medicard="";
                        }
                    }else {
                        JSONArray jsonArray3 = findHisPatientByIdCard(wlyyOutpatientDO.getIdcard(),false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }
                    }
                    List<WlyyInspectionDO> list = inspectionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                    String createTime = "";
                    if (list!=null&&list.size()>0){
                        createTime = DateUtil.dateToStrLong(list.get(0).getCreateTime());
                    }
                    if (StringUtils.isNoneBlank(medicard)){
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",createTime).replace("{{门诊号码}}",mzhm)
                        .replace("{{社保卡号}}","【凭社保卡/就诊卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex).replace("{{时间}}",createTime);
                    }else {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                    }
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        wxPushLogDO = new WxPushLogDO();
                        wxPushLogDO.setTempName(temlateCode);
                        wxPushLogDO.setOpenid(wlyyOutpatientDO.getId());
                        wxPushLogDO.setReceiver(wlyyOutpatientDO.getPatient());
                        wxPushLogDO.setCreateTime(new Date());
                        wxPushLogDao.save(wxPushLogDO);
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                    }
                }
            }
            logger.info("发送后:temlateCode"+temlateCode+"==mobile:"+mobile+"content"+content+"doctorMobile"+doctorMobile);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(temlateCode+"模板发送失败");
        }
    }
    /**
     * 获取his病人信息
     * @param ssc
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatient(String ssc,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.jzkh = '"+ssc+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    /**
     * 获取his病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatientByIdCard(String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
}

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -186,7 +186,7 @@ public class HibenateUtils {
    public String saveJdxx(String brxm,Date csny,Float brxb,String czgh,String sfzh,Float sjhm,String ybkh,String lxdz,Float zy) {
    public String saveJdxx(String brxm,Date csny,Float brxb,String czgh,String sfzh,String sjhm,String ybkh,String lxdz,Float zy) {
        StoredProcedureQuery query = entityManager
                .createStoredProcedureQuery(" ZKSG.sp_zksg_jdkh_2021@xec_link") // 被调用存储过程名称
                .registerStoredProcedureParameter("P_BRXM", String.class, ParameterMode.IN) // 注册参数
@ -194,7 +194,7 @@ public class HibenateUtils {
                .registerStoredProcedureParameter("P_BRXB", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_CZGH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_SFZH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_SJHM", Float.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_SJHM", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_YBKH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_LXDZ", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ZY", Float.class, ParameterMode.IN)
@ -253,7 +253,7 @@ public class HibenateUtils {
                .registerStoredProcedureParameter("P_SFZH", String.class, ParameterMode.IN)
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("P_BRID", brid)
                .setParameter("P_YBKH", sfzh);
                .setParameter("P_SFZH", sfzh);
        query.execute();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        return priceStr;

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxPushLogDao.java

@ -2,10 +2,15 @@ package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2020/4/27.
 */
public interface WxPushLogDao extends PagingAndSortingRepository<WxPushLogDO, String>, JpaSpecificationExecutor<WxPushLogDO> {
    WxPushLogDO findByTempNameAndOpenid(String tempName,String openId);
    WxPushLogDO findByTempNameAndOpenidAndReceiver(String tempName,String openId,String reciver);
}

+ 266 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java

@ -0,0 +1,266 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyyINSMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyyINSMSService.class);
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String urlSms ="https://smsapp.wlwx.com";
    @Autowired
    private BaseSmsTemplateDao smsTemplateDao;
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
    }
   /* public void sendSmsByTempcode(String temlateCode, WlyyOutpatientDO wlyyOutpatientDO, WlyyPrescriptionDO wlyyPrescriptionDO,String doctorMobile){
        SmsTemplateDO smsTemplateDO =  null;
        String content="";
        String sex = "先生/女士";
        String mobile = "";
        if (wlyyOutpatientDO!=null){
            if (StringUtils.isNoneBlank(wlyyOutpatientDO.getIdcard())){
                String sexNo = IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard());
                if ("1".equalsIgnoreCase(sexNo)){
                    sex = "先生";
                }else if ("2".equalsIgnoreCase(sexNo)){
                    sex = "女士";
                }
            }
            BasePatientDO basePatientDO = basePatientDao.findById(wlyyOutpatientDO.getPatient());
            if (basePatientDO!=null&&!StringUtils.isNoneBlank(basePatientDO.getMobile())){
                mobile = basePatientDO.getMobile();
            }else {
                mobile=wlyyOutpatientDO.getMobile();
            }
        }
        logger.info("temlateCode"+temlateCode+"==mobile:"+mobile);
        try {
            if ("prescription_remind".equalsIgnoreCase(temlateCode)){//开具处方提醒
                smsTemplateDO = smsTemplateDao.findByClientId("prescription_remind");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("outpatient_remind".equalsIgnoreCase(temlateCode)){//患者发起复诊给医生发送消息
                smsTemplateDO = smsTemplateDao.findByClientId("outpatient_remind");
                if (smsTemplateDO!=null){
                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent();
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                    }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        content = smsTemplateDO.getContent().replace("图文","视频");
                        ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                    }
                }
            }else if ("message_remind_paitent".equalsIgnoreCase(temlateCode)){//医生发消息发送短信提醒
                content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
                ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
            }else if ("oneself_pick".equalsIgnoreCase(temlateCode)){//病人自取
                smsTemplateDO = smsTemplateDao.findByClientId("oneself_pick");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime())).replace("{{门诊号码}}",wlyyOutpatientDO.getRealOrder())
                    .replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if("check_failed".equalsIgnoreCase(temlateCode)){//处方审核失败
                smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                if (smsTemplateDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
                SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                if (smsTemplateDO1!=null){
                    content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    ykyySendSMS(doctorMobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("check_success_patient".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("check_success_patient");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder()).replace("{{性别}}",sex);;
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }else if ("inspection_remind".equalsIgnoreCase(temlateCode)){//处方审核通过
                smsTemplateDO = smsTemplateDao.findByClientId("inspection_remind");
                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                    String medicard = "";
                    Integer brxb = 0;
                    String mzhm ="0";
                    //如果患者医保卡不为空则用社保卡 否则用mzhm
                    if(StringUtils.isNoneBlank(wlyyOutpatientDO.getCardNo())){
                        medicard = wlyyOutpatientDO.getCardNo();
                        JSONArray jsonArray3 = findHisPatient(medicard,false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }else {
                            medicard="";
                        }
                    }else {
                        JSONArray jsonArray3 = findHisPatientByIdCard(wlyyOutpatientDO.getIdcard(),false);
                        if(jsonArray3!=null&&jsonArray3.size()>0){
                            //获取居民信息
                            JSONObject json = jsonArray3.getJSONObject(0);
                            mzhm = json.getString("mzhm");
                        }
                    }
                    List<WlyyInspectionDO> list = inspectionDao.findByOutpatientId(wlyyOutpatientDO.getId());
                    String createTime = "";
                    if (list!=null&&list.size()>0){
                        createTime = DateUtil.dateToStrLong(list.get(0).getCreateTime());
                    }
                    if (StringUtils.isNoneBlank(medicard)){
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",createTime).replace("{{门诊号码}}",mzhm)
                        .replace("{{社保卡号}}","【凭社保卡"+medicard+"到院充值预缴金做检查】").replace("{{性别}}",sex);;
                    }else {
                        content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",createTime).replace("{{门诊号码}}",mzhm)
                                .replace("{{社保卡号}}","【到收费处,凭此条短信中的门诊号码换卡充值预缴金做检查】").replace("{{性别}}",sex);;
                    }
                    ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);
                }
            }
            logger.info("发送后:temlateCode"+temlateCode+"==mobile:"+mobile+"content"+content);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(temlateCode+"模板发送失败");
        }
    }
    *//**
     * 获取his病人信息
     * @param ssc
     * @return
     * @throws Exception
     *//*
    public JSONArray findHisPatient(String ssc,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.jzkh = '"+ssc+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }
    *//**
     * 获取his病人信息
     * @param idcard
     * @return
     * @throws Exception
     *//*
    public JSONArray findHisPatientByIdCard(String idcard,boolean demoFlag) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("brid","1168517");
            jsonObject.put("mzhm","0502452155");
            jsonObject.put("brxm","于小童");
            jsonObject.put("sfzh","450521199405092535");
            jsonObject.put("brxz","自费");
            jsonObject.put("brxb","男");
            jsonObject.put("csny","1994-05-09");
            jsonObject.put("jzkh","2396501");
            jsonObject.put("jdsj","2020-06-28 15:15:35");
            jsonObject.put("gzztmc","一般");
            jsonObject.put("lxdz","厦门市五缘湾");
            array.add(jsonObject);
        }else  {
            HttpResponse response = HttpUtils.doGet(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
            }
        }
        return array;
    }*/
}

+ 0 - 29
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyySMSService.java

@ -1,29 +0,0 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.sms.util.ykyy.client.SmsClient;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import org.springframework.stereotype.Service;
/**
 * Created by Trick on 2020/3/19.
 */
@Service
public class YkyySMSService {
    private final String usrCode ="300643";
    private final String pw ="T9IHN69DDF";
    private final String url ="https://smsapp.wlwx.com";
    /**
     * 发送短信验证码
     * @param mobile
     * @param content
     * @return
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",url,pw);
    }
}

+ 115 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/UuidIdentityEntityWithOperatorAES.java

@ -0,0 +1,115 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.util.Date;
/**
 * 统一定义id的entity基类.
 * 主键生成策略是UUID
 * 还包含业务表用的 创建人,创建时间 创建人名  修改人,修改时间 修改人名
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class UuidIdentityEntityWithOperatorAES extends UuidIdentityEntity {
    //创建时间
	@CreatedDate
	protected Date createTime;
	//创建者
    @CreatedBy
	protected String createUser;
    //创建者
    @CreatedBy
    protected String createUserName;
    //更新时间
    @LastModifiedDate
	protected Date updateTime;
	//更新者
    @LastModifiedBy
	protected String updateUser;
	//更新者
    @LastModifiedBy
	protected String updateUserName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "create_user",updatable = false)
	public String getCreateUser() {
		return createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name",updatable = false)
	@Convert(converter = StringFStringEncryptConverter.class)
	public String getCreateUserName() {
		return createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@Column(name = "update_time", nullable = false, length = 0)
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	@Column(name = "update_user")
	public String getUpdateUser() {
		return updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	@Column(name = "update_user_name")
	@Convert(converter = StringFStringEncryptConverter.class)
	public String getUpdateUserName() {
		return updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
}

+ 429 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNationalDrugDictDO.java

@ -0,0 +1,429 @@
package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name = "base_national_drug_dict")
@SequenceGenerator(name="id_generated", sequenceName="BASE_NATIONAL_DRUG_DICT_SEQ")
public class BaseNationalDrugDictDO extends IntegerIdentityEntity {
    private String number;//国家编码
    private String name;//国家药品通用名
    private String pyName;//国家药品通用名称拼音码
    private String subjectClass;//科目类别id
    private String subjectClassName;//科目类别名称
    private String commonName;//药品通用名
    private String pyCommonName;//药品通用名称拼音码
    private String hospital;//机构id
    private String hospitalName;//机构名称
    private String relationCode;//国家药品编码saasId(机构药品时该字段才有值)
    private String gyzz;//国药准字
    private String unit;//包装单位
    private String packingSpecifications;//包装规格
    private Integer isSplit;//是否可拆(1是 0否)
    private String drugSpecifications;//药品规格
    private String dosageForm;//剂型
    private String drugCode;//药品类别
    private String drugName;//药品类别名称
    private String minDose;//最小剂量
    private String doseUnit;//剂量单位
    private String doseUnitName;//剂量单位名称
    private String manageClass;//管理类别id
    private BigDecimal retailPrice;//零售价格
    private String medicareSpecifications;//医保规格
    private String medicareUnit;//医保单位
    private String toxicology;//毒理分类
    private String toxicology_name;//毒理分类名称
    private String prescription;//处方用药
    private String gmp;//gmp药品
    private String antimicrobial;//抗菌药分类id
    private String antimicrobialName;//抗菌药分类名称
    private String supplier;//供应商
    private String manufacturer;//厂商
    private String remark;//备注
    private String volumeUnit;//体积单位
    private String weightUnit;//重量单位
    private String drugDose;//用药剂量
    private Integer amount;//用药总量
    private String amountUnit;//总量单位
    private String amountUnitName;//总量单位名称
    private Integer days;//用药天数
    private String frenquency;//用药频次
    private String method;//用药方法
    private Integer status;//状态(1生效 0失效)
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    public String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPyName() {
        return pyName;
    }
    public void setPyName(String pyName) {
        this.pyName = pyName;
    }
    public String getSubjectClass() {
        return subjectClass;
    }
    public void setSubjectClass(String subjectClass) {
        this.subjectClass = subjectClass;
    }
    public String getSubjectClassName() {
        return subjectClassName;
    }
    public void setSubjectClassName(String subjectClassName) {
        this.subjectClassName = subjectClassName;
    }
    public String getCommonName() {
        return commonName;
    }
    public void setCommonName(String commonName) {
        this.commonName = commonName;
    }
    public String getPyCommonName() {
        return pyCommonName;
    }
    public void setPyCommonName(String pyCommonName) {
        this.pyCommonName = pyCommonName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public String getGyzz() {
        return gyzz;
    }
    public void setGyzz(String gyzz) {
        this.gyzz = gyzz;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public String getPackingSpecifications() {
        return packingSpecifications;
    }
    public void setPackingSpecifications(String packingSpecifications) {
        this.packingSpecifications = packingSpecifications;
    }
    public Integer getIsSplit() {
        return isSplit;
    }
    public void setIsSplit(Integer isSplit) {
        this.isSplit = isSplit;
    }
    public String getDrugSpecifications() {
        return drugSpecifications;
    }
    public void setDrugSpecifications(String drugSpecifications) {
        this.drugSpecifications = drugSpecifications;
    }
    public String getDosageForm() {
        return dosageForm;
    }
    public void setDosageForm(String dosageForm) {
        this.dosageForm = dosageForm;
    }
    public String getDrugCode() {
        return drugCode;
    }
    public void setDrugCode(String drugCode) {
        this.drugCode = drugCode;
    }
    public String getDrugName() {
        return drugName;
    }
    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }
    public String getMinDose() {
        return minDose;
    }
    public void setMinDose(String minDose) {
        this.minDose = minDose;
    }
    public String getDoseUnit() {
        return doseUnit;
    }
    public void setDoseUnit(String doseUnit) {
        this.doseUnit = doseUnit;
    }
    public String getDoseUnitName() {
        return doseUnitName;
    }
    public void setDoseUnitName(String doseUnitName) {
        this.doseUnitName = doseUnitName;
    }
    public String getManageClass() {
        return manageClass;
    }
    public void setManageClass(String manageClass) {
        this.manageClass = manageClass;
    }
    public BigDecimal getRetailPrice() {
        return retailPrice;
    }
    public void setRetailPrice(BigDecimal retailPrice) {
        this.retailPrice = retailPrice;
    }
    public String getMedicareSpecifications() {
        return medicareSpecifications;
    }
    public void setMedicareSpecifications(String medicareSpecifications) {
        this.medicareSpecifications = medicareSpecifications;
    }
    public String getMedicareUnit() {
        return medicareUnit;
    }
    public void setMedicareUnit(String medicareUnit) {
        this.medicareUnit = medicareUnit;
    }
    public String getToxicology() {
        return toxicology;
    }
    public void setToxicology(String toxicology) {
        this.toxicology = toxicology;
    }
    public String getToxicology_name() {
        return toxicology_name;
    }
    public void setToxicology_name(String toxicology_name) {
        this.toxicology_name = toxicology_name;
    }
    public String getPrescription() {
        return prescription;
    }
    public void setPrescription(String prescription) {
        this.prescription = prescription;
    }
    public String getGmp() {
        return gmp;
    }
    public void setGmp(String gmp) {
        this.gmp = gmp;
    }
    public String getAntimicrobial() {
        return antimicrobial;
    }
    public void setAntimicrobial(String antimicrobial) {
        this.antimicrobial = antimicrobial;
    }
    public String getAntimicrobialName() {
        return antimicrobialName;
    }
    public void setAntimicrobialName(String antimicrobialName) {
        this.antimicrobialName = antimicrobialName;
    }
    public String getSupplier() {
        return supplier;
    }
    public void setSupplier(String supplier) {
        this.supplier = supplier;
    }
    public String getManufacturer() {
        return manufacturer;
    }
    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getVolumeUnit() {
        return volumeUnit;
    }
    public void setVolumeUnit(String volumeUnit) {
        this.volumeUnit = volumeUnit;
    }
    public String getWeightUnit() {
        return weightUnit;
    }
    public void setWeightUnit(String weightUnit) {
        this.weightUnit = weightUnit;
    }
    public String getDrugDose() {
        return drugDose;
    }
    public void setDrugDose(String drugDose) {
        this.drugDose = drugDose;
    }
    public Integer getAmount() {
        return amount;
    }
    public void setAmount(Integer amount) {
        this.amount = amount;
    }
    public String getAmountUnit() {
        return amountUnit;
    }
    public void setAmountUnit(String amountUnit) {
        this.amountUnit = amountUnit;
    }
    public String getAmountUnitName() {
        return amountUnitName;
    }
    public void setAmountUnitName(String amountUnitName) {
        this.amountUnitName = amountUnitName;
    }
    public Integer getDays() {
        return days;
    }
    public void setDays(Integer days) {
        this.days = days;
    }
    public String getFrenquency() {
        return frenquency;
    }
    public void setFrenquency(String frenquency) {
        this.frenquency = frenquency;
    }
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwTnCf01DO.java

@ -14,7 +14,7 @@ import java.util.Date;
 * */
//@ApiModel(value = "HlwTnCf01DO", description = "眼科处方表1数据")
@Entity
@Table(name = "MS_CF01")
@Table(name = "MS_CF01_YD")
public class HlwTnCf01DO {
    private Integer cFSB;//	NUMBER(18)	N			处方识别 每次写一次就变化一次不能重复

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwTnCf02DO.java

@ -7,7 +7,7 @@ import javax.persistence.*;
 *
 * */
@Entity
@Table(name = "MS_CF02")
@Table(name = "MS_CF02_YD")
public class HlwTnCf02DO {
    private Integer sBXH;//NUMBER(18)   N注释
    private Integer cFSB;//NUMBER(18)   N识别序号

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.specialist;/**
 */
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -17,7 +18,7 @@ import java.io.Serializable;
 **/
@Entity
@Table(name = "wlyy_service_item")
public class SpecialistServiceItemDO extends UuidIdentityEntityWithOperator implements Serializable {
public class SpecialistServiceItemDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    @Column(name = "saas_id")
    private String saasId; // saasId

+ 2 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistServiceItemOperateLogDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.specialist;/**
 */
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -16,7 +17,7 @@ import java.io.Serializable;
 **/
@Entity
@Table(name = "wlyy_service_item_operate_log")
public class SpecialistServiceItemOperateLogDO extends UuidIdentityEntityWithOperator implements Serializable {
public class SpecialistServiceItemOperateLogDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    @Column(name = "saas_id")
    private String saasId;

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/GuidanceMessageLogDO.java

@ -1,6 +1,6 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import javax.persistence.Column;
@ -14,7 +14,7 @@ import java.io.Serializable;
 */
@Entity
@Table(name = "wlyy_guidance_message_log")
public class GuidanceMessageLogDO extends UuidIdentityEntityWithOperator implements Serializable {
public class GuidanceMessageLogDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    private String saasId;
    private String messageId;

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java

@ -1,7 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -12,7 +12,7 @@ import java.io.Serializable;
 */
@Entity
@Table(name = "wlyy_rehabilitation_plan_template")
public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    @Column(name = "saas_id")
    private String saasId;

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java

@ -1,7 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -14,7 +14,7 @@ import java.io.Serializable;
 */
@Entity
@Table(name = "wlyy_rehabilitation_template_detail")
public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
@ -147,7 +147,7 @@ public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperat
        return expense;
    }
    public void setExpense(String name) {
    public void setExpense(Integer expense) {
        this.expense = expense;
    }
}

+ 0 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -31,15 +31,6 @@ public class AesEncryptUtils {
        return decrypt(str,KEY);
    }
    public static String decryptMysql(String name,String alias){
        return decryptMysql(name)+" as "+alias+" ";
    }
    public static String decryptMysql(String name){
        return ","+decryptMysqlNo(name);
    }
    public static String decryptMysqlNo(String name){
        return "CAST(AES_DECRYPT(from_base64("+name+"), '"+KEY+"') AS char)";
    }

+ 103 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/TransforSqlUtl.java

@ -8,6 +8,54 @@ package com.yihu.jw.entity.util;
 */
public class TransforSqlUtl {
    public static String wlyySpecialistPatientRelationLike(String sql,String ...replaceName){
        for (String tmp :replaceName){
            String str = "AES_DECRYPT(from_base64("+tmp+"),'jkzl2021ZJXL*#%a')";
            sql = sql.replaceAll(tmp,str);
        }
        return  sql;
    }
    public static String wlyySpecialistPatientRelationReplay(String sql,String ...replaceName){
        for (String tmp :replaceName){
            String str = "CAST(AES_DECRYPT(from_base64("+tmp+"),'jkzl2021ZJXL*#%a') AS CHAR ) ";
            sql = sql.replaceAll(tmp,str);
        }
        return  sql;
    }
    public static String wlyy_service_itemAll(String sql){
        String sqlTmp = " *,CAST(AES_DECRYPT(from_base64(create_user_name),'jkzl2021ZJXL*#%a')AS CHAR ) AS create_user_name,\n" +
                "CAST( AES_DECRYPT(from_base64(update_user_name),'jkzl2021ZJXL*#%a')AS CHAR) AS update_user_name\n";
        sql = sql.replace("*", sqlTmp);
        return sql;
    }
    public static String specialistPatientRelationAll(String sql) {
        String sqlTmp = " *,CAST(AES_DECRYPT(from_base64(doctor_name),'jkzl2021ZJXL*#%a')AS CHAR ) AS doctor_name,\n" +
                "CAST( AES_DECRYPT(from_base64(patient_name),'jkzl2021ZJXL*#%a')AS CHAR) AS patient_name,\n" +
                "CAST(AES_DECRYPT(from_base64(health_assistant_name),'jkzl2021ZJXL*#%a') AS CHAR) AS health_assistant_name,\n" +
                "CAST(AES_DECRYPT(from_base64(sign_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR) AS sign_doctor_name,\n" +
                "CAST(AES_DECRYPT(from_base64(health_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR) AS health_doctor_name,\n" +
                "CAST(AES_DECRYPT(from_base64(create_user_name),'jkzl2021ZJXL*#%a')AS CHAR)AS create_user_name,\n" +
                "CAST(AES_DECRYPT(from_base64(update_user_name),'jkzl2021ZJXL*#%a')AS CHAR)AS update_user_name \n" ;
        sql = sql.replace("*", sqlTmp);
        return sql;
    }
    public static String specialistPatientRelationAll2(String sql) {
        String sqlTmp = " *,CAST(AES_DECRYPT(from_base64(r.doctor_name),'jkzl2021ZJXL*#%a')AS CHAR ) AS doctor_name,\n" +
                "CAST( AES_DECRYPT(from_base64(r.patient_name),'jkzl2021ZJXL*#%a')AS CHAR) AS patient_name,\n" +
                "CAST(AES_DECRYPT(from_base64(r.health_assistant_name),'jkzl2021ZJXL*#%a') AS CHAR) AS health_assistant_name,\n" +
                "CAST(AES_DECRYPT(from_base64(r.sign_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR) AS sign_doctor_name,\n" +
                "CAST(AES_DECRYPT(from_base64(r.health_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR) AS health_doctor_name,\n" +
                "CAST(AES_DECRYPT(from_base64(r.create_user_name),'jkzl2021ZJXL*#%a')AS CHAR)AS create_user_name,\n" +
                "CAST(AES_DECRYPT(from_base64(r.update_user_name),'jkzl2021ZJXL*#%a')AS CHAR)AS update_user_name \n" ;
        sql = sql.replace("*", sqlTmp);
        return sql;
    }
    public static String deviceGrantDoctorName(String sql){
        return sql.replaceAll("d.grant_doctor_name","CAST(AES_DECRYPT(from_base64(d.grant_doctor_name),'jkzl2021ZJXL*#%a')AS char)");
    }
@ -20,4 +68,59 @@ public class TransforSqlUtl {
    public static String wlyyPatientDeviceLocationIdCard(String sql){
        return sql.replaceAll("idcard","CAST(AES_DECRYPT(from_base64(idcard),'jkzl2021ZJXL*#%a')AS char)");
    }
    public static String wlyy_patient_rehabilitation_planName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) AS name ";
        return sql.replaceAll("p.name",str);
    }
    public static String wlyy_patient_rehabilitation_planName2(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("p.name",str);
    }
    public static String wlyy_patient_rehabilitation_planAll2(String sql){
        String str = "p.*,CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) AS name,CAST(AES_DECRYPT(from_base64(p.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(p.update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("p.*",str);
    }
    public static String wlyy_patient_rehabilitation_planCreateName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("p.create_user_name",str);
    }
    public static String wlyy_plan_detail_appointmentAll(String sql){
        String str = "*,CAST(AES_DECRYPT(from_base64(doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(appointment_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS appointment_doctor_name";
        return sql.replace("*",str);
    }
    public static String wlyy_plan_detail_appointmentAppDoctorName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(a.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replace("a.doctor_name",str);
    }
    public static String wlyy_rehabilitation_operate_recordsDoctorName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(r.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("r.doctor_name",str);
    }
    public static String wlyy_rehabilitation_plan_detailAll(String sql){
        String str = "*,CAST(AES_DECRYPT(from_base64(doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("*",str);
    }
    public static String wlyy_rehabilitation_plan_detailAll2(String sql){
        String str = "d.*,CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(d.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(d.update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("d.*",str);
    }
    public static String wlyy_rehabilitation_plan_detailDoctorName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("d.doctor_name",str);
    }
    public static String wlyy_rehabilitation_plan_detailDoctorName2(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) as doctor_name";
        return sql.replaceAll("d.doctor_name",str);
    }
}

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

@ -483,6 +483,7 @@ public class BaseHospitalRequestMapping {
        public static final String tradeQuery= "/tradeQuery";
        public static final String selectOrderStatus="/selectOrderStatus";
        public static final String selectOrderStatusById="/selectOrderStatusById";
        public static final String selectOrderListStatus="/selectOrderListStatus";
        public static final String selectPrescriptionList = "/selectPrescriptionList";
@ -547,6 +548,9 @@ public class BaseHospitalRequestMapping {
        public static final String appletSign= "/appletSign";
        public static final String doorServiceTest= "/doorServiceTest";
        public static final String saveNationalDrug = "/saveNationalDrug";//保存药品字典
        public static final String getNationalDrugList = "/getNationalDrugList";//获取药品字典
        public static final String updateNationalDrugStatus = "/updateNationalDrugStatus";//更新药品字典状态
    }
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {

+ 70 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/PingyinUtils.java

@ -0,0 +1,70 @@
package com.yihu.jw.util.common;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
/**
 * create by hmf on 2021/2/8
 */
public class PingyinUtils {
    /**
     * 汉字转换为汉语拼音首字母,英文字符不变
     * @param chines 汉字
     * @return 拼音
     */
    public static String converterToFirstSpell(String chines){
        String pinyinName = "";
        //转化为字符
        char[] nameChar = chines.toCharArray();
        //汉语拼音格式输出类
        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
        //输出设置,大小写,音标方式等
        defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
        for (int i = 0; i < nameChar.length; i++) {
            //如果是中文
            if (nameChar[i] > 128) {
                try {
                    pinyinName +=
                            PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0].charAt(0);
                } catch (BadHanyuPinyinOutputFormatCombination e) {
                    e.printStackTrace();
                }
            }else{//为英文字符
                pinyinName += nameChar[i];
            }
        }
        return pinyinName;
    }
    /**
     * 汉字转换位汉语拼音,英文字符不变
     * @param chines 汉字
     * @return 拼音
     */
    public static String converterToSpell(String chines){
        String pinyinName = "";
        char[] nameChar = chines.toCharArray();
        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
        defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
        for (int i = 0; i < nameChar.length; i++) {
            if (nameChar[i] > 128) {
                try {
                    pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0];
                } catch (BadHanyuPinyinOutputFormatCombination e) {
                    e.printStackTrace();
                }
            }else{
                pinyinName += nameChar[i];
            }
        }
        return pinyinName;
    }
}

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

@ -29,7 +29,7 @@ import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
@ -139,7 +139,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @Autowired
    private OauthSsoService oauthSsoService;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    @Autowired
    private RegisterService registerService;
    @Autowired
@ -805,9 +805,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                    }
                }else if("1".equals(type)){
                    result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                    result = ykyyINSMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
                }else if("2".equals(type)) {
                    result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                    result = ykyyINSMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
                }
                if (result.isSuccess()) {
                    Captcha _captcha = new Captcha();

+ 6 - 6
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/TnyyController.java

@ -81,8 +81,8 @@ public class TnyyController extends EnvelopRestEndpoint {
        JSONObject object = JSONObject.parseObject(json);
        if (table.equalsIgnoreCase("HLW_CF01")){
            HlwTnCf01DO hlwTnCf01DO =  JSONObject.toJavaObject(object,HlwTnCf01DO.class);
            String cfsbSql =" select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF01'";
            String cfhmSql="select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF01_CFHM'";
            String cfsbSql =" select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF01_YD'";
            String cfhmSql="select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF01_YD_CFHM'";
            List<Map<String,Object>> cfsbList = hibenateUtils.createSQLQuery(cfsbSql);
            List<Map<String,Object>> cfhmList = hibenateUtils.createSQLQuery(cfhmSql);
            Long cfsb = 0L;
@ -90,14 +90,14 @@ public class TnyyController extends EnvelopRestEndpoint {
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
                System.out.println("cfsb:"+cfsb);
                String updateCfsb = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF01'";
                String updateCfsb = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF01_YD'";
                hibenateUtils.updateBySql(updateCfsb);
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
                System.out.println("cfhm:"+cfhm);
                String updateCfhm = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF01_CFHM'";
                String updateCfhm = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF01_YD_CFHM'";
                hibenateUtils.updateBySql(updateCfhm);
            }
            hlwTnCf01DO.setCFSB(cfsb.intValue());
@ -109,12 +109,12 @@ public class TnyyController extends EnvelopRestEndpoint {
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwTnCf02DO hlwCf02DO =  JSONObject.toJavaObject(object,HlwTnCf02DO.class);
            String sbxhSql =" select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF02'";
            String sbxhSql =" select DQZ + 1 as \"total\"  from GY_IDENTITY_MS where BMC = 'MS_CF02_YD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF02'";
                String updateSbxh = "update GY_IDENTITY_MS set DQZ=DQZ+1 where BMC = 'MS_CF02_YD'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            JSONObject object1 = new JSONObject();

+ 11 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -13,10 +13,12 @@ import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
@ -374,7 +376,7 @@ public class YkyyController extends EnvelopRestEndpoint {
                                @ApiParam(name = "sfzh", value = "身份证号", required = false)
                                    @RequestParam(value = "sfzh",required = false)String sfzh,
                                @ApiParam(name = "sjhm", value = "手机号码", required = false)
                                    @RequestParam(value = "sjhm",required = false)Float sjhm,
                                    @RequestParam(value = "sjhm",required = false)String sjhm,
                                @ApiParam(name = "ybkh", value = "医保卡号", required = false)
                                    @RequestParam(value = "ybkh",required = false)String ybkh,
                                @ApiParam(name = "lxdz", value = "联系地址", required = false)
@ -409,4 +411,12 @@ public class YkyyController extends EnvelopRestEndpoint {
                              @RequestParam(value = "jzkh",required = false)String jzkh){
        return success(ykyyEntranceService.updateJzkh(brid,jzkh));
    }
    @GetMapping(value = "/updateSfzh")
    @ApiOperation(value = "更新患者身份证号")
    public Envelop updateSfzh(@ApiParam(name = "brid", value = "病人id", required = true)
                              @RequestParam(value = "brid",required = true)Float brid,
                              @ApiParam(name = "sfzh", value = "身份证号", required = false)
                              @RequestParam(value = "sfzh",required = false)String sfzh){
        return success(ykyyEntranceService.updateSfzh(brid,sfzh));
    }
}

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

@ -473,7 +473,7 @@ spring:
  profiles: tnJwprod
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://10.9.1.246:1433;DatabaseName=tazyy
    url: jdbc:sqlserver://10.9.1.246:1433;DatabaseName=ta_zyy
    username: sa
    password: jsjzx@1234
  jpa:

+ 16 - 30
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -35,11 +35,11 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
@ -189,7 +189,7 @@ public class UnSettledHISPrescriptionService {
                    JSONObject json = jsonArray.getJSONObject(i);
                    String cfsb = json.getString("CFSB");
                    //查找对应的处方
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR,w.DOCTOR_NAME,to_char(w.CREATE_TIME,'YYYY-MM-DD hh24:mi:ss')  AS \"CREATE_TIME\" from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' and status <> 11 ORDER BY w.CREATE_TIME desc";
                    String sql = "SELECT w.OUTPATIENT_ID,w.ID,w.DOCTOR,w.DOCTOR_NAME from WLYY_PRESCRIPTION w WHERE REAL_ORDER = '"+cfsb+"' and status <> 11 ORDER BY w.CREATE_TIME desc";
                    List<Map<String, Object>> pre = hibenateUtils.createSQLQuery(sql);
                    if(pre!=null && pre.size()>0){
                        String prescriptionId = pre.get(0).get("ID").toString();
@ -209,17 +209,10 @@ public class UnSettledHISPrescriptionService {
                        System.out.println("发送诊断消息成功:"+immsg);
                        //发送短信提醒
                        String content = "";
                        SmsTemplateDO smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                        if (smsTemplateDO!=null){
                            content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                            ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                        }
                        SmsTemplateDO smsTemplateDO1 = smsTemplateDao.findByClientId("check_failed_doctor");
                        if (smsTemplateDO1!=null){
                            content = smsTemplateDO.getContent().replace("{{医生姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}",pre.get(0).get("CREATE_TIME").toString())
                                    .replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                            ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                        }
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findByRealOrder(cfsb);
                        BaseDoctorDO baseDoctorDO = doctorDao.findById(doctor);
                        ykyySMSService.sendSmsByTempcode("check_failed",wlyyOutpatientDO,prescriptionDO,baseDoctorDO.getMobile());
                    }
                }
            }
@ -268,16 +261,16 @@ public class UnSettledHISPrescriptionService {
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                    });
                                    //保存发送模板记录,
                                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                    wxPushLogDO.setCreateTime(new Date());
                                    wxPushLogDO.setOpenid(prescriptionId);
                                    wxPushLogDO.setReceiver(patientDO.getId());
                                    wxPushLogDO.setWechatId(wechatId);
                                    wxPushLogDO.setReceiverName(patientDO.getName());
                                    wxPushLogDO.setScene("djsxxtz");
                                    wxPushLogDao.save(wxPushLogDO);
                                }
                                //保存发送模板记录,
                                WxPushLogDO wxPushLogDO = new WxPushLogDO();
                                wxPushLogDO.setCreateTime(new Date());
                                wxPushLogDO.setOpenid(prescriptionId);
                                wxPushLogDO.setReceiver(patientDO.getId());
                                wxPushLogDO.setWechatId(wechatId);
                                wxPushLogDO.setReceiverName(patientDO.getName());
                                wxPushLogDO.setScene("djsxxtz");
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
@ -305,14 +298,7 @@ public class UnSettledHISPrescriptionService {
                                }
                                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                                imService.pushPrescriptionImMessage(prescriptionVO);
                                //发送审核成功短信提醒
                                //发送短信提醒
                                String content = "";
                                SmsTemplateDO smsTemplateDO = smsTemplateDao.findByClientId("check_failed_patient");
                                if (smsTemplateDO!=null&&wlyyOutpatientDO!=null){
                                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{处方编号}}",cfsb);
                                    ykyySMSService.ykyySendSMS(wlyyOutpatientDO.getConsumerMobile(),content);
                                }
                                ykyySMSService.sendSmsByTempcode("check_success_patient",wlyyOutpatientDO,wlyyPrescriptionDO,"");
                            }
                        }
                    }

+ 3 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -15,7 +15,7 @@ import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
@ -55,7 +55,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    private final String KEY_SUFFIX = ":code";
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
@ -195,7 +195,7 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                System.out.println("发送眼科验证码开始");
                ResultMsg result= null;
                result = ykyySMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                result = ykyyINSMSService.ykyySendSMS(phoneNum, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
                if (result.isSuccess()){
                    this.store(client_id, phoneNum, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");

+ 51 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
@ -26,6 +27,7 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
import com.yihu.jw.hospital.message.service.BaseUserMsgService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -35,6 +37,7 @@ import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.SysDictService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -49,7 +52,7 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
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.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -185,9 +188,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @Autowired
    private YkyySMSService ykyySMSService;
    private YkyyINSMSService ykyyINSMSService;
    @Autowired
    private BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private SystemMessageService systemMessageService;
    @Autowired
    private ConsultDao consultDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -976,7 +983,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().contains("鼻/咽拭子")){
                                if (waitPayDetailVO.getItemName().contains("核酸检测")){
                                    //判断检查订单
                                    List<BaseNatAppointmentDO> baseNatAppointmentDOS = baseNatAppointmentDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                    for (BaseNatAppointmentDO natAppointmentDO:baseNatAppointmentDOS){
@ -1547,6 +1554,46 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/testsms")
    public void testsms(String mobile ,String contet){
        ykyySMSService.ykyySendSMS(mobile,contet);
        ykyyINSMSService.ykyySendSMS(mobile,contet);
    }
    @GetMapping("/smsToDoctor")
    public Envelop sentMessageRemindSms(@RequestParam(value = "consult", required = true)String consult){
        ConsultDo consultDo = consultDao.findOne(consult);
        return  success(systemMessageService.sendDoctorRemindSms(consultDo));
    }
    /**
     * 充值卡一支付
     * @param mzhm
     * @param jkje
     * @param type
     * @param paymentType
     * @param patientId
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.yktMedicalCardTopUp)
    @ApiOperation("眼科--充值卡支付")
    public ObjEnvelop yktMedicalCardTopUp(
            @ApiParam(name = "mzhm", value = "卡号", required = true)
            @RequestParam(required = true)String mzhm,
            @ApiParam(name = "jkje", value = "充值金额", required = true)
            @RequestParam(required = true)Double jkje,
            @ApiParam(name = "type", value = "类型0 就诊卡号 1 门诊卡号", required = true)
            @RequestParam(required = true)Integer type,
            @ApiParam(name = "paymentType", value = "1支付宝 2微信", required = true)
            @RequestParam(required = true)Integer paymentType,
            @ApiParam(name = "patientId", value = "居民code", required = true)
            @RequestParam(required = true)String patientId,
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @RequestParam(required = true)String hospitalId,
            @ApiParam(name = "wxPayType", value = "微信交易类型 公众号支付:JSAPI  原生扫码支付:NATIVE", required = true)
            @RequestParam(required = true)String wxPayType,
            @ApiParam(name = "appletCode", value = "appletCode", required = false)
            @RequestParam(required = false)String appletCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.yktMedicalCardTopUp(mzhm,jkje,type,paymentType,patientId,wxId,hospitalId,wxPayType,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}

+ 62 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/NationalDrugDictEndpoint.java

@ -0,0 +1,62 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import com.yihu.jw.hospital.prescription.service.NationalDrugDictService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.Prescription.PREFIX)
@Api(value = "药品字段维护", description = "药品字段维护", tags = {"药品字段维护"})
public class NationalDrugDictEndpoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(NationalDrugDictEndpoint.class);
    @Autowired
    private NationalDrugDictService nationalDrugDictService;
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveNationalDrug)
    @ApiOperation(value = "保存药品字典接口")
    public ObjEnvelop saveNationalDrug(@ApiParam(name = "jsonData", value = "药品json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        BaseNationalDrugDictDO nationalDrugDictDO = objectMapper.readValue(jsonData, BaseNationalDrugDictDO.class);
        return success(nationalDrugDictService.saveNationalDrug(nationalDrugDictDO));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getNationalDrugList)
    @ApiOperation(value = "获取药品字典接口")
    public MixEnvelop getNationalDrugList(@ApiParam(name = "name", value = "药品名称")
                                          @RequestParam(name = "name", required = false) String name,
                                          @ApiParam(name = "number", value = "药品编码")
                                          @RequestParam(name = "number", required = false) String number,
                                          @ApiParam(name = "hospital", value = "所属机构")
                                          @RequestParam(name = "hospital", required = false) String hospital,
                                          @ApiParam(name = "status", value = "状态")
                                          @RequestParam(name = "status", required = false) Integer status,
                                          @ApiParam(name = "page", value = "当前页")
                                          @RequestParam(name = "page", required = false) Integer page,
                                          @ApiParam(name = "pageSize", value = "页面大小")
                                          @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        return nationalDrugDictService.getNationalDrugList(name, number, hospital, status, page, pageSize);
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateNationalDrugStatus)
    @ApiOperation(value = "更新药品字典状态")
    public Envelop updateNationalDrugStatus(@ApiParam(name = "id", value = "药品id")
                                       @RequestParam(name = "id", required = true) Integer id,
                                            @ApiParam(name = "status", value = "状态")
                                               @RequestParam(name = "status", required = false) Integer status){
        nationalDrugDictService.updateNationalDrugStatus(id,status);
        return success();
    }
}

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

@ -1558,9 +1558,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @RequestParam(required = true)String hospitalId,
            @ApiParam(name = "wxPayType", value = "微信交易类型 公众号支付:JSAPI  原生扫码支付:NATIVE", required = true)
            @RequestParam(required = true)String wxPayType) throws Exception {
            @RequestParam(required = true)String wxPayType,
            @ApiParam(name = "appletCode", value = "appletCode", required = false)
            @RequestParam(required = false)String appletCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.yktMedicalCardTopUp(mzhm,jkje,type,paymentType,patientId,wxId,hospitalId,wxPayType));
            return ObjEnvelop.getSuccess("ok",businessOrderService.yktMedicalCardTopUp(mzhm,jkje,type,paymentType,patientId,wxId,hospitalId,wxPayType,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -1590,7 +1592,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询支付状态
     * @param id
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderStatusById)
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatusById(
            @ApiParam(name = "id", value = "订单id", required = true)
            @RequestParam(required = true)Integer id) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatusById(id));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询支付info
@ -2551,7 +2569,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/saveNatAppointment")
    @ApiOperation(value = "核酸检测预约接口")
    public Envelop saveNatAppointment(@ApiParam(name = "mediaCard", value = "mediaCard")
    public Envelop saveNatAppointment(@ApiParam(name = "chargeAmount", value = "chargeAmount")
                                          @RequestParam(value = "chargeAmount",required = false)String chargeAmount,
                                      @ApiParam(name = "inspectionName", value = "inspectionName")
                                          @RequestParam(value = "inspectionName",required = false)String inspectionName,
            @ApiParam(name = "mediaCard", value = "mediaCard")
                                          @RequestParam(value = "mediaCard",required = false)String mediaCard,
                                      @ApiParam(name = "patientId", value = "patientId")
                                          @RequestParam(value = "patientId",required = false)String patientId,
@ -2592,7 +2614,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "cardNoType", value = "cardNoType")
                                          @RequestParam(value = "cardNoType",required = false)String cardNoType){
        try {
            return success(prescriptionService.saveNatAppointment(mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName,pm,pushChannel,pushFlag,cardNoType,getUID()));
            return success(prescriptionService.saveNatAppointment(chargeAmount,inspectionName,mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,cityName,townName,streetName,pm,pushChannel,pushFlag,cardNoType,getUID()));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
@ -2661,12 +2683,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(required = false) String appointmentTimeEnd,
            @ApiParam(name = "isSuccess", value = "1成功  0失败")
            @RequestParam(value = "isSuccess", required = false) Integer isSuccess,
            @ApiParam(name = "orderNo", value = "订单号")
            @RequestParam(value = "orderNo", required = false) String  orderNo,
            @ApiParam(name = "page", value = "页数")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页大小")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return prescriptionService.getNatAppointmentList(realOrder, name, hospitalFlag, mobile, idcard, payStatus, medicare, createTimeStart, createTimeEnd, appointmentTimeStart,appointmentTimeEnd,isSuccess, page, pageSize);
            return prescriptionService.getNatAppointmentList(realOrder, name, hospitalFlag, mobile, idcard, payStatus, medicare, createTimeStart, createTimeEnd, appointmentTimeStart,appointmentTimeEnd,isSuccess, page, pageSize,orderNo);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }

+ 1 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatCoreController.java

@ -156,6 +156,7 @@ public class WechatCoreController extends EnvelopRestEndpoint {
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, wxAccessTokenDO.getAccessToken());
                logger.info("返回xml:"+xmlStr);
                // 判断返回值是xml、json格式(取关是空串)
                Boolean flag = weiXinCoreService.isXML(xmlStr);
                if (xmlStr == "error") {

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

@ -130,7 +130,7 @@ public class WeiXinEventProcess {
            String url = null;
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fintel.yanketong.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
                url = "https://intel.yanketong.com/ims-wx/redirect.html";
                picUrl = "https://intel.yanketong.com/group1/M00/00/13/wKghxmAZD-iAEyHgAAA-zHpYNyg537.png";
                article.put("Url", url);
                article.put("Title", "核酸检测预约");

+ 5 - 3
svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt

@ -2,9 +2,10 @@
"button":[
   {
	  "name":"掌上医院",
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
	  "type":"miniprogram",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect",
      "appid":"wx5329829ab3d77bc2",
      "pagepath":"pages/patient/index"
   },
   {
	  "name":"就医问诊",
@ -13,6 +14,7 @@
               		"type":"view",
               		"name":"核酸预约申请",
               		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fintel.yanketong.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
               },
		 {
         		"type":"view",

+ 8 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -2,6 +2,7 @@ package com.yihu.jw.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dao.SpecialistPatientRelationDao;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -17,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -35,6 +37,8 @@ public class SpecialistController extends EnvelopRestEndpoint {
    private Tracer tracer;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private SpecialistPatientRelationDao specialistPatientRelationDao;
    @PostMapping(value = SpecialistMapping.specialist.createSpecialistRelation)
    @ApiOperation(value = "创建专科医生与患者匹配关系")
@ -462,6 +466,10 @@ public class SpecialistController extends EnvelopRestEndpoint {
            }
//            specialistPatientRelationDO.setDoctor(getUID());
//            specialistPatientRelationDO.setDoctorName(getUNAME());
            List<SpecialistPatientRelationDO> list = specialistPatientRelationDao.findListByTeamAndPatient(specialistPatientRelationDO.getTeamCode(),specialistPatientRelationDO.getPatient());
            if (list.size()>0){
                return ObjEnvelop.getSuccess("success", list.get(0));
            }
            return specialistService.createPatientInSpeciaRelation(specialistPatientRelationDO);
        }catch (Exception e){
            e.printStackTrace();

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -35,4 +35,7 @@ public interface SpecialistPatientRelationDao extends PagingAndSortingRepository
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.doctor=?3 and p.status>=0 and p.status >=0 and p.signStatus=1")
    List<SpecialistPatientRelationDO> findListByTeamCodeAndPatientAndDoctor(Integer teamCode,String patient,String doctor);
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.status>=0 and p.status >=0 and p.signStatus=1")
    List<SpecialistPatientRelationDO> findListByTeamAndPatient(Integer teamCode,String patient);
}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 13
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java


+ 91 - 95
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -10,7 +10,7 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -73,23 +73,21 @@ public class SpecialistService{
    public MixEnvelop<SpecialistPatientRelationVO, SpecialistPatientRelationVO> findSpecialistPatientRelation(String doctor, Integer page, Integer size)throws ParseException {
        String sql = "SELECT " +
                " r.id, " +
                " r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctor_name") +
                " r.doctor ,r.doctor_name AS doctor_name " +
                " ,r.saas_id AS sassId, " +
                " r.patient " +
                 AesEncryptUtils.decryptMysql("r.patient_name","patient_name") +
                " ,r.health_doctor AS healthDoctor " +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                " r.patient ,r.patient_name AS patient_name" +
                " ,r.health_doctor AS healthDoctor ,r.health_doctor_name AS healthDoctorName" +
                " ,r.sign_code AS signCode, " +
                " r.sign_year AS signYear, " +
                " r.sign_doctor AS sign_doctor " +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                " r.sign_doctor AS sign_doctor ,r.sign_doctor_name AS signDoctorName" +
                " ,r.create_time AS createTime," +
                " r.status " +
                "FROM " +
                " wlyy_specialist_patient_relation r " +
                "WHERE " +
                " r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 ORDER BY r.create_time DESC LIMIT "+(page-1)*size+","+size;
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.doctor_name","r.patient_name","r.health_doctor_name","r.sign_doctor_name");
        List<SpecialistPatientRelationVO> specialistPatientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationVO.class));
        String sqlcount = "SELECT count(1) AS total " +
@ -134,8 +132,7 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findNoLabelPatientRelation(String doctor){
        String sql ="SELECT " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient ,r.patient_name as patientName" +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo, " +
                " rd.create_time AS createTime ," +
@ -155,6 +152,8 @@ public class SpecialistService{
                "   i.label_type = '7' AND " +
                "   i.status = 1 " +
                " )";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
@ -174,8 +173,7 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findPatientRelatioByAssistant(String doctor , String assistant, Integer page, Integer size){
        String sql ="SELECT " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient ,r.patient_name as patientName" +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo ," +
                " p.sex," +
@ -198,6 +196,7 @@ public class SpecialistService{
                "  r.doctor = '"+doctor+"' AND r.status >=0  AND r.sign_status >0 "+
                " AND r.health_assistant = '"+assistant+"' LIMIT "+(page-1)*size+","+size;
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
@ -206,8 +205,7 @@ public class SpecialistService{
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
        String sql="SELECT " +
                " p. CODE " +
                AesEncryptUtils.decryptMysql("s.patient_name","name") +
                " p. CODE ,s.patient_name as name," +
                " p.sex," +
                " IFNULL( " +
                "  YEAR ( " +
@ -221,8 +219,7 @@ public class SpecialistService{
                " p.photo, " +
                " lb.labelName as health, " +
                " lb.label AS healthcode ," +
                " s.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("s.health_assistant_name","healthAssistantName") +
                " s.health_assistant AS healthAssistant,s.health_assistant_name as healthAssistantName " +
//                " s.health_assistant_name AS healthAssistantName," +
                " ,s.is_manage AS isManage," +
                " s.id AS specialCode" +
@ -242,6 +239,7 @@ public class SpecialistService{
                " ) lb " +
                " JOIN "+basedb+".wlyy_patient p ON p. CODE = lb.patient " +
                " JOIN wlyy_specialist_patient_relation s ON s.patient = lb.patient ";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"s.patient_name","s.health_assistant_name");
        if(StringUtils.isNotBlank(shareDoctor)){
            sql = sql + " JOIN "+basedb+".wlyy_doctor_special_share sp ON s.id = sp.special_code and sp.doctor = '"+shareDoctor+"' ";
        }
@ -251,8 +249,7 @@ public class SpecialistService{
        System.out.print("日志:"+sql);
        if("7".equals(labelType)){
            sql = "SELECT " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
                    "c.CODE,a.patient_name as name" +
//                    "c.NAME," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
@ -260,8 +257,7 @@ public class SpecialistService{
                    "b.disease_name AS labelName," +
                    "d.label_name AS health," +
                    "d.label AS healthcode," +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
                    "a.health_assistant AS healthAssistant,a.health_assistant_name AS healthAssistantName," +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    ",a.is_manage AS isManage, " +
                    "a.id AS specialCode " +
@ -276,18 +272,17 @@ public class SpecialistService{
//                    "AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
                    " AND a.team_code ='" +teamCode+"' "+
                    " LIMIT "+(page-1)*size+","+size;
            sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"a.patient_name","a.health_assistant_name");
        }
        
        if("pending".equals(labelType)){
            sql = "SELECT " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
                    "c.CODE, a.patient_name as name" +
//                    "c.NAME," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "c.photo," +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
                    "a.health_assistant AS healthAssistant,a.health_assistant_name as healthAssistantName" +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    ",a.is_manage AS isManage " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
@ -295,8 +290,8 @@ public class SpecialistService{
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND (a.is_manage = 0 or a.is_manage is null)" +
                    " AND a.team_code ='" +teamCode+"' "+
                    " LIMIT "+(page-1)*size+","+size;
            sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"a.patient_name","a.health_assistant_name");
        }
        
        List<PatientLabelVO> PatientLabelVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientLabelVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,PatientLabelVOs);
    }
@ -345,8 +340,7 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " p.code AS patient,r.patient_name as patientName  " +
//                " p.`name` AS patientName, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
@ -362,8 +356,9 @@ public class SpecialistService{
                "  t.label_name, " +
                "  t.patient " +
                " FROM " +
                "  "+basedb+".wlyy_sign_patient_label_info t " +
                " WHERE " +
                "  "+basedb+".wlyy_sign_patient_label_info t ";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        String tmpSql = " WHERE " +
                "  t.label_type = '8' " +
                " AND t.`status` = '1' " +
                " ) h ON h.patient = r.patient " +
@ -371,9 +366,10 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND " + AesEncryptUtils.decryptMysqlNo("r.patient_name") + " LIKE '%"+nameKey+"%' "+
                " AND " + "r.patient_name" + " LIKE '%"+nameKey+"%' "+
                " LIMIT "+(page-1)*size+","+size;
        tmpSql = TransforSqlUtl.wlyySpecialistPatientRelationLike(tmpSql,"r.patient_name");
        sql = sql+tmpSql;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
@ -382,8 +378,7 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByNameOrIdCard(String doctor, String filter,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
                " p.code AS code " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " p.code AS code,r.patient_name as patientName " +
//                " p.`name` AS name, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
@ -400,8 +395,9 @@ public class SpecialistService{
                "  t.label_name, " +
                "  t.patient " +
                " FROM " +
                "  "+basedb+".wlyy_sign_patient_label_info t " +
                " WHERE " +
                "  "+basedb+".wlyy_sign_patient_label_info t " ;
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        String sqlTmp=  " WHERE " +
                "  t.label_type = '8' " +
                " AND t.`status` = '1' " +
                " ) h ON h.patient = r.patient " +
@ -409,9 +405,10 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND (" +  AesEncryptUtils.decryptMysqlNo("r.patient_name")  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " AND (" +  "r.patient_name"  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " LIMIT "+(page-1)*size+","+size;
        sqlTmp = TransforSqlUtl.wlyySpecialistPatientRelationLike(sqlTmp,"r.patient_name");
        sql = sql+sqlTmp;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientRelationVOs);
@ -448,8 +445,8 @@ public class SpecialistService{
        }
        String sql ="SELECT " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " p.code AS patient ,r.patient_name as patientName" +
                //AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS patientName, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
@ -475,6 +472,7 @@ public class SpecialistService{
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND r.health_assistant IS NULL "+
                " LIMIT "+(page-1)*size+","+size;
        sql  = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
        return MixEnvelop.getSuccessList(SpecialistMapping.api_success,patientRelationVOs,total.intValue());
@ -486,14 +484,14 @@ public class SpecialistService{
        //1.查询该居民是否已经与该专科医生签约
        String checkDoctorSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient ,r.patient_name as patientName " +
                //AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
                " d.photo ," +
                " d.code AS doctor" +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
                " d.code AS doctor, r.doctor_name as doctorName" +
               // AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " d.name AS doctorName" +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
@ -505,6 +503,7 @@ public class SpecialistService{
                " AND r.`status` >= 0 " +
                " AND r.sign_status >=0 " +
                " AND t.available = '1' ";
        checkDoctorSql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(checkDoctorSql,"r.patient_name","r.doctor_name");
        List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(checkDoctorSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
@ -519,8 +518,7 @@ public class SpecialistService{
        //验证团队是否已经签约
        String checkTeamSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient ,r.patient_name as patientName" +
//                " r.patient_name AS patientName, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
@ -535,6 +533,7 @@ public class SpecialistService{
                " AND r.`status` >=0 " +
                " AND r.sign_status >=0 " +
                " AND t.available = '1' ";
        checkTeamSql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(checkTeamSql,"r.patient_name");
        List<SpecialistTeamVO> teamVOs = jdbcTemplate.query(checkTeamSql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(teamVOs!=null&&teamVOs.size()>0){
@ -565,8 +564,7 @@ public class SpecialistService{
    public List<AdminTeamMemberVO> findTeamMember(Long teamId){
        String menberSql = "SELECT " +
                " m.doctor_code AS doctorCode " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                        " d.`name` AS doctorName " +
                        " d.`name` AS doctorName " +
                " FROM " +
                " "+basedb+".wlyy_admin_team_member m " +
                " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
@ -600,11 +598,11 @@ public class SpecialistService{
    public MixEnvelop<PatientSignInfoVO, PatientSignInfoVO> findPatientSigninfo(String code){
        String sql = "SELECT " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient ,r.patient_name as patientName" +
               // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " ,r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
                " ,r.doctor ,r.doctor_name as doctorName" +
                //AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " r.doctor_name AS doctorName, " +
                " ,d.hospital, " +
                " d.hospital_name AS hospitalName, " +
@ -623,6 +621,7 @@ public class SpecialistService{
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " WHERE " +
                " r.id = '"+code+"'";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name","r.doctor_name");
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper(PatientSignInfoVO.class));
        PatientSignInfoVO patientSignInfoVO = (null != patientSignInfoVOs && patientSignInfoVOs.size() > 0 ? patientSignInfoVOs.get(0) : new PatientSignInfoVO());
        return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientSignInfoVO);
@ -631,14 +630,14 @@ public class SpecialistService{
    public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.patient r.patient_name as patientName" +
               // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " ,r.team_code,r.sign_date , " +
                " t.`name` AS name," +
                " d.photo," +
                " md.code AS doctor" +
                AesEncryptUtils.decryptMysql("md.name","doctorName") +
                " md.code AS doctor,md.name as doctorName" +
              //  AesEncryptUtils.decryptMysql("md.name","doctorName") +
//                " md.name AS doctorName," +
                ",d.hospital,d.hospital_name " +
                " FROM " +
@ -650,6 +649,7 @@ public class SpecialistService{
                " r.patient = '"+patient+"' " +
                " AND r.`status` >=0  " +
                " AND r.sign_status >0";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        List<SpecialistTeamVO> specialistTeamVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistTeamVO.class));
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
@ -665,11 +665,12 @@ public class SpecialistService{
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " r.team_code AS teamCode,r.patient_name as patientName" +
               // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " d.name AS doctorName, " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
                ",d.name as doctorName"+
               // AesEncryptUtils.decryptMysql("d.name","doctorName") +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.dept, " +
@ -686,6 +687,7 @@ public class SpecialistService{
                " r.patient ='"+patient+"' " +
                " AND r.`status`>=0 " +
                " AND r.sign_status >0";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name");
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs);
    }
@ -697,15 +699,13 @@ public class SpecialistService{
                "(SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " ,r.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
//                " r.health_assistant_name AS healthAssistantName," +
                " ,r.create_time AS createTime" +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                " d.name AS doctorName, " +
                " r.team_code AS teamCode,r.patient_name as patientName" +
               // AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " ,r.health_assistant AS healthAssistant,r.health_assistant_name as healthAssistantName" +
                //AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
                " ,r.create_time AS createTime," +
//                AesEncryptUtils.decryptMysql("d.name","doctorName") +
                " d.name AS doctorName, " +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.dept, " +
@ -725,6 +725,7 @@ public class SpecialistService{
                "  WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctor+"') AND  m.available='1')" +
//                " AND r.`status`>=0 " +
                " AND r.sign_status >0 ) r join "+basedb+".wlyy_patient p on r.patient = p.code order by p.czrq DESC ";
        sql = TransforSqlUtl.wlyySpecialistPatientRelationReplay(sql,"r.patient_name","r.health_assistant_name");
        List<PatientSignInfoVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientSignInfoVO.class));
        PatientSignInfoVO patientSignInfoVO = (null != patientSignInfoVOs && patientSignInfoVOs.size() > 0 )? patientSignInfoVOs.get(0):null;
        return MixEnvelop.getSuccess(SpecialistMapping.api_success, patientSignInfoVO);
@ -737,8 +738,8 @@ public class SpecialistService{
        if(StringUtils.isNotBlank(name)){
            sql = "SELECT " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
//                    AesEncryptUtils.decryptMysql("doctor.name","name") +
                    ",doctor.NAME AS NAME" +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
@ -762,12 +763,12 @@ public class SpecialistService{
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode and " + AesEncryptUtils.decryptMysqlNo("doctor.name")  + "  like '%"+name+"%'";
                    "t ON doctor.CODE=t.doctorcode and doctor.NAME like '%"+name+"%'";
        }else{
            sql = "SELECT " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
//                    AesEncryptUtils.decryptMysql("doctor.name","name") +
                    ",doctor.NAME AS NAME" +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
@ -817,8 +818,8 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO,PatientRelationVO> getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) {
        String sql ="SELECT " +
                "p.CODE AS patient" +
                AesEncryptUtils.decryptMysql("p.name","patientName") +
//                "p.`name` AS patientName," +
//                AesEncryptUtils.decryptMysql("p.name","patientName") +
                ",p.`name` AS patientName" +
                ",p.photo," +
                "IFNULL(YEAR (from_days(datediff(now(),p.birthday))),'未知') age," +
                "p.sex " +
@ -829,8 +830,8 @@ public class SpecialistService{
                "  AND doctor='"+specialdoctor+"') " +
                "  AND (a.doctor='"+familydoctor+"' OR a.doctor_health='"+familydoctor+"') ";
        if(StringUtils.isNotBlank(nameKey)){
            sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
            sql= sql + " AND  a.name LIKE '%"+nameKey+"%' ";
//            sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
        }
        sql= sql +" AND a.`status`=1 AND a.expenses_status=1) s ON p.CODE=s.patient" +
                " LIMIT "+(page-1)*size+","+size;
@ -847,7 +848,8 @@ public class SpecialistService{
                "IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                "p.birthday, " +
                "p.photo " +
                "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
//                "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
                "FROM (SELECT s.disease,s.disease_name,s.patient s.patient_name,r.team_code from " +
                "(SELECT id, team_code FROM wlyy_specialist_patient_relation WHERE doctor='" + doctor + "' and sign_status > 0 and `status` >= 0) r " +
                "JOIN "+basedb+".wlyy_patient_disease_server s on r.id = s.specialist_relation_code WHERE s.del = 1) s " +
                "JOIN "+basedb+".wlyy_patient p on s.patient = p.`code` where p.`status` >0 ";
@ -967,7 +969,7 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql));
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code, wd.NAME as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1018,7 +1020,7 @@ public class SpecialistService{
        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate());
        //1、获取居民基础信息
        String preSql = "SELECT p.photo as photo" +  AesEncryptUtils.decryptMysql("p.name","name") + ", p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
        String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
        String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
@ -1039,9 +1041,9 @@ public class SpecialistService{
        jsonObject.put("patientInfo", map);
        //2、获取医生信息(所属医院、科室、姓名)
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        if("0".equals(signStatus)){
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
        }
        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql);
        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) {
@ -1052,8 +1054,7 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", result);
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code, wd.NAME as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1174,13 +1175,8 @@ public class SpecialistService{
    public List<SpecialistPatientRelationDO> selectByAssistant(String patient,String doctor){
        String sql = "select *" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                AesEncryptUtils.decryptMysql("r.create_user_name","createUserName") +
                " from wlyy_specialist_patient_relation r where r.health_assistant = '"+doctor+"' and r.patient = '"+patient+"' ";
        sql = TransforSqlUtl.specialistPatientRelationAll(sql);
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        return relationDOS;
    }
@ -1192,8 +1188,7 @@ public class SpecialistService{
     */
    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
        String sql1 = " select count(1) as num ";
        String sql2 = " select p.idcard" + AesEncryptUtils.decryptMysql("p.name","name")  + ",p.code,p.photo";
        String sql2 = " select p.name as name,p.idcard,p.code,p.photo";
        String whereSql ="";
        if(!StringUtils.isEmpty(keywords)){
            whereSql+=" and  p.mobile ='"+keywords+"'";
@ -1267,6 +1262,7 @@ public class SpecialistService{
                " SELECT m.doctor_code  FROM wlyy.wlyy_admin_team_member m " +
                " WHERE  m.team_id IN ( SELECT dt.id  FROM  wlyy.wlyy_admin_team dt LEFT JOIN wlyy.wlyy_admin_team_member watm ON dt.id = watm.team_id   WHERE " +
                " dt.available = '1' AND watm.available = '1'  AND watm.doctor_code = '"+doctor+"') AND m.available = '1'  ) and r.patient = '"+patient+"' and r.sign_status=0";
        sql  = TransforSqlUtl.specialistPatientRelationAll2(sql);
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        SpecialistPatientRelationDO specialistPatientRelationDO=null!=relationDOS&&relationDOS.size()>0?relationDOS.get(0):new SpecialistPatientRelationDO();
        return specialistPatientRelationDO;
@ -1310,10 +1306,10 @@ public class SpecialistService{
        }
        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
//        toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        String doctorName = jdbcTemplate.queryForObject(sql,String.class);
        doctorName = AesEncryptUtils.decrypt(doctorName);
//        doctorName = AesEncryptUtils.decrypt(doctorName);
        JSONObject result = new JSONObject();
        JSONArray planObject = new JSONArray();
        JSONArray planDetailObject = new JSONArray();
@ -1322,7 +1318,7 @@ public class SpecialistService{
        for (String patientCode:patient){
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            patientName = AesEncryptUtils.decrypt(patientName);
//            patientName = AesEncryptUtils.decrypt(patientName);
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
                for (PatientRehabilitationPlanDO plan:planList){
                    plan.setCreateUser(toDoctorCode);

+ 2 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistServiceItemService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.SpecialistEvaluateDO;
import com.yihu.jw.entity.specialist.SpecialistServiceItemDO;
import com.yihu.jw.entity.specialist.SpecialistServiceItemOperateLogDO;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.ISqlUtils;
@ -168,6 +169,7 @@ public class SpecialistServiceItemService {
    public MixEnvelop<SpecialistServiceItemDO,SpecialistServiceItemDO> selectByHospital(String hospital){
        MixEnvelop<SpecialistServiceItemDO,SpecialistServiceItemDO> envelop = new MixEnvelop<>();
        String sql = "select * from wlyy_service_item where status = 1 AND imediate = 1 ";
        sql = TransforSqlUtl.wlyy_service_itemAll(sql);
        List<SpecialistServiceItemDO> specialistServiceItemDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistServiceItemDO.class));
        List<SpecialistServiceItemDO> specialistServiceItemDOList = new ArrayList<>();
        for (int i =0;i<specialistServiceItemDOS.size();i++){

+ 29 - 179
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -7,6 +7,7 @@ import com.yihu.jw.dao.rehabilitation.*;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -88,12 +89,8 @@ public class RehabilitationManageService {
     */
    public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlan(Integer doctorType,String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog, String patientCondition,Integer page, Integer pageSize) throws Exception{
//        if(StringUtils.isNotEmpty(diseaseCode)){
//            leftSql += " left join "+basedb+".wlyy_patient_disease_server s on p.patient=s.patient and s.del=1 and s.disease ='"+diseaseCode+"'" ;
//        }
        String leftSql = "";
        String sql = " select p.*" + AesEncryptUtils.decryptMysql("p.name","patientName") + "  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select p.*  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        if(doctorType==2){//家医是根据签约关系过滤
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
@ -110,8 +107,9 @@ public class RehabilitationManageService {
        }
        if(StringUtils.isNotEmpty(patientCondition)){
            sql += " and " + AesEncryptUtils.descryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
            sql += " and " + AesEncryptUtils.decryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        }
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planAll2(sql);
        String finalSql = "";
        String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
@ -123,16 +121,7 @@ public class RehabilitationManageService {
        }
        finalSql =" select DISTINCT b.* from (select  plan_id,doctor from wlyy_specialist.wlyy_rehabilitation_plan_detail where  1=1 "+condition+") a " +
                " JOIN ("+sql+") b on a.plan_id=b.id ";
//        if(todaybacklog!=null&&todaybacklog==1){
//            finalSql = " select DISTINCT b.* from (select DISTINCT plan_id from wlyy_specialist.wlyy_rehabilitation_plan_detail where execute_time>='"+todayStart+"' and execute_time<='"+todayEnd+"') a "+
//                    "LEFT JOIN ("+sql+") b on a.plan_id=b.id";
//        }else{
//            finalSql = " select b.* from ("+sql+") b ";
//        }
        if(doctorType==1){//专科医生是根据计划的创建者字段过滤
//            sql+=" and (p.create_user in (select r.doctor assistant from " +
//                    " wlyy_specialist.wlyy_specialist_patient_relation r where r.health_assistant ='"+doctorCode+"') " +
//                    " or p.create_user='"+doctorCode+"') ";
            finalSql += " where  b.create_user = '"+doctorCode+"' or a.doctor ='"+doctorCode+"'";
        }
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(finalSql);
@ -211,6 +200,7 @@ public class RehabilitationManageService {
     */
    public ObjEnvelop findRehabilitationPlanDetailList(String currentDoctorCode,String patientCode) throws Exception{
        String sql = " select DISTINCT r.* from wlyy_specialist.wlyy_specialist_patient_relation r join wlyy_patient_rehabilitation_plan p on r.patient=p.patient where r.sign_status ='1' and r.status in('0','1') and r.patient='"+patientCode+"' ";
        sql = TransforSqlUtl.specialistPatientRelationAll2(sql);
        List<Map<String,Object>> specialistPatientRelationList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(Map<String,Object> temp: specialistPatientRelationList){
@ -226,6 +216,7 @@ public class RehabilitationManageService {
            resultMap.put("healthyConditionType",healthyConditionType);
            //专科医生
            String specialistRelationSql = "select r.*,t.name as teamName,h.name as specialistHospitalName from wlyy_specialist.wlyy_specialist_patient_relation r left join "+basedb+".wlyy_admin_team t on r.team_code=t.id left join "+basedb+".dm_hospital h on t.org_code=h.code where r.sign_status ='1' and r.status in('0','1') and r.patient='"+patientCode+"' and r.doctor='"+doctorCode+"'";
            specialistRelationSql = TransforSqlUtl.specialistPatientRelationAll2(specialistRelationSql);
            List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
            Map<String,Object> specialistMap = specialistRelationList.get(0);
            resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
@ -242,7 +233,7 @@ public class RehabilitationManageService {
            resultMap.put("specialistFinishItemCount",specialistFinishCount1-specialistUnfinishCount1+specialistFinishCount2-specialistUnfinishCount2);//完成项目
            resultMap.put("specialistServiceRecordCount",specialistServiceCount1+specialistServiceCount2);//服务次数
            //家庭医生(包括全科医生、健管师)
            String signFamilySql = "SELECT f.*,t.name as teamName" + AesEncryptUtils.decryptMysql("f.name","patientName") + " FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
            String signFamilySql = "SELECT f.*,t.name as teamName FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
            List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
            if(signFamilyList != null && signFamilyList.size() >0 ) {
                Map<String, Object> signFamilyMap = signFamilyList.get(0);
@ -371,6 +362,7 @@ public class RehabilitationManageService {
            sql+= " and d.status="+status;
        }
        sql += " ORDER BY d.execute_time ";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll2(sql);
        List<Map<String,Object>> rehabilitationDetailList = jdbcTemplate.queryForList(sql);
//        List<RehabilitationDetailDO> rehabilitationDetailList = rehabilitationDetailDao.findByPlanId(DateUtil.strToDate(executeStartTime),DateUtil.strToDate(executeEndTime),planId);
        Map<String,Map<String,Object>> map = new LinkedHashMap<>();
@ -515,113 +507,11 @@ public class RehabilitationManageService {
            sql+= "and d.status="+status;
        }
        sql +="  order by d.execute_time desc ";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll2(sql);
        List<Map<String,Object>> rehabilitationDetailList = jdbcTemplate.queryForList(sql);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,rehabilitationDetailList);
    }
    /**
     * 多个康复计划服务项目内容列表
     * @param planDetailIds
     * @return
     * @throws Exception
     */
  /*  public ObjEnvelop serviceItemList(String planDetailIds,String doctorCode) throws Exception{
        String[] s = planDetailIds.split(",");
        String planDetailList = "";
        for(String one:s){
            planDetailList +=",'"+one+"'";
        }
        String planDetailResult = StringUtils.isNotEmpty(planDetailList)?planDetailList.substring(1):"";
        String sql = "select i.title,i.content,i.type as itemType,i.reserve,d.id,d.execute_time,d.hospital_name,d.status,d.type as detailType,d.expense,d.doctor as executeDoctor," +
                " d.doctor_name as executeDoctorName,p.patient ,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus  " +
                " from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
                " LEFT JOIN wlyy_specialist.wlyy_hospital_service_item h on d.hospital_service_item_id = h.id "+
                " LEFT JOIN wlyy_specialist.wlyy_service_item i on i.id = h.service_item_id " +
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " where d.id in ("+planDetailResult+") order BY d.execute_time ASC ";
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
//        if(serviceItemList.size()>0){
//            Map<String,Object> serviceItem = serviceItemList.get(0);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(Map<String,Object> one:serviceItemList){
            Map<String,Object> resultMap = new HashMap<>();
            Integer isMyTask = 0;
            if(StringUtils.isNotEmpty(doctorCode)&&doctorCode.equals(one.get("executeDoctor")+"")){
                isMyTask=1;
            }
            resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
//            if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
//                executeDoctorList.add(one.get("create_user_name")+"");
//            }
            List<String> executeDoctorList = new ArrayList<>();
            executeDoctorList.add(one.get("executeDoctorName")+"");
            resultMap.put("executeDoctorList",executeDoctorList);//执行医生名称列表
            resultMap.put("executeDoctorCode",one.get("executeDoctor")+"");//执行医生code
            resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生code
            resultMap.put("specialistDoctorCode",one.get("createDoctor")+"");//创建人(专科)医生code
            resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
            resultMap.put("title",one.get("title"));//项目标题
            resultMap.put("planDetaiId",one.get("id"));//计划服务项目id
            resultMap.put("shortExecuteTime",DateUtil.dateToStr((Date) one.get("execute_time"),DateUtil.HH_MM));//项目标题
            resultMap.put("content",one.get("content"));//项目内容
            resultMap.put("hospitalName",one.get("hospital_name"));//地点
            resultMap.put("executeTime",one.get("execute_time"));//执行时间
            DecimalFormat df = new DecimalFormat("0.00");
            resultMap.put("expense",df.format(((Integer)one.get("expense")*1.00)/100.00));//收费
            resultMap.put("reserve",one.get("reserve"));//是否需要预约(1预约、0不预约)
            resultMap.put("planStatus",one.get("planStatus"));//计划的状态
            Integer status = Integer.valueOf(one.get("status").toString());//状态(0未完成,1已完成,2已预约)
            String statusName = "";
            switch (status){
                case 0:{statusName="未完成";break;}
                case 1:{statusName="已完成";break;}
                case 2:{statusName="已预约";break;}
            }
            resultMap.put("statusName",statusName);//状态
            //指导与汇报
            List<GuidanceMessageLogDO> messageList = guidanceMessageLogDao.findByPlanDetailId(one.get("id").toString());
            List<Map<String,Object>> messageMapList = new ArrayList<>();
            for(GuidanceMessageLogDO one2:messageList){
                Map<String,Object> map = new HashMap<>();
                map.put("doctorName",one2.getDoctorName());
                map.put("adminTeamName",one2.getAdminTeamName());
                map.put("content",one2.getContent());
                map.put("contentType",one2.getContentType());
                map.put("createTime",DateUtil.dateToStr(one2.getCreateTime(),"MM-dd HH:mm"));
                messageMapList.add(map);
            }
            Integer itemType = (Integer) one.get("itemType");
            resultMap.put("messageList",messageMapList);//指导与汇报记录
            resultMap.put("patient",one.get("patient"));
            resultMap.put("itemType",itemType);
            resultMap.put("detaiType",one.get("detaiType"));
            resultMap.put("status",status);//状态
            //是否完成任务
            List<RehabilitationOperateRecordsDO> operateList = rehabilitationOperateRecordsDao.findByRehabilitationDetailId(one.get("id").toString());
            Integer operate = 0;
            if(operateList.size()>0){
                operate =1;
                RehabilitationOperateRecordsDO temp = operateList.get(0);
                operate =1;
                Date completeTime = temp.getCompleteTime();
                String completeTimeStr = DateUtil.dateToStr(completeTime,DateUtil.YYYY_MM_DD_HH_MM);
                resultMap.put("completeTime",completeTimeStr);//完成时间
                resultMap.put("operatorDoctorName",temp.getDoctorName());//执行医生名称
                resultMap.put("node",temp.getNode());
                resultMap.put("relationRecordImg",(temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg()))?(new JSONArray(temp.getRelationRecordImg())):null);//json格式
                if(itemType!=1&&itemType!=0){
                    resultMap.put("relationRecordCode",temp.getRelationRecordCode());
                    resultMap.put("completeTimeShort",DateUtil.dateToStr(completeTime,"yyyy/MM/dd"));
                }
            }
            resultMap.put("operate",operate);//是否完成任务(默认0:未完成,1:已完成)
            resultList.add(resultMap);
         }
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultList);
//        }
//        return MixEnvelop.getError("没有该服务项详情信息!");
    }*/
    /**
     * 多个康复计划服务项目内容列表
     * @param planDetailIds
@ -641,6 +531,8 @@ public class RehabilitationManageService {
                " LEFT JOIN wlyy_specialist.wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " where d.id in ("+planDetailResult+") order BY d.execute_time ASC ";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planCreateName(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName(sql);
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
//        if(serviceItemList.size()>0){
//            Map<String,Object> serviceItem = serviceItemList.get(0);
@ -740,6 +632,10 @@ public class RehabilitationManageService {
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " LEFT JOIN wlyy_specialist.wlyy_plan_detail_appointment a on d.id=.a.rehabilitation_plan_detail_id " +
                " where d.id = '"+planDetailId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName2(sql);
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planCreateName(sql);
        sql = TransforSqlUtl.wlyy_plan_detail_appointmentAppDoctorName(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName(sql);
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
        if (serviceItemList.size()==0){
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,new HashMap<>());
@ -834,10 +730,13 @@ public class RehabilitationManageService {
            resultMap.put("recordFlag",temp.getFlag());
            resultMap.put("recordId",temp.getId());
            JSONArray imgs = new JSONArray();
            if (temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg())){
                imgs.put(temp.getRelationRecordImg());
                resultMap.put("relationRecordImg",(temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg()))?(new JSONArray(temp.getRelationRecordImg())):null);//json格式
            }
            else{
                resultMap.put("relationRecordImg",imgs);
            }
            resultMap.put("relationRecordImg",imgs);
         /*   if(itemType!=1&&itemType!=0){*/
                resultMap.put("relationRecordCode",temp.getRelationRecordCode());
                resultMap.put("completeTimeShort",DateUtil.dateToStr(completeTime,"yyyy/MM/dd"));
@ -907,8 +806,8 @@ public class RehabilitationManageService {
            serviceDoctorList.add(generalDoctorMap);
        }
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0  ";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 and  p.patient='"+patientCode+"'";
        specialistRelationSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName2(specialistRelationSql);
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -964,11 +863,7 @@ public class RehabilitationManageService {
            //已完成
            Integer allFinishCount = rehabilitationDetailDao.findByStatusAndPlanId(1,one.getId());
            map.put("allFinishCount",allFinishCount);//已完成
//            //未完成
//            Integer notstartedCount = rehabilitationDetailDao.completenessCount(1,one.getId());//未开始
//            Integer underwayCount = rehabilitationDetailDao.completenessCount(1,one.getId());//进行中
//            Integer unfinishedCount = notstartedCount+underwayCount;
//            map.put("unfinishedCount",unfinishedCount);//未完成
            //完成度(已完成/(已完成+未完成))
            Integer allCount = rehabilitationDetailDao.findAllByPlanId(one.getId());
            map.put("allCount",allCount);//总数
@ -989,51 +884,6 @@ public class RehabilitationManageService {
        //康复计划-已完成、进行中
        resultMap.put("planUnderway",planUnderway);//进行中
        resultMap.put("planFinish",planFinish);//已完成
//        //近期康复相关记录
////        String currentTime = DateUtil.getStringDate();
//        String planDetailSql = " select d.*,i.content,i.title from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_hospital_service_item h on d.hospital_service_item_id=h.id" +
//                " LEFT JOIN wlyy_service_item i on i.id=h.service_item_id LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where p.patient='"+patientCode+"' and d.executeTime<='"+currentTime+"' order by executeTime desc";
//        List<Map<String,Object>> planDetails = jdbcTemplate.queryForList(planDetailSql);
//        List<Map<String,Object>> planDetailList = new ArrayList<>();
//        for(Map<String,Object> one:planDetails){
//            Date executeTimeDate = (Date)one.get("execute_time");
//            String executeTime = DateUtil.dateToStr(executeTimeDate,"yyyy/MM/dd HH:mm");
//            String content = one.get("content").toString();
//            String title = one.get("title").toString();
//            Integer status = (Integer)one.get("status");
//            String statusName = "";
//            switch (status){
//                case 0:{statusName="未完成";break;}
//                case 1:{statusName="已完成";break;}
//                case 2:{statusName="已预约";break;}
//            }
//            String id = one.get("id").toString();
//            Map<String,Object> map = new HashMap<>();
//            map.put("id",id);//id
//            map.put("executeTime",executeTime);//执行时间
//            map.put("title",title);//项目标题
//            map.put("content",content);//项目内容
//            map.put("statusName",statusName);//状态名称
//            planDetailList.add(map);
//        }
//        resultMap.put("planDetailList",planDetailList);//康复相关记录列表
//        String planDetailCountSql = " select d.status as num from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_hospital_service_item h on d.hospital_service_item_id=h.id" +
//                " LEFT JOIN wlyy_service_item i on i.id=h.service_item_id LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where p.patient='"+patientCode+"'";
//        List<Map<String,Object>> planDetailList2 = jdbcTemplate.queryForList(planDetailCountSql);
//        Integer planDetailFinish = 0;
//        Integer planDetailUnfinish = 0;
//        for(Map<String,Object> one:planDetailList2){
//
//            Integer status = (Integer)one.get("status");
//            if(status==1){
//                planDetailFinish+=1;
//            }else{
//                planDetailUnfinish+=1;
//            }
//        }
//        resultMap.put("planDetailFinish",planDetailFinish);//已完成
//        resultMap.put("planDetailUnfinish",planDetailUnfinish);//未完成
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultMap);
    }
@ -1058,12 +908,8 @@ public class RehabilitationManageService {
            planDetailSql += "  and d.execute_time<='"+endTime+"' ";
        }
        //        List<Map<String,Object>> planDetailsCount = jdbcTemplate.queryForList(planDetailSql);
//        int count = 0;
//        if(planDetailsCount!=null&&planDetailsCount.size()>0){
//            count = planDetailsCount.size();
//        }
        planDetailSql += " ORDER BY s.complete_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        planDetailSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll2(planDetailSql);
        List<Map<String,Object>> planDetails = jdbcTemplate.queryForList(planDetailSql);
        List<Map<String,Object>> planDetailList = new ArrayList<>();
        for(Map<String,Object> one:planDetails){
@ -1210,8 +1056,8 @@ public class RehabilitationManageService {
            serviceDoctorList.add(healthDoctorMap);
        }
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status='1'";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 AND d.doctor IS  NOT  NULL and  d.doctor <> ''  and  p.patient='"+patientCode+"'";
        specialistRelationSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName2(specialistRelationSql);
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -1360,6 +1206,7 @@ public class RehabilitationManageService {
            }
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
            allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
            List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
            int allCount=0;
            String planId="";
@ -1566,6 +1413,7 @@ public class RehabilitationManageService {
        }
        buffer.deleteCharAt(buffer.length()-1);
        String sql = "select * from wlyy_rehabilitation_plan_detail where id in("+buffer+")";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(sql);
        List<RehabilitationDetailDO> rehabilitationDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(RehabilitationDetailDO.class));
        envelop.setObj(rehabilitationDetailDOS);
        return envelop;
@ -1575,7 +1423,7 @@ public class RehabilitationManageService {
        Map<String,Object> reslutMap = new HashMap<>();
        String sql ="SELECT" +
                " p.patient," +
                " p.`name`," +
                " p.name," +
                " p.title," +
                " p.disease_name,p.abort_reason,p.abort_time,p.create_time,p.patient_img," +
                " a.*" +
@ -1603,6 +1451,8 @@ public class RehabilitationManageService {
                " ) a ON p.id = a.plan_id" +
                " WHERE" +
                " p.id = '"+planId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_operate_recordsDoctorName(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Integer allCount = rehabilitationDetailDao.findAllByPlanId(planId);//计划总服务项目数
        Integer finishCount = list.size();//完成服务项目数

+ 3 - 45
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -8,7 +8,7 @@ import com.yihu.jw.entity.rehabilitation.RehabilitationPlanningDO;
import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -326,49 +326,6 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
    }
    public MixEnvelop<String,String> createServiceQrCode(String planDetailId,String doctorCode,String imageUrl){
        /*RehabilitationDetailDO rehabilitationDetailDO = rehabilitationDetailDao.findById(planDetailId);
        String fileUrl = "";
        if (rehabilitationDetailDO!=null) {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(rehabilitationDetailDO.getServiceQrCode())) {
                fileUrl = rehabilitationDetailDO.getServiceQrCode();
            } else {
                //String contentJsonStr="{\"planDetailId\":\""+planDetailId+"\",\"sessionId\":\""+sessionId+"\"}";
                String contentJsonStr="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wechat_base_url+"/wx/html/kfgl/html/confirm-service.html"+"?paramStr="+planDetailId+","+doctorCode+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
                InputStream ipt = QrcodeUtil.createQrcode(contentJsonStr, 300, "png");
                if (isneiwang) {
                    // 圖片列表
                    List<String> tempPaths = new ArrayList<String>();
                    try {
                        ObjectNode imgNode = fastDFSHelper.upload(ipt, "png", "plan_service_qrcode" + System.currentTimeMillis());
                        com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                        tempPaths.add(json.getString("fileId"));
                        String urls = "";
                        for (String image : tempPaths) {
                            if (urls.length() == 0) {
                                urls = image;
                            } else {
                                urls += "," + image;
                            }
                        }
                        fileUrl = fastdfs_file_url + urls;
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    try {
                        UploadVO uploadVO = fileUploadService.request(request, ipt, "png");
                        if (uploadVO!=null){
                            fileUrl = uploadVO.getFullUrl();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                //更新到康复计划居民关系表中
                String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + fileUrl + "' where id='" + planDetailId + "'";
                jdbcTemplate.update(sql);
            }
        }*/
        //更新到康复计划居民关系表中
        String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + imageUrl + "' where id='" + planDetailId + "'";
        jdbcTemplate.update(sql);
@ -379,7 +336,8 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        Map<String,Object> map = new HashedMap();
        int result = 0;
        String name= "";
        String sql ="SELECT rp.patient" + AesEncryptUtils.decryptMysql("rp.name","name") + " FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan rp ON pd.plan_id = rp.id WHERE pd.id='"+planDetailId+"'";
        String sql ="SELECT p.patient,p.name FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan p ON pd.plan_id = p.id WHERE pd.id='"+planDetailId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null && list.size()>0){
            if (String.valueOf(list.get(0).get("patient")).equals(patietCode)){