Explorar o código

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
#	common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
wangzhinan %!s(int64=3) %!d(string=hai) anos
pai
achega
3df582f799
Modificáronse 36 ficheiros con 1677 adicións e 889 borrados
  1. 22 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyNatPatientFamilyMemberDao.java
  2. 358 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 10 6
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/HcyyPrescriptionService.java
  4. 40 11
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 60 630
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java
  7. 13 4
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  8. 3 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  10. 128 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BaseNatPatientFamilyMemberDO.java
  11. 6 6
      common/common-entity/src/main/java/com/yihu/jw/entity/base/user/UserDO.java
  12. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java
  13. 6 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  14. 13 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/archive/ArchiveVO.java
  15. 23 0
      common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java
  16. 85 1
      gateway/ag-basic/pom.xml
  17. 3 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  18. 6 2
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  19. 17 0
      gateway/ag-basic/src/main/resources/application.yml
  20. 8 0
      gateway/ag-basic/src/main/resources/bootstrap.yml
  21. 20 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/RoleDao.java
  22. 19 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/WlyyUserAreaDao.java
  23. 19 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/WlyyUserEquipmentDao.java
  24. 74 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  25. 152 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWlyyConfigService.java
  26. 2 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java
  27. 32 0
      server/svr-authentication/src/main/resources/application.yml
  28. 9 0
      server/svr-authentication/src/main/resources/bootstrap.yml
  29. 5 7
      server/svr-configuration/src/main/resources/bootstrap.yml
  30. 48 0
      svr/svr-base/src/main/resources/application.yml
  31. 8 0
      svr/svr-base/src/main/resources/bootstrap.yml
  32. 259 144
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java
  33. 198 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  34. 4 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  35. 2 62
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/HcyyPrescriptionCotroller.java
  36. 7 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyNatPatientFamilyMemberDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.hospital.family.dao;
import com.yihu.jw.entity.base.patient.BaseNatPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface WlyyNatPatientFamilyMemberDao extends PagingAndSortingRepository<BaseNatPatientFamilyMemberDO, String>, JpaSpecificationExecutor<BaseNatPatientFamilyMemberDO> {
    @Query("from BaseNatPatientFamilyMemberDO t where t.patient=?1  and t.del =1")
    List<BaseNatPatientFamilyMemberDO> findbyPatient(String patient);
    @Query("from BaseNatPatientFamilyMemberDO t where t.patient=?1  and t.del=1 and t.familyRelation =?2 ")
    List<BaseNatPatientFamilyMemberDO> findbyPatientAndFamilyRelation(String patient,String familyRelation);
    @Query("from BaseNatPatientFamilyMemberDO t where t.patient=?1  and t.del=1  and t.idcard=?3 and t.name=?2 ")
    List<BaseNatPatientFamilyMemberDO> findbyPatientAndFamilyRelationAndNameAndIdcard(String patient,String name,String idcard);
}

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

@ -3,12 +3,14 @@ package com.yihu.jw.hospital.family.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.dao.BaseJobCategoryDao;
import com.yihu.jw.entity.base.dict.BaseJobCategoryDO;
import com.yihu.jw.entity.base.patient.BaseNatPatientFamilyMemberDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.family.dao.WlyyNatPatientFamilyMemberDao;
import com.yihu.jw.hospital.family.dao.BasePatientMemberDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
@ -19,6 +21,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.common.IdCardUtil;
@ -67,6 +70,8 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    private String wxId;
    @Autowired
    private BaseJobCategoryDao baseJobCategoryDao;
    @Autowired
    private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
    //添加关联家属
    @Transactional
@ -383,6 +388,359 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        return mixEnvelop;
    }
    //添加核酸预约关联家属
    @Transactional
    public MixEnvelop addNatFamily(String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare,String clinicId) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try{
            List<BaseNatPatientFamilyMemberDO> natPatientFamilyMemberDOList = natPatientFamilyMemberDao.findbyPatientAndFamilyRelationAndNameAndIdcard(patientId,familyName,idCard);
            if (natPatientFamilyMemberDOList!=null&&natPatientFamilyMemberDOList.size()>1){
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您已经添加家人关系,请勿重复添加");
                return mixEnvelop;
            }
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
            String dictName = "";
            if (null!=basePatientMemberDictDO){
                dictName = basePatientMemberDictDO.getRelationName();
            }
            String birth = IdCardUtil.getBirthdayForIdcardStr2(idCard);
            int sex=3;
            String familySex = IdCardUtil.getSexForIdcard(idCard);
            if (familySex.equalsIgnoreCase("男")){
                sex =1 ;
            }else if (familySex.equalsIgnoreCase("女")){
                sex = 2 ;
            }
            String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(idCard));
            ArchiveVO archiveVO = new ArchiveVO();
            archiveVO.setXming0(familyName);
            archiveVO.setSfzhao(idCard);
            archiveVO.setXbie00(sex+"");
            archiveVO.setBrnl00(familyAge);
            archiveVO.setYytel0(phoneNum);
            archiveVO.setCsrq00(birth);
            archiveVO.setCardtype("X");
            archiveVO.setSmdj00("0");
            archiveVO.setFwqd00("09");
            archiveVO.setHsflag("1");
            BaseNatPatientFamilyMemberDO result = new BaseNatPatientFamilyMemberDO();
            net.sf.json.JSONObject object = entranceService.BS16018(archiveVO,false);
            System.out.print("object"+object);
            if (object!=null){
                if (object!=null){
                    net.sf.json.JSONObject resObject = object.getJSONObject("resquest");
                    if (resObject!=null){
                        if (StringUtils.isNotBlank(resObject.getString("@cardno"))){
                            result.setCardNo(resObject.getString("@cardno"));
                            result.setMappingCode(resObject.getString("@pid"));
                        }else {
                            throw new Exception("建档失败!");
                        }
                    }else {
                        throw new Exception("建档失败!");
                    }
                }else {
                    throw new Exception("建档失败!");
                }
            }
            result.setFamilyRelation(dictId);
            result.setFamilyRelationName(dictName);
            result.setDel(1);
            result.setPatient(patientId);
            result.setIdcard(idCard);
            result.setMobile(phoneNum);
            result.setAge(familyAge);
            result.setName(familyName);
            result.setSex(sex);
            natPatientFamilyMemberDao.save(result);
        }catch (Exception e){
            e.printStackTrace();
            mixEnvelop.setStatus(408);
            mixEnvelop.setMessage("添加失败");
        }
        return mixEnvelop;
    }
    /**
     * 核酸查询就诊人信息
     * @param patientId
     * @return
     */
    public List<BaseNatPatientFamilyMemberDO> selectByPatientId(String patientId){
        List<BaseNatPatientFamilyMemberDO> natPatientFamilyMemberDOList = natPatientFamilyMemberDao.findbyPatientAndFamilyRelation(patientId,"7");
        if (natPatientFamilyMemberDOList==null||natPatientFamilyMemberDOList.size()==0){
            addSelfResult(patientId);
        }
        return  natPatientFamilyMemberDao.findbyPatient(patientId);
    }
    /**
     * 核酸查询单个就诊人信息
     * @param familyId
     * @return
     */
    public BaseNatPatientFamilyMemberDO selectByFamilyId(String familyId){
        return  natPatientFamilyMemberDao.findOne(familyId);
    }
    /**
     * 核酸删除就诊人信息
     * @param id
     * @return
     */
    public BaseNatPatientFamilyMemberDO deleteMember(String id){
        BaseNatPatientFamilyMemberDO baseNatPatientFamilyMemberDO = natPatientFamilyMemberDao.findOne(id);
        baseNatPatientFamilyMemberDO.setDel(0);
        return  natPatientFamilyMemberDao.save(baseNatPatientFamilyMemberDO);
    }
    /**
     * 核酸添加自己为家人
     * @param patientId
     * @return
     */
    public BaseNatPatientFamilyMemberDO addSelfResult(String patientId){
        BasePatientDO patientDO = basePatientDao.findById(patientId);
        BaseNatPatientFamilyMemberDO result = new BaseNatPatientFamilyMemberDO();
        result.setFamilyRelation("7");
        result.setFamilyRelationName("自己");
        String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
        result.setAge(familyAge);
        result.setDel(1);
        result.setPatient(patientId);
        result.setIdcard(patientDO.getIdcard());
        result.setMobile(patientDO.getMobile());
        result.setName(patientDO.getName());
        result.setSex(patientDO.getSex());
        return  natPatientFamilyMemberDao.save(result);
    }
    //添加关联家属
    @Transactional
    public MixEnvelop addFamilyAppoint(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo,String medicareType,String medicare,String clinicId) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try{
            BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
            BasePatientDO basePatientDO = null;
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            /*List<BasePatientDO> listpatients=basePatientDao.findByMobileAndDel(phoneNum,"1");
            if (listpatients!=null&&listpatients.size()>0){
                basePatientDO=listpatients.get(0);
            }*/
                basePatientDO= basePatientDao.findByIdcard(idCard);
            }else {
                basePatientDO= basePatientDao.findByIdcard(idCard);
            }
            List<BasePatientDO> list = basePatientDao.findByMobile(phoneNum);
            if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                if (list!=null&&list.size()>0&&basePatientDO!=null){
                    if (basePatientDO.getMobile().equalsIgnoreCase(phoneNum)){
                    }else{
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您所添加的家属手机号已被他人占用");
                        return  mixEnvelop;
                    }
                }else if (list!=null&&list.size()>0&&basePatientDO==null){
                    mixEnvelop.setStatus(409);
                    mixEnvelop.setMessage("您所添加的家属手机号已被他人占用");
                    return  mixEnvelop;
                } else {
                    if(basePatientDO==null){
                        basePatientDO = new BasePatientDO();
                    }
                    basePatientDO.setMobile(phoneNum);
                }
            }else{
                if(basePatientDO==null){
                    basePatientDO = new BasePatientDO();
                }
            }
            Map<String,Object> resultMap = new HashMap<>();
            PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
            if(null==patientMappingDO){
                patientMappingDO = new PatientMappingDO();
            }
            WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
            if (StringUtils.isNotBlank(id)){
                result = wlyyPatientFamilyMemberDao.findOne(id);
                basePatientDO = basePatientDao.findById(result.getFamilyMember());
                patientMappingDO = patientMappingDao.findByPatient(result.getFamilyMember());
            }
            String dictName = "";
            if (null!=basePatientMemberDictDO){
                dictName = basePatientMemberDictDO.getRelationName();
            }
            String familyId="";
            String birth = "";
            String yktFamilyId = "";
            int sex=3;
            //获取his家属数据
            JSONArray jsonArray = new JSONArray();
            if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                String familySex = IdCardUtil.getSexForIdcard(idCard);
                if (familySex.equalsIgnoreCase("男")){
                    familySex= "1";
                    sex =1 ;
                }else if (familySex.equalsIgnoreCase("女")){
                    familySex = "0";
                    sex = 2 ;
                }else {
                    familySex = "2";
                    sex = 3;
                }
                String familyAge = String.valueOf(IdCardUtil.getAgeForIdcard(idCard));
                BasePatientMemberDictDO basePatientMemberDictDO1 = basePatientMemberDictDao.findOne(dictId);
                String relationName = "";
                if (null!=basePatientMemberDictDO1){
                    relationName=basePatientMemberDictDO1.getRelationName();
                }
                BasePatientDO basePatientDO1  = basePatientDao.findById(patientId);
                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
                birth = sf.format(basePatientDO1.getBirthday());
                String res = "";
                //id不为空则为修改家人关系
                if (StringUtils.isNotBlank(id)){
                    if (null!=basePatientDO1){
                        res = ykyyService.updateYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,clinicId,result.getYktFamilyId(),birth);
                    }
                    if (StringUtils.isNotEmpty(res)){
                        JSONObject jsonObject1 = JSONObject.parseObject(res);
                        if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
                        /*JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
                        yktFamilyId = jsonObject2.getString("ID");*/
                        }else {
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("更新家人关系失败,请核对个人信息.");
                            return mixEnvelop;
                        }
                    }else {
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("更新家人关系失败,请核对个人信息.");
                        return mixEnvelop;
                    }
                }else {
                    if (null!=basePatientDO1){
                        res = ykyyService.addYktFamily(familyName,idCard, familySex,familyAge,phoneNum,medicare,relationName,clinicId,basePatientDO1.getUserId(),birth);
                    }
                    if (StringUtils.isNotEmpty(res)){
                        JSONObject jsonObject1 = JSONObject.parseObject(res);
                        if ("200".equalsIgnoreCase(jsonObject1.getString("code"))){
                            JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
                            yktFamilyId = jsonObject2.getString("ID");
                            result.setYktFamilyId(yktFamilyId);
                        }else {
                            mixEnvelop.setStatus(408);
                            mixEnvelop.setMessage("添加家人关系失败,请核对个人信息.");
                            return mixEnvelop;
                        }
                    }else {
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("添加家人关系失败,请核对个人信息.");
                        return mixEnvelop;
                    }
                }
                System.out.println("眼科转换后的csny"+birth);
            }
            basePatientDO.setSex(sex);
            if ("xm_xzzx_wx".equalsIgnoreCase(wxId)){
                basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
            }else if("xm_zsyy_wx".equalsIgnoreCase(wxId)||"xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-MM-dd");
                Date saveBirth1 = sf3.parse(birth);
                System.out.println("====="+saveBirth1);
                basePatientDO.setBirthday(saveBirth1);
            }else {
                basePatientDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
            }
            result.setFamilyRelation(dictId);
            result.setFamilyRelationName(dictName);
            result.setIsDel(1);
            result.setPatient(patientId);
            result.setCardNo(idCard);
            result.setCardType(cardType);
            result.setMobile(phoneNum);
            //保存到base_patient表
            basePatientDO.setName(familyName);
            basePatientDO.setIdcard(idCard);
            basePatientDO.setRegister("0");
            basePatientDO.setEnabled(1);
            basePatientDO.setDel("1");
            BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
            String patientNewId= "";
            if (sucessPatient!=null){
                patientNewId=sucessPatient.getId();
            }
            result.setFamilyMember(patientNewId);
            wlyyPatientFamilyMemberDao.save(result);
            if (!"xm_xzzx_wx".equalsIgnoreCase(wxId)){
                patientMappingDO.setIdcard(idCard);
                patientMappingDO.setSource("1");
                patientMappingDO.setPatientName(familyName);
                patientMappingDO.setMappingCode(familyId);
                patientMappingDO.setPatient(patientNewId);
                patientMappingDO.setCreateTime(new Date());
                patientMappingDao.save(patientMappingDO);
            }
            resultMap.put("patientId",patientId);
            resultMap.put("familyMember",patientNewId);
            resultMap.put("idCard",idCard);
            resultMap.put("phoneNum",phoneNum);
            resultMap.put("relationName",dictName);
            resultMap.put("name",familyName);
            resultMap.put("cardType",cardType);
            List<Map<String,Object>> resultList = new ArrayList();
            resultList.add(resultMap);
            mixEnvelop.setStatus(200);
            mixEnvelop.setMessage("添加成功");
            mixEnvelop.setDetailModelList(resultList);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                if (StringUtils.isNotBlank(clinicId)){
                    PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_02",sucessPatient.getId(),"1");
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                    }
                    patientMedicareCardDO.setCode(clinicId);
                    //patientMedicareCardDO.setType(medicareType);
                    patientMedicareCardDO.setPatientCode(patientNewId);
                    patientMedicareCardDO.setDel("1");
                    patientMedicareCardDO.setParentType("A");
                    patientMedicareCardDO.setType("A_02");
                    basePatientMedicareCardDao.save(patientMedicareCardDO);
                }
                if (StringUtils.isNotBlank(medicare)){
                    //PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
                    PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",sucessPatient.getId(),"1");
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                    }
                    patientMedicareCardDO.setCode(medicare);
                    //patientMedicareCardDO.setType(medicareType);
                    patientMedicareCardDO.setPatientCode(patientNewId);
                    patientMedicareCardDO.setDel("1");
                    patientMedicareCardDO.setParentType("A");
                    patientMedicareCardDO.setType("A_01");
                    basePatientMedicareCardDao.save(patientMedicareCardDO);
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            mixEnvelop.setStatus(408);
            mixEnvelop.setMessage("添加失败");
        }
        return mixEnvelop;
    }
    //眼科同步家人信息
    @Transactional
    public void saveYktFamily(String patientId) throws Exception{

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

@ -93,7 +93,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     */
    public JSONObject selectCardInfo(String cardNo) throws Exception {
        if (StringUtils.isNoneBlank(cardNo)){
        if (!StringUtils.isNoneBlank(cardNo)){
            throw new Exception("卡号不能为空");
        }
        JSONObject jsonObject = new JSONObject();
@ -101,14 +101,18 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        if (StringUtils.isNoneBlank(response)){
            JSONArray jsonArray = JSONObject.parseArray(response);
            if (jsonArray!=null&&jsonArray.size()!=0){
                for (int i =0;i<jsonArray.size();i++){
                    JSONObject object = jsonArray.getJSONObject(i);
                    if (object.getString("CARD_STAT").equalsIgnoreCase("正常")){
                        jsonObject = object;
                JSONArray array = jsonArray.getJSONArray(0);
                if (array!=null&&array.size()!=0){
                    for (int i =0;i<array.size();i++){
                        JSONObject object = array.getJSONObject(i);
                        if (object.getString("CARD_STAT").equalsIgnoreCase("正常")){
                            jsonObject = object;
                        }
                    }
                }
                }
            }
        }
        return jsonObject;
    }

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

@ -4400,14 +4400,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //医保是否有处方权
            if(healthCareService.isHospitalFlag()){
                String doctorAuthenticationUrl = entranceHealthCareUrl + "doctorAuthentication?doctorId="+doctorDO.getId();
                String infoResponse = httpClientUtil.get(doctorAuthenticationUrl,"GBK");
                com.alibaba.fastjson.JSONObject doctorAuthentication = com.alibaba.fastjson.JSONObject.parseObject(infoResponse);
                if(doctorAuthentication.getInteger("status")==200){
                    rs.put("is_prescribe", doctorAuthentication.get("obj"));//is_prescribe	是否具备处方权	1-有处方权,0无处方权
                if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    String doctorAuthenticationUrl = entranceHealthCareUrl + "doctorAuthentication?doctorId="+doctorDO.getId();
                    String infoResponse = httpClientUtil.get(doctorAuthenticationUrl,"GBK");
                    com.alibaba.fastjson.JSONObject doctorAuthentication = com.alibaba.fastjson.JSONObject.parseObject(infoResponse);
                    if(doctorAuthentication.getInteger("status")==200){
                        rs.put("is_prescribe", doctorAuthentication.get("obj"));//is_prescribe	是否具备处方权	1-有处方权,0无处方权
                    }else {
                        rs.put("is_prescribe",0);
                    }
                }else {
                    rs.put("is_prescribe",0);
                    String isPrescribe =healthCareService.doctorAuthentication(doctorDO.getId());
                    if (StringUtils.isNoneBlank(isPrescribe)){
                        rs.put("is_prescribe", isPrescribe);//is_prescribe	是否具备处方权	1-有处方权,0无处方权
                    }else {
                        rs.put("is_prescribe",0);
                    }
                }
            }else{
                rs.put("is_prescribe", 0);//is_prescribe	是否具备处方权	1-有处方权,0无处方权
            }
@ -12169,7 +12179,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    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 pushFlag,String cardNoType,String consumer,
                                  String checkPart,String chargeFlag,String chargeCode,String icdCode,String preNo,String idnoType) throws Exception {
                                  String checkPart,String chargeFlag,String chargeCode,String icdCode,String preNo,String idnoType,Integer source) throws Exception {
        Map returnMap = new HashMap();
        Integer winNo = 6;
        if (checkPart==null||checkPart==""){
@ -12249,13 +12259,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if (flag){
                    BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                    baseNatAppointmentDO.setSource(source);
                    baseNatAppointmentDO.setChargeAmount(chargeAmount);
                    baseNatAppointmentDO.setMedicare(mediaCard);
                    baseNatAppointmentDO.setName(name);
                    baseNatAppointmentDO.setCardNo(cardNo);
                    baseNatAppointmentDO.setCardType(cardType);
                    baseNatAppointmentDO.setAddress(address);
                    baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                    baseNatAppointmentDO.setAppointmentTime(new Date());
                    baseNatAppointmentDO.setCityName(cityName);
                    baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                    baseNatAppointmentDO.setFirstJobName(firstJobName);
@ -12279,6 +12290,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    baseNatAppointmentDO.setDept("3150000");
                    baseNatAppointmentDO.setDeptName("感染疾病科");
                    baseNatAppointmentDO.setAmpm(pm);
                    baseNatAppointmentDO.setConsumer(consumer);
                    baseNatAppointmentDO.setConsumerName(name);
                    baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
                    try {
                        rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
@ -12419,6 +12432,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
            baseNatAppointmentDO.setMedicare(mediaCard);
            baseNatAppointmentDO.setSource(source);
            baseNatAppointmentDO.setChargeAmount(chargeAmount);
            baseNatAppointmentDO.setName(name);
            baseNatAppointmentDO.setCardNo(cardNo);
@ -12572,6 +12586,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (flag){
                logger.info("BaseNatAppointmentDO保存开始");
                BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                baseNatAppointmentDO.setSource(source);
                baseNatAppointmentDO.setChargeAmount(itemPrice);
                baseNatAppointmentDO.setMedicare(mediaCard.trim());
                baseNatAppointmentDO.setRegisterNo(HisSeqNo);
@ -14416,8 +14431,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            throw e;
        }
    }
    public ObjEnvelop selectNatTime()throws Exception{
    public ObjEnvelop selectNatTime(Integer flag)throws Exception{
        ObjEnvelop envelop = new ObjEnvelop();
        if (flag!=null&&flag==1){
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            object.put("remainTotal","1");
            object.put("isOpen","1");
            envelop.setMessage("获取号源成功");
            envelop.setStatus(200);
            envelop.setObj(object);
            return envelop;
        }
        GregorianCalendar ca = new GregorianCalendar();
        //i结果为“0”是上午 结果为“1”是下午
        Integer  i = ca.get(GregorianCalendar.AM_PM);
@ -14435,6 +14459,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String message2 = jsonObject.getString("message2");
            Integer amTotal = jsonObject.getInteger("amTotal");
            Integer pmTotal = jsonObject.getInteger("pmTotal");
            jsonObject.put("time",i);
            Date startAmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startAm);
            Date endAmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+endAm);
            Date startPmDate = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" "+startPm);
@ -14446,6 +14471,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else {
                    envelop.setMessage(message1);
                    envelop.setStatus(500);
                    envelop.setObj(jsonObject);
                    return envelop;
                }
            }else if (i==1){
@ -14454,6 +14480,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else {
                    envelop.setMessage(message1);
                    envelop.setStatus(500);
                    envelop.setObj(jsonObject);
                    return envelop;
                }
            }
@ -14464,21 +14491,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                count= Integer.parseInt(map.get("count").toString());
            }
            if (i==0){
                Integer remainTotal = amTotal-count;
                if (amTotal>count){
                    Integer remainTotal = amTotal-count;
                    jsonObject.put("remainTotal",remainTotal);
                }else {
                    envelop.setMessage(message2);
                    envelop.setStatus(500);
                    envelop.setObj(jsonObject);
                    return envelop;
                }
            }else if (i==1){
                Integer remainTotal = pmTotal-count;
                if (pmTotal>count){
                    Integer remainTotal = pmTotal-count;
                    jsonObject.put("remainTotal",remainTotal);
                }else {
                    envelop.setMessage(message2);
                    envelop.setStatus(500);
                    envelop.setObj(jsonObject);
                    return envelop;
                }
            }

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -95,6 +95,8 @@ public class EntranceService {
    //医院频次字典表
    private static String MS30012 = "MS30012";
    private static String BS16018 = "BS16018";
    private String orgCode = "350211A1002";
    private String orgName = "350211A1002";
    @Value("${hospital.mqUser}")
@ -2844,6 +2846,9 @@ public class EntranceService {
            if (StringUtils.isNotBlank(archiveVO.getFwqd00())) {
                sbs.append(" fwqd00=\"" + archiveVO.getFwqd00() + "\" ");
            }
            if (StringUtils.isNotBlank(archiveVO.getHsflag())) {
                sbs.append(" hsflag=\"" + archiveVO.getHsflag() + "\" ");
            }
            sbs.append(" />");
            sbs.append("</root>");
            sbs.append("</Msg>");
@ -2928,6 +2933,7 @@ public class EntranceService {
        return ConvertUtil.convertListEnvelopInBody(resp);
    }
//=====================hospital应用调用entrance应用============start=================
    /**

+ 60 - 630
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java

@ -98,8 +98,6 @@ public class HcyyEntranceService {
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
@ -135,14 +133,7 @@ public class HcyyEntranceService {
    public static String entranceUrlLocal = "http://localhost:10023/xzzx/";
    public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
    //合理用药接口地址
    public static String checkInfosUrl="http://192.168.102.243:8040/service/api/check.do?tag=1";
    //保存天际处方接口地址
    public static String saveTianJiPrescription = "http://192.168.102.243:8040/service/api/checkFromXmlToJson.do?tag=2";
    //作废处方地址
    public static String deleteTianJiPrescription = "http://192.168.102.243:8040/service/api/checkFromXmlToJson.do?tag=2";
    //药品说明书地址http://192.168.102.243:8221/drugs/@code@?source=dcdt_web&show_navbar=true
    public static String drugUseInfoTianJi = "http://192.168.102.243:8221/drugs/@code@?source=dcdt_web&show_navbar=true";
    public String getSelectUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyWebSelectService");
@ -151,6 +142,24 @@ public class HcyyEntranceService {
        return url;
    }
    //逸耀合理审方地址
    public String getYYCheckUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("YyCheckUrl");
        String url = list.get(0).getDictCode();
        return url;
    }
    //逸耀药品说明书的地址
    public String getDrugInfoUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("DrugInfoUrl");
        String url = list.get(0).getDictCode();
        return url;
    }
    public String getOperateUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyWebOperateService");
@ -1681,174 +1690,10 @@ public class HcyyEntranceService {
        return json;
    }
    /*
     *合理用药审核接口入参
     */
    public String checkPrescriptionInfoParam(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos,boolean isDelete){
        String checkDoctor="<Doctor POSITION=\""+patientAndDoctor.getString("POSITION")+
                "\" NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
                "\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+
                "\" DEPT_NAME=\""+patientAndDoctor.getString("DEPT_NAME")+"\" USER_ID=\""+patientAndDoctor.getString("DOCTOR_ID")+"\" />";
        String checkPatient="<Patient NAME=\""+patientAndDoctor.getString("PATIENT_NAME")+
                "\" ID=\""+patientAndDoctor.getString("PATIENT_ID")+
                "\" VISIT_ID=\"0\" PATIENT_PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                "\" BIRTH=\""+patientAndDoctor.getString("BIRTH")+
                "\" HEIGHT=\"\" WEIGHT=\"\" GENDER=\""+patientAndDoctor.getString("GENDER")+
                "\" PREGNANT=\"\" LACT=\"否\" HEPATICAL=\"\" RENAL=\"\" PANCREAS=\"\" ALERGY_DRUGS=\"\" IDENTITY_TYPE=\"\" FEE_TYPE=\""+patientAndDoctor.getString("FEE_TYPE")+
                "\" SCR=\"\" SCR_UNIT=\"\" GESTATION_AGE=\"\" PRETERM_BIRTH=\"\" DRUG_HISTORY=\"\" FAMILY_DISEASE_HISTORY=\"\" GENETIC_DISEASE=\"\" MEDICARE_01=\"\" MEDICARE_02=\"\" MEDICARE_03=\"\" MEDICARE_04=\"\" MEDICARE_05=\"\" />";
        String checkDiagnosises = "<Diagnosises DIAGNOSISES=\""+patientAndDoctor.getString("diagnosises")+"\" >\n" +
                "</Diagnosises>\n";
        StringBuffer stringBuffer = new StringBuffer();
        if(null!=infos&&infos.size()>0){
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:infos){
                int i = 1;
                stringBuffer.append("<Advice REPEAT=\"1\" DRUG_LO_NAME=\""+wlyyPrescriptionInfoDO.getDrugName()+
                        "\" DRUG_LO_ID=\""+wlyyPrescriptionInfoDO.getHisCode()+"\" ADMINISTRATION=\""+wlyyPrescriptionInfoDO.getSupplyName()+
                        "\" DOSAGE=\""+wlyyPrescriptionInfoDO.getDosage()+
                        "\" DOSAGE_UNIT=\""+wlyyPrescriptionInfoDO.getUnitName()+
                        "\" FREQ_COUNT=\""+wlyyPrescriptionInfoDO.getUsageCode()+
                        "\" FREQ_INTERVAL=\"\" FREQ_INTERVAL_UNIT=\"\" START_DAY=\""+patientAndDoctor.getString("CREATE_DATE")+"\" END_DAY=\"\"" +
                        " DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+"\" DOCTOR_NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+
                        "\" ORDER_NO=\""+i+
                        "\" ORDER_SUB_NO=\""+1+"\" AUTHORITY_LEVELS=\"\" ALERT_LEVELS=\"\" TITLE=\""+patientAndDoctor.getString("POSITION") +
                        "\" GROUP_ID=\""+i+"\" USER_ID=\""+patientAndDoctor.getString("DOCTOR_ID")+
                        "\" PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                        "\" PRES_DATE=\""+patientAndDoctor.getString("CREATE_DATE")+
                        "\" PRES_SEQ_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+
                        "\" PK_ORDER_NO=\"\" COURSE=\""+wlyyPrescriptionInfoDO.getDays()+
                        "\" PKG_COUNT=\""+wlyyPrescriptionInfoDO.getPackQuantity()+
                        "\" PKG_UNIT=\""+wlyyPrescriptionInfoDO.getPackUnitName()+"\" BAK_01=\"\" BAK_02=\"\" BAK_03=\""+wlyyPrescriptionInfoDO.getUnitName()+
                        "\" BAK_04=\""+wlyyPrescriptionInfoDO.getSpecification()+
                        "\" BAK_05=\""+wlyyPrescriptionInfoDO.getDrugPlace()+"\"  />");
                i++;
            }
        }
        String checkInfos = "<Advices></Advices>";
        if (!isDelete){
            checkInfos= "<Advices>"+stringBuffer.toString()+"</Advices>";
        }
        String postBody = "<CheckInput TAG=\"2\" INPATIENT=\"否\">"+checkDoctor+checkPatient+checkDiagnosises+checkInfos+"</CheckInput>";
        return postBody;
    }
    /*
     *合理用药审核接口
     */
    public String checkPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,false);
        logger.info("发送的报文参数:"+postBody);
        String res =  httpClientUtil.sendPost(checkInfosUrl,postBody);
        logger.info("返回的报文参数:"+res);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setRequest(postBody);
        wlyyHttpLogDO.setName("合理用药审核接口");
        wlyyHttpLogDO.setResponse(res);
        return  res;
    }
    /*
     *合理用药保存接口
     */
    public String saveCheckPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,false);
        logger.info("保存处方的报文参数:"+postBody);
        String res =  httpClientUtil.sendPost(saveTianJiPrescription,postBody);
        logger.info("保存处方的报文参数:"+res);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setRequest(postBody);
        wlyyHttpLogDO.setName("合理用药保存接口");
        wlyyHttpLogDO.setResponse(res);
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        return  res;
    }
    /*
     *合理用药作废接口
     */
    public String deleteCheckPrescription(JSONObject patientAndDoctor,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        String postBody = checkPrescriptionInfoParam(patientAndDoctor,infos,true);
        logger.info("作废的报文参数:"+postBody);
        logger.info("deleteTianJiPrescription:"+deleteTianJiPrescription);
        String res =  httpClientUtil.sendPost(deleteTianJiPrescription,postBody);
        logger.info("作废的报文参数:"+res);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setDoctor(patientAndDoctor.getString("doctorId"));
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setRequest(postBody);
        wlyyHttpLogDO.setResponse(res);
        wlyyHttpLogDO.setName("合理用药作废接口");
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        return  res;
    }
    public List<Map<String,Object>> transXmlCommen(String xml){
        Document doc = null;
        List<Map<String,Object>> returnMap= new ArrayList<>();
        try {
            doc = (new Builder()).build(new StringReader(xml));
            Element root = doc.getRootElement();
            Elements elements = root.getChildElements();
            for (int i=0;i<elements.size();i++){
               Map<String,Object> personInfoMap = new HashMap<>();
                Element personInfo = elements.get(i);
                for (int j=0;j<personInfo.getAttributeCount();j++){
                    Attribute attribute = personInfo.getAttribute(j);
                    personInfoMap.put(attribute.getLocalName(),attribute.getValue());
                }
                List<Map<String,Object>> checkInfoMapList= new ArrayList<>();
                if (personInfo.getChildElements().size()>0){
                    Elements checkInfos = personInfo.getChildElements();
                    for(int ci=0;ci<checkInfos.size();ci++){
                        Element checkInfo = checkInfos.get(ci);
                        Map<String,Object> checkInfoMap = new HashMap<>();
                        for (int n = 0;n<checkInfo.getAttributeCount();n++){
                            Attribute attribute2 = checkInfo.getAttribute(n);
                            checkInfoMap.put(attribute2.getLocalName(),attribute2.getValue());
                        }
                        checkInfoMapList.add(checkInfoMap);
                    }
                }
                personInfoMap.put("checkInfoMapList",checkInfoMapList);
                returnMap.add(personInfoMap);
            }
        } catch (ParsingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
      return returnMap;
    }
    public  List<PersonInfoVO>  transXml(String xml) throws  Exception {
        Document doc = (new Builder()).build(new StringReader(xml));
        Element root = doc.getRootElement();
        Elements presInfos = root.getChildElements("PresInfo");
        List<PersonInfoVO> personInfoVOS = new ArrayList<>();
        for (int i=0;i<presInfos.size();i++){
            PersonInfoVO personInfoVO = new PersonInfoVO();
            List<CheckInfoVO> checkInfoVOS = new ArrayList<>();
            Element presInfo  = presInfos.get(i);
            personInfoVO.setDrugLoId(presInfo.getAttributeValue("DRUG_LO_ID"));
            personInfoVO.setDrugLoName(presInfo.getAttributeValue("DRUG_LO_NAME"));
            personInfoVO.setOrderId(presInfo.getAttributeValue("ORDER_ID"));
            personInfoVO.setOrderSubId(presInfo.getAttributeValue("ORDER_SUB_ID"));
            Elements checkinfos  = presInfo.getChildElements();
            if (checkinfos.size()>0){
                for (int j=0;j<checkinfos.size();j++){
                    CheckInfoVO checkInfoVO = new CheckInfoVO();
                    Element checkinfo = checkinfos.get(j);
                    checkInfoVO.setColor(checkinfo.getAttributeValue("COLOR"));
                    checkInfoVO.setName(checkinfo.getAttributeValue("NAME"));
                    checkInfoVO.setRefResource(checkinfo.getAttributeValue("REF_SOURCE"));
                    checkInfoVO.setWarningInfo(checkinfo.getAttributeValue("WARNING_INFO"));
                    checkInfoVO.setWarningLevel(checkinfo.getAttributeValue("WARNING_LEVEL"));
                    checkInfoVOS.add(checkInfoVO);
                }
                personInfoVO.setCheckInfoVOS(checkInfoVOS);
            }
            personInfoVOS.add(personInfoVO);
        }
        return personInfoVOS;
    }
    public String replaceHtml(String demoData,String oldChar,String newChar){
        return demoData.replace(oldChar,null==newChar?"无":newChar);
    }
@ -2142,73 +1987,7 @@ public class HcyyEntranceService {
        }
    }
    public String sendXCXMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String miniProgramPagepath,String miniProgramAppId){
        JSONObject params = new JSONObject();
        params.put("transType","sms.hospital.notice");
        params.put("merchId","3501000014");
        params.put("miniProgramPagepath",miniProgramPagepath);
        params.put("miniProgramAppId",miniProgramAppId);
        JSONObject p = new JSONObject();
        String openId = "";
        if(StringUtils.isNotBlank(patient)){
            List<BasePatientWechatDo> paientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient);
            if(paientWechatDos!=null&&paientWechatDos.size()>0){
                openId = paientWechatDos.get(0).getOpenid();
                p.put("openId",openId);
            }
        }else {
            p.put("cardNo",cardNo);
        }
        p.put("first",first);
        p.put("noticeTime", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        p.put("noticeContent",noticeContent);
        p.put("remark",remark);
        params.put("param",p);
        logger.info("params :"+params.toString());
        if(StringUtils.isNotBlank(openId)||StringUtils.isNotBlank(cardNo)){
            String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
            logger.info("rs :"+rs);
            JSONObject rsJson = JSON.parseObject(rs);
            String resCode = rsJson.getString("respCode");
            if("000000".equals(resCode)){
                return "1";
            }
            return "0";
        }else {
            return "-1";
        }
    }
    /**
     * 获取心脏医院token
     * @return
     * @throws Exception
     */
    public String getXzToken() throws Exception{
        String url =getWXTokenUrl();
        JSONObject params = new JSONObject();
        params.put("appId","1BQ08T2R60006501A8C00000BE73319D");
        params.put("encryptType","DES");
        params.put("sign","58E40DCEA527333B9E7C3CCD1A08979F");
        params.put("signType","MD5");
        params.put("timestamp",new Date().getTime());
        params.put("version","v.1.0.0");
        params.put("serviceId","ext.user.getTokenByMerchId");
        JSONObject p = new JSONObject();
        p.put("medicalId","3501000014");
        params.put("param",p);
        String path = url+"hospitalPortal-ext-app/ext/app/unifyapi";
        String rs = HttpUtil.sendPost(path,params.toJSONString());
        logger.info("rs :"+rs);
        JSONObject rsJson = JSON.parseObject(rs);
        String tokenAES = rsJson.getJSONObject("param").getString("token");
        String token = AES.decrypt("xm_xxg_zxzx", tokenAES);
        return token;
    }
    /**
     * 获取海沧医院微信token
@ -2783,282 +2562,6 @@ public class HcyyEntranceService {
    }
    /**
     * 获取his居民id
     * @param patient
     * @return
     * @throws Exception
     */
    public String findHisPatNoByPatient(String patient)throws Exception{
        logger.info("findHisPatNoByPatient:"+patient);
        BasePatientDO patientDO = patientDao.findById(patient);
        logger.info("patientDO:"+patientDO.toString());
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
        }
        String patientId = "";
        JSONArray rs = selectPateintCard(patient);
        if (rs!=null&&rs.size()!=0){
            JSONObject object = rs.getJSONObject(0);
            patientId = object.getString("SICKID");
        }
        return patientId;
    }
    //组装审药参数并发送到entrance
    public String checkInputInfo(String hisId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
        //如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
        if (StringUtils.isNotEmpty(hisId)){
            jsonObject.put("PATIENT_PRES_ID",hisId);
        }else {
            hisId = UUID.randomUUID().toString();
            jsonObject.put("PATIENT_PRES_ID",hisId);
        }
        if (null!=infos&&infos.size()>0) {
            String response = "";
            String returnJson = "";
            JSONArray array = new JSONArray();
            for (WlyyPrescriptionInfoDO infoDO:infos){
                array.add(infoDO);
            }
            String url = entranceUrl + "checkPrescription";
            Map<String,String> map = new HashedMap();
            map.put("infos",array.toJSONString());
            map.put("patientAndDoctor",jsonObject.toString());
            response = httpClientUtil.httpPost(url, map);
            logger.info("请求entrance的参数:"+map.toString());
            logger.info("请求checkPrescription:" + response);
            JSONObject object = JSONObject.parseObject(response);
            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
            if (object.getInteger("status") == 200) {
                wlyyHttpLogDO.setCode("200");
                String obj = object.getString("obj");
                System.out.println("obj:"+obj);
                if (StringUtils.isNotBlank(obj)) {
                    List<Map<String,Object>> returnList = transXmlCommen(obj);
                    Map<String,Object> checkIdMap = new HashMap<>();
                    checkIdMap.put("prescriptionOnly",hisId);
                    returnList.add(checkIdMap);
                    returnJson = JSONArray.toJSONString(returnList);
                    logger.info("返回到互联网医院的解析后的结果:"+returnJson);
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("checkPrescription");
                } else {
                    returnJson = "审方返回接口为空请检查参数是否正确";
                    logger.info(returnJson);
                    wlyyHttpLogDO.setCode("error");
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("checkPrescription");
                }
            } else {
                returnJson = "entranceUrl接口调用失败";
                wlyyHttpLogDO.setCode("error");
                wlyyHttpLogDO.setDoctor(doctor);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                wlyyHttpLogDO.setResponse(returnJson);
                wlyyHttpLogDO.setName("checkPrescription");
            }
            wlyyHttpLogDao.save(wlyyHttpLogDO);
            return returnJson;
        }else {
            return "药品信息为空";
        }
    }
    //组装审药参数并发送到entrance保存处方
    public String saveCheckInputInfo(String prescriptionId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{
        JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
        String tjPrescriptionId = "";
        //如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
        if (StringUtils.isNotEmpty(prescriptionId)) {
            tjPrescriptionId = prescriptionId;
            jsonObject.put("PATIENT_PRES_ID",tjPrescriptionId);
        }
        if (null!=infos&&infos.size()>0) {
            String response = "";
            String returnJson = "";
            JSONArray array = new JSONArray();
            for (WlyyPrescriptionInfoDO infoDO:infos){
                array.add(infoDO);
            }
            String url = entranceUrl + "saveCheckPrescription";
            Map<String,String> map = new HashedMap();
            map.put("infos",array.toJSONString());
            map.put("patientAndDoctor",jsonObject.toString());
            response = httpClientUtil.httpPost(url, map);
            logger.info("请求saveCheckPrescription参数:"+map.toString());
            logger.info("saveCheckPrescription返回结果:" + response);
            JSONObject object = JSONObject.parseObject(response);
            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
            if (object.getInteger("status") == 200) {
                wlyyHttpLogDO.setCode("200");
                String obj = object.getString("obj");
                System.out.println("obj:"+obj);
                if (StringUtils.isNotBlank(obj)) {
                    returnJson = obj;
                    logger.info("返回到互联网医院的解析后的结果:"+returnJson);
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("saveCheckPrescription");
                } else {
                    returnJson = "保存失败";
                    logger.info(returnJson);
                    wlyyHttpLogDO.setCode("failed");
                    wlyyHttpLogDO.setDoctor(doctor);
                    wlyyHttpLogDO.setCreateTime(new Date());
                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                    wlyyHttpLogDO.setResponse(returnJson);
                    wlyyHttpLogDO.setName("saveCheckPrescription");
                }
            } else {
                returnJson = "entranceUrl接口调用失败";
                wlyyHttpLogDO.setCode("error");
                wlyyHttpLogDO.setDoctor(doctor);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(infos + jsonObject.toString());
                wlyyHttpLogDO.setResponse(returnJson);
                wlyyHttpLogDO.setName("saveCheckPrescription");
            }
            wlyyHttpLogDao.save(wlyyHttpLogDO);
            return returnJson;
        }else {
            return "药品信息为空";
        }
    }
    //作废处方
    public String deleteCheckInputInfo(String prescriptionId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception{
        JSONObject jsonObject = initEntranceParam(payType,doctor,patient,diagnosisDOS);
        String tjPrescriptionId = "";
        //如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里
        if (StringUtils.isNotEmpty(prescriptionId)){
            tjPrescriptionId = prescriptionId;
            jsonObject.put("PATIENT_PRES_ID",tjPrescriptionId);
        }
        String response = "";
        String returnJson = "";
        String url = entranceUrl + "deleteCheckPrescription";
        Map<String,String> map = new HashedMap();
        map.put("infos","");
        map.put("patientAndDoctor",jsonObject.toString());
        response = httpClientUtil.httpPost(url, map);
        logger.info("请求deleteCheckPrescription参数:"+map.toString());
        logger.info("deleteCheckPrescription返回结果:" + response);
        JSONObject object = JSONObject.parseObject(response);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        if (object.getInteger("status") == 200) {
            wlyyHttpLogDO.setCode("200");
            String obj = object.getString("obj");
            System.out.println("obj:"+obj);
            if (StringUtils.isNotBlank(obj)) { ;
                returnJson = obj;
                logger.info("返回到互联网医院的解析后的结果:"+returnJson);
                wlyyHttpLogDO.setDoctor(doctor);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(map.toString());
                wlyyHttpLogDO.setResponse(returnJson);
                wlyyHttpLogDO.setName("saveCheckPrescription");
            } else {
                returnJson = "删除成功";
                logger.info(returnJson);
                wlyyHttpLogDO.setCode("删除成功");
                wlyyHttpLogDO.setDoctor(doctor);
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setRequest(map.toString());
                wlyyHttpLogDO.setResponse(returnJson);
                wlyyHttpLogDO.setName("deleteCheckPrescription");
            }
        } else {
            returnJson = "entranceUrl接口调用失败";
            wlyyHttpLogDO.setCode("error");
            wlyyHttpLogDO.setDoctor(doctor);
            wlyyHttpLogDO.setCreateTime(new Date());
            wlyyHttpLogDO.setRequest(map.toString());
            wlyyHttpLogDO.setResponse(returnJson);
            wlyyHttpLogDO.setName("deleteCheckPrescription");
        }
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        return returnJson;
    }
    //初始化医患和诊断参数
    public JSONObject initEntranceParam(String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS){
        JSONObject jsonObject = new JSONObject();
        //先查询处方获得支付方式
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDoctorCode(doctor);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
        if (null != doctorMappingDO && null != baseDoctorDO) {
            jsonObject.put("DOCTOR_ID", doctorMappingDO.getMappingCode());
            jsonObject.put("POSITION", baseDoctorDO.getJobTitleName());
            jsonObject.put("DOCTOR_NAME", baseDoctorDO.getName());
            if (null!=baseDoctorHospitalDO&&baseDoctorHospitalDO.size()>0){
                jsonObject.put("DEPT_CODE", baseDoctorHospitalDO.get(0).getDeptCode());
                jsonObject.put("DEPT_NAME", baseDoctorHospitalDO.get(0).getDeptName());
            }
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        BasePatientDO basePatientDO = patientDao.findById(patient);
        jsonObject.put("PATIENT_NAME", basePatientDO.getName());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        if (null != patientMappingDO && null != basePatientDO) {
            jsonObject.put("PATIENT_ID", patientMappingDO.getMappingCode());
            if (null!=basePatientDO.getSex()){
                jsonObject.put("GENDER", 1==basePatientDO.getSex()?"男":"女");
            }else{
                jsonObject.put("GENDER", "男");
            }
            jsonObject.put("BIRTH", sdf.format(basePatientDO.getBirthday()));
        }
        jsonObject.put("FEE_TYPE", "1".equalsIgnoreCase(payType) ? "医保" : "自费");
        jsonObject.put("CREATE_DATE", sdf.format(new Date()));
        //组装诊断参数
        if (null != diagnosisDOS && diagnosisDOS.size() > 0) {
            List diagnosises = new ArrayList();
            for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : diagnosisDOS) {
                diagnosises.add(wlyyPrescriptionDiagnosisDO.getName());
            }
            jsonObject.put("diagnosises", StringUtils.strip(diagnosises.toString(),"[]"));
        }
        return jsonObject;
    }
    /**
     * 发送短信验证码
     * @return
     * @throws Exception
     */
    public Integer SendSmsToEntrance(String json) throws Exception {
        int result = 0;
        String response="";
        String url = entranceUrl+"SendSms";
        Map<String,String> map = new HashedMap();
        map.put("json",json);
        response = httpClientUtil.httpPost(url,map);
        logger.info("返回参数:"+response);
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
            JSONArray jsonArray= JSONArray.parseArray(object.getString("obj"));
            if (jsonArray!=null&&jsonArray.size()!=0){
                JSONObject jsonObject = jsonArray.getJSONObject(0);
                if (jsonObject.getString("code").equalsIgnoreCase("10000")){
                    result=0;
                }
            }
        }
        return result;
    }
//============================hospital业务层==================start====================
@ -3097,128 +2600,55 @@ public class HcyyEntranceService {
//===========================entrance访问hospital============end=======================
    //===========================杭州逸曜合理用药======================================
    //===========================CA签名================================
    /**
     * 判断个人实名软证书是否已申请(通过身份证号)
     * @return
     */
    public String XMCAF_SOFT_judgeRealNameSoftCertIsApplied(String idcard)throws Exception{
        String api = "XMCAF_SOFT_judgeRealNameSoftCertIsApplied";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("XMCAF_SOFT_judgeRealNameSoftCertIsApplied params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
    public  String initParams(WlyyOutpatientDO outpatientDO,WlyyPrescriptionDO prescriptionDO,List<WlyyPrescriptionInfoDO> infoDOList) throws Exception {
        if (outpatientDO==null){
            throw new Exception("门诊为空");
        }
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCAF_SOFT_judgeRealNameSoftCertIsApplied json:"+json);
        return json;
        String base = "<base>  \n" +
                "    <hospital_code><![CDATA[1001]]></hospital_code>  \n" +
                "    <event_no><![CDATA["+outpatientDO.getRegisterNo()+"]]></event_no>  \n" +
                "    <patient_id><![CDATA[002097137200]]></patient_id>  \n" +
                "    <source><![CDATA[门诊]]></source>  \n" +
                "</base>  \n";
        return null;
    }
    /**
     * 3.2.2 判断个人实名软证调用保护口令是否在暂存期间内(可通过多种方式)
     * @param type 0-通过微信号 openid、1-通过手机号、2-身份证号
     * @param openId 微信号
     * @param mobile 手机号
     * @param idcard 身份证
     * 杭州逸曜合理用药调用方式
     * @param serviceCode 服务编码GY_V4_FLEXIBLE	处方保存前,进行合理用药审查、
     *                    GY_SF_V4 	处方在医生站系统成功保存后调用:、
     *                    SF_V4_VALID_FLAG 	处方保存成功后,发送给审方系统进行人工审方: 、
     *                    SF_V4_DOUBLE_SIGN 	医生在对药师打回的处方进行双签处理后,医生站将双签信息推送给审方系统:、
     *                    CANCEL_GROUP_DRUG_V4 	删除已保存处方时调用、
     *                    SF_V4_DISCHARGED 	已保存处方进行数据修改
     * @param xml 入参数
     * @param name 服务名字
     * @return
     * @throws Exception
     */
    public String XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime(String type,String openId,String mobile,String idcard)throws Exception{
        String api = "XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(type)){
            condition += "<strJudgeMode>"+type+"</strJudgeMode>";
        }
        if (StringUtils.isNoneBlank(openId)){
            condition += "<strWxid>"+openId+"</strWxid>";
        }
        if (StringUtils.isNoneBlank(mobile)){
            condition += "<strMobilePhoneNum>"+mobile+"</strMobilePhoneNum>";
        }
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
    public String checkPrescription(String serviceCode,String xml,String name){
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCA14_PRNSC_judgeCalledPasswdIsInTempSaveTime json:"+json);
        return json;
        String url = getYYCheckUrl()+serviceCode;
        JSONObject object = new JSONObject();
        object.put("xml",xml);
        String response = httpClientUtil.postBody(url,object);
        WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
        httpLogDO.setCode(serviceCode);
        httpLogDO.setName(name);
        httpLogDO.setRequest(xml);
        httpLogDO.setResponse(response);
        httpLogDO.setStatus("1");
        wlyyHttpLogDao.save(httpLogDO);
        return response;
    }
    //===========================杭州逸曜合理用药======================================
    /**
     * 3.2.3 通过身份证号,请求个人实名软证书并进行 P1 数字签名(单笔)
     * @param strOriginalData 原文的 MD5 哈希摘要值
     * @param strRealNameSoftCertCalledPasswd 证书被调用保护口令(的大写 32 位 MD5 摘要值)
     * @param idcard 用户身份证号
     * @return
     * @throws Exception
     */
    public String XMCAF_SOFT_requestRealNameSoftCertAndSign(String strOriginalData,String strRealNameSoftCertCalledPasswd,String idcard)throws Exception{
        String api = "XMCAF_SOFT_requestRealNameSoftCertAndSign";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (StringUtils.isNoneBlank(strOriginalData)){
            condition += "<strOriginalData>"+strOriginalData+"</strOriginalData>";
        }
        condition += "<strRealNameSoftCertCalledPasswd>"+strRealNameSoftCertCalledPasswd+"</strRealNameSoftCertCalledPasswd>";
        if (StringUtils.isNoneBlank(idcard)){
            condition += "<strUserIdcardNum>"+idcard+"</strUserIdcardNum>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("XMCAF_SOFT_requestRealNameSoftCertAndSign params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("XMCA6_UnifiedCallInterface",params,getCaServiceUrl());
    //===========================CA签名================================
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("XMCAF_SOFT_requestRealNameSoftCertAndSign json:"+json);
        return json;
    }
    //===========================CA签名==================================
}

+ 13 - 4
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -651,7 +651,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " a.create_time AS \"create_time\", " +
                " e.content AS \"content\", " +
                " d.idcard AS \"docIdCard\", " +
                " e.relation_code AS \"relationCode\" "+
                " a.relation_code AS \"relationCode\","+
                " m.type as \"type\", "+
                " m.relation_code as \"relationCode1\""+
                "FROM " +
                " base_evaluate_score a " +
                " JOIN base_evaluate e ON a.id = e.relation_code " +
@ -691,12 +693,19 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                try{
//                String[] dept = depToSubject(info.get("dept_code").toString());
                    jb.put("id",interId +"_"+ (String)info.get("relationCode"));
                    jb.put("id_doctor",interId == null ? "0":interId);
                    jb.put("organ_code",orgCode);
                    jb.put("organ_name", orgName);
                    jb.put("net_service", "4");
                    jb.put("net_service_name","在线复诊");
                    if (info.get("type").toString().equalsIgnoreCase("1")){
                        jb.put("id",interId +"_"+ (String)info.get("relationCode"));
                        jb.put("net_service", "1");
                        jb.put("net_service_name","图文咨询");
                    }else if (info.get("type").toString().equalsIgnoreCase("9")){
                        jb.put("id",interId +"_"+ (String)info.get("relationCode1"));
                        jb.put("net_service", "4");
                        jb.put("net_service_name","在线复诊");
                    }
                    jb.put("val_score",info.get("score") == null ? "0": info.get("score"));
                    jb.put("grader",info.get("patient_name") == null ? "0": info.get("patient_name"));
                    jb.put("dt_grade",DateUtil.dateToStrLong((Date)info.get("create_time")));

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -1866,6 +1866,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
/*    @GeneratedValue(generator = "generator")
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)*/
    @Column(name = "id", unique = true, nullable = false)
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 128 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BaseNatPatientFamilyMemberDO.java

@ -0,0 +1,128 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * Created by Trick on 2018/8/31.
 */
@Entity
@Table(name = "base_nat_patient_member")
public class BaseNatPatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    private String patient;//居民code',
    private String name;//家庭成员名字',
    private String familyRelation;//家庭关系关系
    private String familyRelationName;//
    private String mobile;//手机号
    private String idcard;//身份证
    private String cardNo;//卡号
    private String mappingCode;//his映射code
    private Integer sex;//性别
    private Integer del;//删除标志(1正常,0删除)
    private String age;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "card_no")
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    @Column(name = "mapping_code")
    public String getMappingCode() {
        return mappingCode;
    }
    public void setMappingCode(String mappingCode) {
        this.mappingCode = mappingCode;
    }
    @Column(name = "sex")
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    @Column(name = "family_relation")
    public String getFamilyRelation() {
        return familyRelation;
    }
    public void setFamilyRelation(String familyRelation) {
        this.familyRelation = familyRelation;
    }
    @Column(name = "family_relation_name")
    public String getFamilyRelationName() {
        return familyRelationName;
    }
    public void setFamilyRelationName(String familyRelationName) {
        this.familyRelationName = familyRelationName;
    }
    @Column(name = "age")
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
}

+ 6 - 6
common/common-entity/src/main/java/com/yihu/jw/entity/base/user/UserDO.java

@ -46,9 +46,9 @@ public class UserDO extends UuidIdentityEntityWithOperator {
     */
    private String ak;
    //是否可用
    private Boolean enabled;
    private Integer enabled;
    //是否锁定
    private Boolean locked;
    private Integer locked;
    //锁定时间
    private Date lockedDate;
    //最后登陆时间
@ -151,20 +151,20 @@ public class UserDO extends UuidIdentityEntityWithOperator {
    }
    @Column(name = "enabled", nullable = false)
    public Boolean getEnabled() {
    public Integer getEnabled() {
        return enabled;
    }
    public void setEnabled(Boolean enabled) {
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }
    @Column(name = "locked", nullable = false)
    public Boolean getLocked() {
    public Integer getLocked() {
        return locked;
    }
    public void setLocked(Boolean locked) {
    public void setLocked(Integer locked) {
        this.locked = locked;
    }

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java

@ -62,6 +62,7 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String consumerName;
    private String oderNum;
    private String idnoType;
    private Integer source;
    public String getOderNum() {
        return oderNum;
@ -464,4 +465,12 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    public void setIdnoType(String idnoType) {
        this.idnoType = idnoType;
    }
    public Integer getSource() {
        return source;
    }
    public void setSource(Integer source) {
        this.source = source;
    }
}

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

@ -1317,11 +1317,17 @@ public class BaseHospitalRequestMapping {
    public static class WlyyFamilyMember extends Basic{
        public static final String wlyyFamilyMember  = "/wlyyFamilyMember";
        public static final String sendZSFamily = "/sendZSFamily";
        public static final String sendFamily = "/sendFamily";
        public static final String findRelationDict = "/findRelationDict";
        public static final String findFamilyMumber = "/findFamilyMumber";
        public static final String findNatFamilyMumber = "/findNatFamilyMumber";
        public static final String findNatFamilyMumberById = "/findNatFamilyMumberById";
        public static final String delFamilyMumber = "/delFamilyMumber";
        public static final String delNatFamilyMumber = "/delNatFamilyMumber";
        public static final String updateFamilyMumber = "/updateFamilyMumber";
        public static final String saveFamilyRelation = "/saveFamilyRelation";
        public static final String saveNatFamilyRelation = "/saveNatFamilyRelation";
        public static final String saveFamilyRelationAppoint="/saveFamilyRelationAppoint";
        public static final String findSingleMember = "/findSingleMember";
    }

+ 13 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/archive/ArchiveVO.java

@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModel;
@ApiModel(value = "建档实体", description = "建档实体")
public class ArchiveVO {
    private String id0000;//医保保险号
    private String id0000;//医保保险号 可为空
    private String cardno;//卡号
    private String xming0;//姓名
    private String sfzhao;//身份证
@ -16,16 +16,17 @@ public class ArchiveVO {
    private String brnl00;//年龄
    private String yytel0;//电话
    private String csrq00;//出生日期
    private String bjjbie;//保健级别
    private String bjjbie;//保健级别 可为空
    private String cardtype;//2-医保 X-自费
    private String guid00;//市民健康ID
    private String guid00;//市民健康ID 可为空
    private String grsfen;//个人身份,自费病人可为空,医保的不能为空
    private String addres;//地址
    private String addres;//地址 可为空
    private String smdj00;//实名登记
    private String ehealthCardId;//电子健康卡ID
    private String mindexId;//居民健康卡索引ID
    private String smkId;//经信局市民卡ID
    private String fwqd00;//服务渠道
    private String hsflag;//核酸建档  传1
    public String getId0000() {
        return id0000;
@ -170,4 +171,12 @@ public class ArchiveVO {
    public void setFwqd00(String fwqd00) {
        this.fwqd00 = fwqd00;
    }
    public String getHsflag() {
        return hsflag;
    }
    public void setHsflag(String hsflag) {
        this.hsflag = hsflag;
    }
}

+ 23 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java

@ -289,6 +289,29 @@ public class IdCardUtil {
        return null;
    }
    /**
     * 身份证提取出身日期
     *
     * @param card
     * @return
     * @throws Exception
     */
    public static String getBirthdayForIdcardStr2(String card)
            throws Exception {
        if (card.length() == 18) {
            String year = card.substring(6).substring(0, 4);// 得到年份
            String yue = card.substring(10).substring(0, 2);// 得到月份
            String ri = card.substring(12).substring(0, 2);// 得到日
            return year  + yue +  ri;
        } else if (card.length() == 15) {
            String uyear = "19" + card.substring(6, 8);// 年份
            String uyue = card.substring(8, 10);// 月份
            String uri = card.substring(10, 12);// 得到日
            return uyear +  uyue  + uri;
        }
        return null;
    }
    /**
     * 身份证提取出身日期
     *

+ 85 - 1
gateway/ag-basic/pom.xml

@ -133,7 +133,7 @@
        </dependency>
    </dependencies>
    <build>
    <!--<build>
        <finalName>ag-basic</finalName>
        <plugins>
            <plugin>
@ -149,4 +149,88 @@
            </plugin>
        </plugins>
    </build>
-->
    <build>
        <finalName>ag-basic</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <!-- 是否要把第三方jar加入到类构建路径 -->
                            <addClasspath>true</addClasspath>
                            <!-- 外部依赖jar包的最终位置 -->
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.yihu.AgBasicServer</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--拷贝依赖到jar外面的lib目录-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-lib</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!-- 依赖包输出目录,将来不打进jar包里 -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--指定配置文件,将resources打成外部resource-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
                        <manifestEntries>
                            <Class-Path>resources/</Class-Path>
                        </manifestEntries>
                    </archive>
                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件) -->
                    <excludes>
                        <exclude>**/*.yml</exclude>
                        <exclude>**/*.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- 拷贝资源文件 外面的resource目录-->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <!-- 资源文件输出目录 -->
                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

+ 3 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -110,7 +110,9 @@ public class BasicZuulFilter extends ZuulFilter {
                url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/prescription/searchRecordWrite"))){
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel"))){
            logger.info("入参"+ctx.getRequestQueryParams());
            try {
                decrypt(ctx,request);

+ 6 - 2
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -63,7 +63,9 @@ public class PostFilter extends ZuulFilter {
        if (url.contains("/excelControl")||url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/prescription/searchRecordWrite")){
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel")){
            return true;
        }
        InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
@ -139,7 +141,9 @@ public class PostFilter extends ZuulFilter {
                url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/prescription/searchRecordWrite"))){
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel")||url.contains("/open/noEntry"))){
            RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
        }else {
            RequestContext.getCurrentContext().setResponseBody(body);

+ 17 - 0
gateway/ag-basic/src/main/resources/application.yml

@ -104,6 +104,10 @@ endpoints:
    enabled: false
  trace:
    enabled: false
  mappings:
    enabled: false
  heapdump:
    enabled: false
#---
#spring:
@ -309,3 +313,16 @@ spring:
    host: 172.26.0.222 # Redis server host.
    port: 6379 # Redis server port.
    password: Kb6wKDQP1W4
---
spring:
  profiles: jwZnygProd
  datasource:
     url: jdbc:mysql://59.61.92.90:9409/medicine?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
     username: wlyy
     password: qY#j2n5O
  redis:
     host: 59.61.92.90
     port: 9054
     password: jkzlehr

+ 8 - 0
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -166,6 +166,14 @@ spring:
---
spring:
  profiles: jwZnyg
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}
---
spring:
  profiles: jwZnygProd
  cloud:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}

+ 20 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/RoleDao.java

@ -0,0 +1,20 @@
package com.yihu.jw.security.dao.user;
import com.yihu.jw.entity.base.role.RoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Dao - 角色
 * Created by progr1mmer on 2018/8/17.
 */
public interface RoleDao extends PagingAndSortingRepository<RoleDO, String>, JpaSpecificationExecutor<RoleDO> {
    RoleDO findByCode(String code);
    List<RoleDO> findByNameAndStatus(String name, Integer status);
    List<RoleDO> findByNameAndSaasIdAndStatus(String name, String saasId, Integer status);
}

+ 19 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/WlyyUserAreaDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.security.dao.user;
import com.yihu.jw.entity.equipment.WlyyUserAreaDO;
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;
import java.util.List;
public interface WlyyUserAreaDao extends PagingAndSortingRepository<WlyyUserAreaDO, String>, JpaSpecificationExecutor<WlyyUserAreaDO> {
    @Query("select id from WlyyUserAreaDO where userId = ?1 ")
    List<WlyyUserAreaDO> findAllByUserId(String userId);
    @Modifying
    @Query("delete from WlyyUserAreaDO p where p.userId=?1 ")
    void deleteByUserId(String userId);
}

+ 19 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/user/WlyyUserEquipmentDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.security.dao.user;
import com.yihu.jw.entity.equipment.WlyyUserEquipmentDO;
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;
import java.util.List;
public interface WlyyUserEquipmentDao extends PagingAndSortingRepository<WlyyUserEquipmentDO, String>, JpaSpecificationExecutor<WlyyUserEquipmentDO> {
    @Modifying
    @Query("delete from WlyyUserEquipmentDO p where p.userId=?1 and del=1 ")
    void deleteByUserId(String userId);
    @Query("select id from WlyyUserEquipmentDO where userId = ?1 and del=1 ")
    List<WlyyUserEquipmentDO> findAllByUserId(String userId);
}

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

@ -1667,6 +1667,80 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    /**
     * I健康医生端授权登录
     * @param code 医生code
     * @param client_id
     * @param login_type 3
     * @param httpSession
     * @return
     */
    @RequestMapping(value = "/oauth/checkWlyyUserLogin", method = RequestMethod.POST)
    public ObjEnvelop checkQRUserCodeLogin(String code,String client_id,String login_type,HttpSession httpSession){
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        if (StringUtils.isEmpty(code)) {
            throw new InvalidRequestException("doctor is null");
        }
        logger.info("origin doctorCode :"+code);
        KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
        String doctorCode = com.yihu.jw.security.utils.RSAUtils.decryptBase64(code, keyPair);
        logger.info("after doctorCode :"+doctorCode);
        JSONObject map = null;
        try{
            map= oauthWlyyConfigService.checkWlyyUserDoctor(doctorCode);
        }catch (Exception e){
            logger.error(e);
            return ObjEnvelop.getError("授权失败");
        }
        String authCode = map.getString("authCode");
        if(!"1".equals(authCode)){
            map.remove("doctor");
            return ObjEnvelop.getError("授权失败");
        }
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        JSONObject doctor = map.getJSONObject("doctor");
        Map<String, String> parameters = new HashedMap();
        parameters.put("login_type","2");
        parameters.put("username",doctor.getString("idcard"));
        parameters.put("grant_type", "ihealthCode");
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        if (authenticatedClient != null) {
            oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        }
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        String loginType = parameters.get("login_type");
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setCreateTime(new Date());
        String userAgent = JSONObject.toJSONString(wlyyUserSimple);
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogService.save(baseLoginLogDO);
        map.put("WlyyUserSimple",wlyyUserSimple);
        map.remove("doctor");
        return ObjEnvelop.getSuccess("success",map);
    }
    @RequestMapping(value = "/oauth/imgCaptcha", method = RequestMethod.GET)
    @ApiOperation("生成验证码")
    public ObjEnvelop createCaptcha()throws Exception{

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

@ -1,9 +1,14 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.equipment.WlyyUserAreaDO;
import com.yihu.jw.entity.equipment.WlyyUserEquipmentDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.wlyyinfo.OauthWlyyConfigDO;
import com.yihu.jw.security.dao.OauthWlyyConfigDao;
@ -11,6 +16,10 @@ import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.security.dao.doctor.DoctorMappingDao;
import com.yihu.jw.security.dao.iot.UserDao;
import com.yihu.jw.security.dao.user.RoleDao;
import com.yihu.jw.security.dao.user.WlyyUserAreaDao;
import com.yihu.jw.security.dao.user.WlyyUserEquipmentDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
@ -49,6 +58,14 @@ public class OauthWlyyConfigService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private UserDao userDao;
    @Autowired
    private WlyyUserAreaDao userAreaDao;
    @Autowired
    private WlyyUserEquipmentDao userEquipmentDao;
    @Autowired
    private RoleDao roleDao;
    public JSONObject checkWlyyDoctor(String code)throws Exception{
@ -222,6 +239,141 @@ public class OauthWlyyConfigService {
    }
    public JSONObject checkWlyyUserDoctor(String doctor)throws Exception{
        OauthWlyyConfigDO oauthWlyyConfigDO = oauthWlyyConfigDao.findOne("wlyyConfig");
        //token获取accesstoken
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("appid", oauthWlyyConfigDO.getAppId()));
        params.add(new BasicNameValuePair("appSecret",oauthWlyyConfigDO.getAppSecret()));
        String res = httpClientUtil.post(oauthWlyyConfigDO.getTokenUrl(),params,"UTF-8");
        String token = null;
        JSONObject rsjson = JSONObject.parseObject(res);
        logger.info("checkWlyyDoctor token :"+rsjson.toString());
        Integer status = rsjson.getInteger("status");
        if(status==10000){
            //设置入参
            List<NameValuePair> p = new ArrayList<>();
            p.add(new BasicNameValuePair("doctor", doctor));
            //设置头部
            token = rsjson.getJSONObject("result").getString("accesstoken");
            Map<String,Object> headerMap = new HashedMap();
            headerMap.put("accesstoken",token);
            String rs = httpClientUtil.headerPost(oauthWlyyConfigDO.getUrl(),p,"UTF-8",headerMap);
            logger.info("checkWlyyDoctor doctorInfo :"+rs);
            JSONObject auth = JSONObject.parseObject(rs);
            Integer s = auth.getInteger("status");
            if(s == 200){
                JSONObject data = auth.getJSONObject("data");
                String authCode =  data.getString("authCode");
                if("1".equals(authCode)){
                    JSONObject doctorJson = data.getJSONObject("doctor");
                    String idcard = doctorJson.getString("idcard");
                    String mobile = doctorJson.getString("mobile");
                    if(StringUtils.isBlank(idcard)){
                        data.put("authCode","-3");
                        data.put("mes","I健康账户信息不完整,授权失败");
                        return data;
                    }
                    UserDO userDO = userDao.findByMobile(mobile);
                    if(userDO!=null){
                        return data;
                    }else{
                        //存储医生全科医生信息
                        userDO = new UserDO();
                        userDO.setSaasId("808080eb7bc87123017bf16ba0ad0046");
                        userDO.setName(doctorJson.getString("name"));
                        userDO.setIdcard(doctorJson.getString("idcard"));
                        userDO.setUsername(doctorJson.getString("mobile"));
                        userDO.setMobile(doctorJson.getString("mobile"));
                        if (doctorJson.getInteger("sex")==1){
                            userDO.setGender(UserDO.Gender.male);
                        }else if (doctorJson.getInteger("sex")==2){
                            userDO.setGender(UserDO.Gender.female);
                        }
                        //认证信息设置
                        String salt = randomString(5);
                        String pw = idcard.substring(idcard.length()-6);
                        userDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                        userDO.setSalt(salt);
                        userDO.setEnabled(1);
                        userDO.setLocked(0);
                        userDO.setCreateTime(new Date());
                        userDO.setUpdateTime(new Date());
                        userDO = userDao.save(userDO);
                        //18补货员19社区药柜管理员20药柜区域管理员21药柜超级管理员
                        String expandLevel = doctorJson.getString("expandLevel");
                        RoleDO roleDO = roleDao.findOne(expandLevel);
                        userDO.setRoleId(roleDO.getId());
                        userDO = userDao.save(userDO);
                        List<WlyyUserAreaDO> userAreaDOList = userAreaDao.findAllByUserId(userDO.getId());
                        if (userAreaDOList==null||userAreaDOList.size()==0){
                            WlyyUserAreaDO userAreaDO = new  WlyyUserAreaDO();
                            userAreaDO.setUserId(userDO.getId());
                            userAreaDO.setCity(doctorJson.getString("city"));
                            userAreaDO.setCityName(doctorJson.getString("cityName"));
                            userAreaDO.setTown(doctorJson.getString("town"));
                            userAreaDO.setTownName(doctorJson.getString("townName"));
                            userAreaDO.setHospital(doctorJson.getString("hospital"));
                            userAreaDO.setHospitalName(doctorJson.getString("hospitalName"));
                            userAreaDO.setUpdateTime(new Date());
                            userAreaDO.setCreateTime(new Date());
                            userAreaDO.setDel(1);
                            userAreaDao.save(userAreaDO);
                        }
                        if (roleDO.getCode().equalsIgnoreCase("replenisher")){
                            String sql = "select d.id as id,d.equ_name as name from t_mediicine_device d where d.belong_community ='"+doctorJson.getString("hospital")+"' ";
                            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
                            for (Map<String,Object> map:mapList){
                                WlyyUserEquipmentDO equipmentDO = new WlyyUserEquipmentDO();
                                String id = map.get("id").toString();
                                String name = map.get("name")==null?"":map.get("name").toString();
                                equipmentDO.setEquipmentId(id);
                                equipmentDO.setEquipmentName(name);
                                equipmentDO.setUserId(userDO.getId());
                                equipmentDO.setDel(1);
                                equipmentDO.setCityName(doctorJson.getString("cityName"));
                                equipmentDO.setCity(doctorJson.getString("city"));
                                equipmentDO.setTown(doctorJson.getString("town"));
                                equipmentDO.setTownName(doctorJson.getString("townName"));
                                equipmentDO.setHospital(doctorJson.getString("hospital"));
                                equipmentDO.setHospitalName(doctorJson.getString("hospitalName"));
                                equipmentDO.setCreateTime(new Date());
                                equipmentDO.setUpdateTime(new Date());
                                userEquipmentDao.save(equipmentDO);
                            }
                        }
                        return data;
                    }
                }else{
                    return data;
                }
            }else{
                //请求异常
                JSONObject data = new JSONObject();
                data.put("authCode","-2");
                return data;
            }
        }else {
            //请求异常
            JSONObject data = new JSONObject();
            data.put("authCode","-2");
            return data;
        }
    }
    /**
     * 获取全部职称
     * @return

+ 2 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java

@ -37,8 +37,8 @@ public class UserService {
        userDO.setUsername(userDO.getMobile());
        userDO.setName(userDO.getMobile());
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
        userDO.setLocked(false);
        userDO.setEnabled(1);
        userDO.setLocked(0);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {

+ 32 - 0
server/svr-authentication/src/main/resources/application.yml

@ -625,4 +625,36 @@ im:
  im_list_get: http://172.26.0.105:3000/
kick:
    ##互踢 1开通 0关闭
    eachOther: 0
---
spring:
  profiles: jwZnygProd
  datasource:
    url: jdbc:mysql://59.61.92.90:9409/medicine?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
  redis:
    host: 59.61.92.90
    port: 9054
    password: jkzlehr
iHealth:
  user-info-uri: http://ehr.yihu.com/wlyy/iHealth/userInfo
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.222:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx
im:
  im_list_get: http://172.26.0.105:3000/
kick:
    eachOther: 0

+ 9 - 0
server/svr-authentication/src/main/resources/bootstrap.yml

@ -167,6 +167,15 @@ spring:
---
spring:
  profiles: jwZnyg
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwZnygProd
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}

+ 5 - 7
server/svr-configuration/src/main/resources/bootstrap.yml

@ -37,6 +37,7 @@ spring:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
          repos:
        default-label: ${wlyy.spring.config.git.label:jwdev}
---
spring:
@ -257,15 +258,12 @@ spring:
---
spring:
  profiles: jwZnyg
  profiles: native
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0.config
          username: wangzhinan
          password: wzn0523*
        default-label: ${wlyy.spring.config.git.label:jwdev}
        native:
          search-locations: /usr/local/wlyy2.0.config

+ 48 - 0
svr/svr-base/src/main/resources/application.yml

@ -781,5 +781,53 @@ wechat:
testPattern: #文件服务器上传配置 0本地,1.I健康,2.内网调用
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://127.0.0.1:3000/
---
spring:
  profiles: jwZnygProd
  datasource:
    url: jdbc:mysql://59.61.92.90:9409/medicine?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: qY#j2n5O
  elasticsearch:
    cluster-name: jkzl
    cluster-nodes: 192.168.120.103:6005
    client-transport-sniff: false
    jest:
      uris: http://192.168.120.103:6006
      connection-timeout: 60000
      multi-threaded: true
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 59.61.92.90
    port: 9054
    password: jkzlehr
fastDFS:
  fastdfs_file_url: http://172.26.0.222:8888/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
pay:
  flag: false
wlyy:
  url: https://www.xmtyw.cn/wlyy/
wechat:
  id: xm_hcyy_wx
  url: https://zhyzh.gongshu.gov.cn/
  flag: false
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://127.0.0.1:3000/

+ 8 - 0
svr/svr-base/src/main/resources/bootstrap.yml

@ -130,6 +130,14 @@ spring:
---
spring:
  profiles: jwZnyg
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwZnygProd
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}

+ 259 - 144
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java

@ -110,14 +110,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop doctorFaceCheckInData(@ApiParam(name = "doctorId", value = "医生id", required = true)
                                               @RequestParam(value = "doctorId",required = true) String doctorId){
        try {
            String url = entranceHealthCareUrl + "doctorFaceCheckInData?doctorId="+doctorId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                String url = entranceHealthCareUrl + "doctorFaceCheckInData?doctorId="+doctorId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.doctorFaceCheckInData(doctorId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -129,13 +134,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop advanceWarning(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                            @RequestParam(value = "outpatientId",required = true) String outpatientId){
        try {
            String url = entranceHealthCareUrl + "advanceWarning?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "advanceWarning?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.advanceWarning(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
@ -148,13 +157,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop doctorPrescriptionUpload(@ApiParam(name = "prescriptionId", value = "处方id", required = true)
                                     @RequestParam(value = "prescriptionId",required = true) String prescriptionId){
        try {
            String url = entranceHealthCareUrl + "doctorPrescriptionUpload?outpatientId="+prescriptionId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "doctorPrescriptionUpload?outpatientId="+prescriptionId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.doctorPrescriptionUpload(prescriptionId));
            }
        }catch (Exception e){
            e.printStackTrace();
@ -169,13 +182,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
                                               @ApiParam(name = "cancelReason",value="取消原因",required = true)
                                               @RequestParam(value = "cancelReason",required = true) String cancelReason){
        try {
            String url = entranceHealthCareUrl + "doctorPrescriptionUploadCancle?prescriptionId="+prescriptionId+"&cancelReason="+cancelReason;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "doctorPrescriptionUploadCancle?prescriptionId="+prescriptionId+"&cancelReason="+cancelReason;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.doctorPrescriptionUploadCancle(prescriptionId,cancelReason));
            }
        }catch (Exception e){
            e.printStackTrace();
@ -188,14 +205,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop electronicPrescriptionReceiving(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                                     @RequestParam(value = "outpatientId",required = true) String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionReceiving(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -207,14 +229,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop electronicPrescriptionCancle(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                                      @RequestParam(value = "outpatientId",required = true) String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "electronicPrescriptionCancle?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "electronicPrescriptionCancle?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionCancle(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -226,14 +253,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop pharmacistReviewResults(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                                      @RequestParam(value = "outpatientId",required = true) String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "pharmacistReviewResults?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "pharmacistReviewResults?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.pharmacistReviewResults(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -247,14 +279,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
                                                     @ApiParam(name = "doctorCode",value="医保医生code",required = true)
                                                     @RequestParam(value = "doctorCode",required = true) String doctorCode)throws Exception{
        try {
            String url = entranceHealthCareUrl + "outpatientReminder?outpatientId="+outpatientId+"&doctorCode="+doctorCode;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "outpatientReminder?outpatientId="+outpatientId+"&doctorCode="+doctorCode;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.outpatientReminder(outpatientId,doctorCode));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -269,14 +306,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
                                                     @ApiParam(name = "doctorCode",value="医保医生code",required = true)
                                                     @RequestParam(value = "doctorCode",required = true) String doctorCode)throws Exception{
        try {
            String url = entranceHealthCareUrl + "outpatientEventReminder?outpatientId="+outpatientId+"&doctorCode="+doctorCode;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "outpatientEventReminder?outpatientId="+outpatientId+"&doctorCode="+doctorCode;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.outpatientEventReminder(outpatientId,doctorCode));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -287,14 +329,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取医保accessToken", notes = "获取医保accessToken")
    public ObjEnvelop getChargeDict()throws Exception{
        try {
            String url = entranceHealthCareUrl + "getYlzToken";
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "getYlzToken";
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.getYlzToken());
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -307,14 +354,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop authorized(@ApiParam(name = "patient", value = "患者id", required = true)
                                     @RequestParam(value = "patient", required = true)String patient)throws Exception{
        try {
            String url = entranceHealthCareUrl + "authorized?patient="+patient;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "authorized?patient="+patient;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.authorized(patient));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -326,14 +378,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop medicareOnline(@ApiParam(name = "patient", value = "患者id", required = true)
                                 @RequestParam(value = "patient", required = true)String patient)throws Exception{
        try {
            String url = entranceHealthCareUrl + "medicareOnline?patient="+patient;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "medicareOnline?patient="+patient;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.medicareOnline(patient));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -345,13 +402,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop medicareOnlineBase64(@ApiParam(name = "patient", value = "患者id", required = true)
                                     @RequestParam(value = "patient", required = true)String patient)throws Exception{
        try {
            String url = entranceHealthCareUrl + "medicareOnlineBase64?patient="+patient;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "medicareOnlineBase64?patient="+patient;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.medicareOnlineBase64(patient));
            }
        }catch (Exception e){
            e.printStackTrace();
@ -364,14 +425,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop register(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                     @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "register?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "register?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.register(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -383,13 +449,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop registerBack(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                               @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "registerBack?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "registerBack?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
@ -402,14 +472,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop feeDetailUpload(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                   @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "feeDetailUpload?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "feeDetailUpload?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -423,14 +498,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "remark", value = "作废原因", required = false)
                                          @RequestParam(value = "remark", required = true)String remark)throws Exception{
        try {
            String url = entranceHealthCareUrl + "feeDetailRefund?outpatientId="+outpatientId+"&remark="+remark;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "feeDetailRefund?outpatientId="+outpatientId+"&remark="+remark;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(outpatientId,remark));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -442,14 +522,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop preSettlement(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                      @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "preSettlement?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "preSettlement?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.preSettlement(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -461,14 +546,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop preSettlementRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                    @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "preSettlementRefund?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "preSettlementRefund?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -480,14 +570,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                          @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "getSettlementResultUrl?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "getSettlementResultUrl?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -499,14 +594,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop getSettlementResult(@ApiParam(name = "code", value = "结果回参", required = true)
                                             @RequestParam(value = "code", required = false)String code)throws Exception{
        try {
            String url = entranceHealthCareUrl + "getSettlementResult?code="+code;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "getSettlementResult?code="+code;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResult(code));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -518,14 +618,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop uploadMedicalHistory(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                          @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "uploadMedicalHistory?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "uploadMedicalHistory?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.uploadMedicalHistory(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -539,14 +644,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
                                           @ApiParam(name = "remark", value = "作废原因", required = false)
                                           @RequestParam(value = "remark", required = false)String remark)throws Exception{
        try {
            String url = entranceHealthCareUrl + "refundMedicalHistory?outpatientId="+outpatientId+"&remark="+remark;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "refundMedicalHistory?outpatientId="+outpatientId+"&remark="+remark;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.refundMedicalHistory(outpatientId,remark));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
@ -558,14 +668,19 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop uploadIcdProcess(@ApiParam(name = "outpatientId", value = "门诊id", required = false)
                                           @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        try {
            String url = entranceHealthCareUrl + "uploadIcdProcess?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "uploadIcdProcess?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.uploadIcdProcess(outpatientId));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);

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

@ -1,9 +1,11 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BaseNatPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.family.dao.WlyyNatPatientFamilyMemberDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.family.service.PatientMemberDictService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
@ -70,6 +72,8 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    private ZBSmsService zbSmsService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
    @Value("${wechat.id}")
    private String wxId;
@ -263,6 +267,57 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        return mixEnvelop;
    }
    @ApiOperation("核酸代预约发送验证码")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.sendFamily)
    public MixEnvelop sendCaptcha(@ApiParam(name = "jsonData", value = "jsonData", required = false)
                                    @RequestParam(value = "jsonData", required = false) String jsonData) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        JSONObject obj = JSONObject.parseObject(jsonData);
        String client_id = obj.getString("client_id");
        String phoneNum = obj.getString("phoneNum");
        if (StringUtils.isEmpty(client_id)) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("client_id不能为空");
            return mixEnvelop;
        }
        if (StringUtils.isEmpty(phoneNum)) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("电话号不能为空");
            return mixEnvelop;
        }
        if (phoneNum.length() > 12) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("请输入正确的手机号");
            return mixEnvelop;
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!this.isIntervalTimeout(client_id, phoneNum)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
            //发送短信获取验证码
        }
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isNeedSMS");
        if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
            String captcha = wlyyHospitalSysDictDO.getDictValue();
            this.store(client_id, phoneNum, captcha, 120);
            mixEnvelop.setMessage("验证码发送成功");
        }else {
            String captcha = this.getCodeNumber();
            System.out.println("=====================当前短信验证码============="+captcha+"=====================");
            System.out.println("发送中山验证码开始");
            int result = 1;
            result = zhongShanSMSService.ZhongShangSendSMS(phoneNum, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。如非本人操作,请忽略");
            if (0 == result) {
                this.store(client_id, phoneNum, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }
        return mixEnvelop;
    }
    public void store(String client_id, String username, String code, int expire) {
        String key = client_id + ":" + username + KEY_SUFFIX;
        redisTemplate.opsForValue().set(key, code);
@ -397,6 +452,149 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
        return mixEnvelop;
    }
    @ApiOperation("核酸待预约保存家人关系")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.saveNatFamilyRelation)
    public MixEnvelop saveNatFamilyRelation(@ApiParam(name = "jsonData", value = "jsonData", required = false)
                                         @RequestParam(value = "jsonData", required = false) String jsonData) {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try {
            JSONObject jsonObject = JSONObject.parseObject(jsonData);
            String client_id = jsonObject.getString("client_id");
            String username = jsonObject.getString("phoneNum");
            String code = jsonObject.getString("code");
            String medicareType = jsonObject.getString("medicareType");
            String medicare = jsonObject.getString("medicare");
            String clinicId = jsonObject.getString("clinicId");
            boolean checkCode =false;
            if(!StringUtils.isEmpty(code)){
                checkCode = this.verification(client_id, username, code);
            }else if(StringUtils.isEmpty(code)&&StringUtils.isEmpty(client_id)) {
                checkCode = true;
            }
            if (checkCode) {
                String patientId = jsonObject.getString("patientId");
                String familyName = jsonObject.getString("familyName");
                String dictId = jsonObject.getString("dictId");
                String cardType = jsonObject.getString("cardType");
                String idCard = jsonObject.getString("idCard");
                //家人关系只允许添加一次自己
                if (null == jsonObject.get("id")&&!StringUtils.isEmpty(dictId)&&"7".equalsIgnoreCase(dictId)){
                    List<BaseNatPatientFamilyMemberDO> list = natPatientFamilyMemberDao.findbyPatientAndFamilyRelation(patientId,dictId);
                    if (null!=list&&list.size()>0){
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您已经添加自己的信息请勿重复添加");
                        return mixEnvelop;
                    }
                }
                mixEnvelop = wlyyFamilyMemberService.addNatFamily(patientId, familyName, dictId, cardType, idCard, username, false, medicareType, medicare, clinicId);
            } else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("验证码不正确");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mixEnvelop;
    }
    @ApiOperation("核酸查询就诊人")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findNatFamilyMumber)
    public Envelop findNatFamilyMumber(@ApiParam(name = "patientId", value = "patientId", required = false)
                                               @RequestParam(value = "patientId", required = false) String patientId) {
        try {
            List<BaseNatPatientFamilyMemberDO> list = new ArrayList<>();
            try {
                list = wlyyFamilyMemberService.selectByPatientId(patientId);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return success(list);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("核酸查询单个就诊人")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findNatFamilyMumberById)
    public Envelop findNatFamilyMumberById(@ApiParam(name = "id", value = "id", required = false)
                                       @RequestParam(value = "id", required = false) String id) {
        try {
            return success(wlyyFamilyMemberService.selectByFamilyId(id));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("删除家庭关系")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.delNatFamilyMumber)
    public Envelop delNatFamilyMumber(@ApiParam(name = "id", value = "家庭关系id", required = false)
                                       @RequestParam(value = "id", required = false) String id) {
        try {
            return success(wlyyFamilyMemberService.deleteMember(id));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("预约挂号时保存家人关系")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.saveFamilyRelationAppoint)
    public MixEnvelop saveFamilyRelationAppoint(@ApiParam(name = "jsonData", value = "jsonData", required = false)
                                         @RequestParam(value = "jsonData", required = false) String jsonData) {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try {
            JSONObject jsonObject = JSONObject.parseObject(jsonData);
            String client_id = jsonObject.getString("client_id");
            String username = jsonObject.getString("phoneNum");
            String code = jsonObject.getString("code");
            String medicareType = jsonObject.getString("medicareType");
            String medicare = jsonObject.getString("medicare");
            String clinicId = jsonObject.getString("clinicId");
            boolean checkCode =false;
            if(!StringUtils.isEmpty(code)){
                checkCode = this.verification(client_id, username, code);
            }else if(StringUtils.isEmpty(code)&&StringUtils.isEmpty(client_id)) {
                checkCode = true;
            }
            if (checkCode) {
                String patientId = jsonObject.getString("patientId");
                String familyName = jsonObject.getString("familyName");
                String dictId = jsonObject.getString("dictId");
                String cardType = jsonObject.getString("cardType");
                String idCard = jsonObject.getString("idCard");
                //家人关系只允许添加一次自己
                if (null == jsonObject.get("id")&&!StringUtils.isEmpty(dictId)&&"7".equalsIgnoreCase(dictId)){
                    List<WlyyPatientFamilyMemberDO> list = wlyyPatientFamilyMemberDao.findByPatientAndFamilyRelation(patientId,dictId);
                    if (null!=list&&list.size()>0){
                        mixEnvelop.setStatus(408);
                        mixEnvelop.setMessage("您已经添加自己的信息请勿重复添加");
                        return mixEnvelop;
                    }
                }
                String id = "";
                if (null != jsonObject.get("id")) {
                    id = jsonObject.get("id").toString();
                }
                //获取建档信息
                if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                    mixEnvelop = wlyyFamilyMemberService.addFamilyAppoint(id, patientId, familyName, dictId, cardType, idCard, username, false, medicareType, medicare, clinicId);
                }
            } else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("验证码不正确");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mixEnvelop;
    }
    @ApiOperation("查询就诊人")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findFamilyMumber)
    public Envelop findFamilyMumberByPatientId(@ApiParam(name = "patientId", value = "patientId", required = false)

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

@ -2517,11 +2517,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "preNo", value = "preNo")
                                          @RequestParam(value = "preNo",required = false)String preNo,
                                      @ApiParam(name = "idnoType", value = "idnoType")
                                          @RequestParam(value = "idnoType",required = false)String idnoType){
                                          @RequestParam(value = "idnoType",required = false)String idnoType,
                                      @ApiParam(name = "source", value = "source")
                                          @RequestParam(value = "source", required = false) Integer source){
        try {
            return success(prescriptionService.saveNatAppointment(chargeAmount,inspectionName,mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,
                    cityName,townName,streetName,pm,pushFlag,cardNoType,getUID(),checkPart,chargeFlag,chargeCode,icdCode,preNo,idnoType));
                    cityName,townName,streetName,pm,pushFlag,cardNoType,getUID(),checkPart,chargeFlag,chargeCode,icdCode,preNo,idnoType,source));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }

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

@ -550,68 +550,8 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
        }
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.saveInspectToHospital(IoFlag,PayCardNo,NullahNumber,ApplyDept,ApplyDoctor,wlyyInspectionS));
    }
    /**
     * 合理用药审核接口
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/checkPrescription")
    @ApiOperation(value = "合理用药审核接口", notes = "合理用药审核接口")
    public ObjEnvelop checkPrescription(@ApiParam(name = "infos", value = "药品信息", required = false)
                                            @RequestParam(value = "infos",required = false)String infos,
                                            @ApiParam(name = "patientAndDoctor", value = "医患信息", required = false)
                                            @RequestParam(value = "patientAndDoctor",required = false) String patientAndDoctor)throws Exception{
        JSONArray jsonArray = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i=0;i<jsonArray.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(jsonArray.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONObject jsonObject = JSONObject.parseObject(patientAndDoctor);
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.checkPrescription(jsonObject,wlyyPrescriptionInfoDOS));
    }
    /**
     * 合理用药保存接口
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/saveCheckPrescription")
    @ApiOperation(value = "合理用药保存接口", notes = "合理用药保存接口")
    public ObjEnvelop saveCheckPrescription(@ApiParam(name = "infos", value = "药品信息", required = false)
                                        @RequestParam(value = "infos",required = false)String infos,
                                        @ApiParam(name = "patientAndDoctor", value = "医患信息", required = false)
                                        @RequestParam(value = "patientAndDoctor",required = false) String patientAndDoctor)throws Exception{
        JSONArray jsonArray = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i=0;i<jsonArray.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(jsonArray.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONObject jsonObject = JSONObject.parseObject(patientAndDoctor);
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.saveCheckPrescription(jsonObject,wlyyPrescriptionInfoDOS));
    }
    /**
     * 合理用药作废接口
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/deleteCheckPrescription")
    @ApiOperation(value = "合理用药作废接口", notes = "合理用药作废接口")
    public ObjEnvelop deleteCheckPrescription(@ApiParam(name = "infos", value = "药品信息", required = false)
                                              @RequestParam(value = "infos",required = false)String infos,
                                              @ApiParam(name = "patientAndDoctor", value = "医患信息", required = false)
                                              @RequestParam(value = "patientAndDoctor",required = false) String patientAndDoctor)throws Exception{
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        if (StringUtils.isNotBlank(infos)){
            JSONArray jsonArray = JSONArray.parseArray(infos);
            for (int i=0;i<jsonArray.size();i++){
                WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(jsonArray.get(i).toString(),WlyyPrescriptionInfoDO.class);
                wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
            }
        }
        JSONObject jsonObject = JSONObject.parseObject(patientAndDoctor);
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.deleteCheckPrescription(jsonObject,wlyyPrescriptionInfoDOS));
    }
    /**
     * 合理用药作废接口
     * @return

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

@ -3281,9 +3281,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/selectNatTime")
    @ApiOperation(value = "核酸号源控制查询")
    public ObjEnvelop selectNatTime() throws Exception {
    public ObjEnvelop selectNatTime( @ApiParam(name = "flag", value = "flag", required = false)
                                         @RequestParam(value = "flag", required = false)Integer flag) throws Exception {
        try {
            return prescriptionService.selectNatTime();
            return prescriptionService.selectNatTime(flag);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -3344,10 +3345,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "preNo", value = "preNo")
                                      @RequestParam(value = "preNo", required = false) String preNo,
                                      @ApiParam(name = "idnoType", value = "idnoType")
                                          @RequestParam(value = "idnoType", required = false) String idnoType) {
                                          @RequestParam(value = "idnoType", required = false) String idnoType,
                                      @ApiParam(name = "source", value = "source")
                                          @RequestParam(value = "source", required = false) Integer source) {
        try {
            return success(prescriptionService.saveNatAppointment(chargeAmount, inspectionName, mediaCard, patientId, name, cardNo, cardType, mobile, firstJobCode, firstJobName, secondJobCode, secondJobName, natTime, address, provinceName,
                    cityName, townName, streetName, pm, pushFlag, cardNoType, getUID(), checkPart, chargeFlag, chargeCode, icdCode, preNo,idnoType));
                    cityName, townName, streetName, pm, pushFlag, cardNoType, getUID(), checkPart, chargeFlag, chargeCode, icdCode, preNo,idnoType,source));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }