Selaa lähdekoodia

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

wangjun 4 vuotta sitten
vanhempi
commit
3ae78a2e88

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

@ -276,6 +276,38 @@ public class XzzxEntranceService{
        return json;
    }
    /**
     * 查询医生信息
     * @return
     */
    public String selectDoctorInfo(String idcard)throws Exception{
        String api = "GetDoctorInfo";
        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 = "<Idcard>"+idcard+"</Idcard>";
        }
        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("getDoctorInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getDoctorInfo json:"+json);
        return json;
    }
    public String findWlyyDoctor(JSONArray doctors)throws Exception{
        logger.info("doctors size:"+doctors.size());
        if(doctors!=null&&doctors.size()>0){
@ -1335,12 +1367,12 @@ public class XzzxEntranceService{
        if (!StringUtils.isEmpty(PayCardNo)){
            condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
        }
        if (!StringUtils.isEmpty(NullahNumber)){
            condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
        }
        if (!StringUtils.isEmpty(ApplyDept)){
            condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
        }
        if (!StringUtils.isEmpty(NullahNumber)){
            condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
        }
        if (!StringUtils.isEmpty(ApplyDoctor)){
            condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
        }
@ -2091,7 +2123,7 @@ public class XzzxEntranceService{
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            JSONArray array = JSONArray.parseArray(obj).getJSONArray(0);
            if (array!=null&&array.size()!=0){
            /*if (array!=null&&array.size()!=0){
                JSONObject object1 = array.getJSONObject(0);
                if (patientMappingDO==null){
                    patientMappingDO = new PatientMappingDO();
@ -2105,7 +2137,7 @@ public class XzzxEntranceService{
                    patientMappingDO.setMappingCode(object1.getString("SICKID"));
                }
                patientMappingDao.save(patientMappingDO);
            }
            }*/
            return array;
        }
        return null;
@ -2278,7 +2310,7 @@ public class XzzxEntranceService{
     * @param patient 居民id
     * @return
     */
    public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime){
    public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime) throws Exception {
        List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
        JSONArray array = new JSONArray();
        String response="";
@ -2286,7 +2318,8 @@ public class XzzxEntranceService{
        if (patientMappingDO!=null){
            patient = patientMappingDO.getMappingCode();
        }else {
            patient = savePatientMapping(patient);
            //patient = savePatientMapping(patient);
            throw new Exception("患者id不存在");
        }
        String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&startTime="+startTime+"&endTime="+endTime;
        response = httpClientUtil.get(url,"GBK");
@ -3261,12 +3294,12 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            if (null!=wlyyOutpatientDO){
                params.put("PayCardNo",wlyyOutpatientDO.getCardNo());
                params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
                params.put("ApplyDept",wlyyOutpatientDO.getDept());
                params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
            }
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
            if (null!=doctorMappingDO){
                params.put("ApplyDoctor",doctorMappingDO.getMappingCode());
                params.put("ApplyDoctor",doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode());
            }
            params.put("ExecuteDept","50100");
            params.put("PresNo",realOrder);
@ -3302,8 +3335,24 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
            if(null!=patientMappingDO){
                paramRequest.put("patientid",patientMappingDO.getMappingCode());
            }
            //获取医生编号
            BaseDoctorDO doctorDO = doctorDao.findById(wlyyOutpatientDO.getDoctor());
            String operatorId = null;
            if (doctorDO!=null){
                String url = entranceUrl+"selectDoctorInfo?idCard="+doctorDO.getIdcard();
                String response = httpClientUtil.get(url,"GBK");
                JSONObject object = JSONObject.parseObject(response);
                if(object.getInteger("status")==200){
                    String obj = object.getString("obj");
                    JSONArray array = JSONArray.parseArray(obj);
                    if (array!=null&&array.size()!=0){
                        JSONObject jsonObject = array.getJSONObject(0);
                        operatorId = jsonObject.getString("staffNo");
                    }
                }
            }
            if(null!=doctorMappingDO){
                paramRequest.put("operatorid",doctorMappingDO.getMappingCode());
                paramRequest.put("operatorid",operatorId);
                paramRequest.put("operatorname",wlyyPrescriptionDO.getDoctorName());
            }
            paramRequest.put("type","2");
@ -3322,31 +3371,23 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
                paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
                paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
            }
            paramRequest.put("templateid","662");
            paramRequest.put("templateid","1158");
            paramRequest.put("catalogid","50");
            paramRequest.put("emrtype","0");
            paramRequest.put("emrtype","93");
            paramRequest.put("emrtitle","互联网医院");
        }
        params.put("jsonInfo",paramRequest.toJSONString());
        JSONObject jsonObject = new JSONObject();
        String response = "";
        String url = entranceUrl+"returnEmrHtmlByHLW";
        logger.info("params"+params.toString());
        response = httpClientUtil.httpPost(url,params);
        JSONObject object = new JSONObject();
        logger.info("保存电子病历"+response);
        if (response.contains("error")){
            logger.info("保存失败:"+response);
        if (response.contains("error")||response.contains("ERROR")){
            return "faild";
        }else {
            object = JSONObject.parseObject(response);
            if(object.getInteger("status")==200){
                jsonObject = object.getJSONObject("obj");
                logger.info("保存成功:"+jsonObject);
            }
            return "success";
        }
    }

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

@ -3,9 +3,11 @@ package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.IdCardUtil;
@ -86,6 +88,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    public WlyyUserDetailsService(DataSource dataSource) {
        this.setDataSource(dataSource);
    }
@ -171,6 +176,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class),username,getIdcard());
            if (null == users || users.size() == 0) {
                String idcard = null;
                //厦门I健康账号同步
                if("xm_ihealth_wx".equals(getWechatId())){
                    List<NameValuePair> params = new ArrayList<>();
@ -197,7 +203,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    try {
                        String salt = randomString(5);
                        String idcard = patient.getString("idcard");
                        idcard = patient.getString("idcard");
                        String pw = idcard.substring(idcard.length()-6);
                        this.getJdbcTemplate().update(DEFAULT_PATIENT_INSERT_STATEMENT,
@ -279,6 +285,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    if (null != object1&&null!=object1.get("status") && "200".equals(object1.get("status").toString())) {
                        JSONObject patient = object1.getJSONObject("userinfo");
                        String salt = randomString(5);
                        idcard = patient.getString("idcard");
                        String mobile = patient.getString("mobile");
                        String pw = mobile.substring(mobile.length()-6);
                        try {
@ -335,6 +342,22 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    }
                }
                BasePatientDO patientDO = patientDao.findByIdcardAndDel(idcard,"1");
                WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                if (basePatientFamilyMemberDO==null){
                    basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                    basePatientFamilyMemberDO.setPatient(patientDO.getId());
                    basePatientFamilyMemberDO.setFamilyRelation("7");
                    basePatientFamilyMemberDO.setFamilyRelationName("自己");
                    basePatientFamilyMemberDO.setCardType("身份证");
                    basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
                    basePatientFamilyMemberDO.setCreateTime(new Date());
                    basePatientFamilyMemberDO.setUpdateTime(new Date());
                    basePatientFamilyMemberDO.setIsAuthorize(1);
                    basePatientFamilyMemberDO.setIsDel(1);
                    basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
                    familyMemberDao.save(basePatientFamilyMemberDO);
                }
            }
        }
        return users;

+ 14 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/patient/WlyyPatientFamilyMemberDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.security.dao.patient;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
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 WlyyPatientFamilyMemberDao extends PagingAndSortingRepository<WlyyPatientFamilyMemberDO, String>, JpaSpecificationExecutor<WlyyPatientFamilyMemberDO> {
    @Query("from WlyyPatientFamilyMemberDO t where t.patient = ?1 and t.familyRelation =?2 and t.isDel = 1 ")
    WlyyPatientFamilyMemberDO findFamilyMemberByPatientAndRelationCode(String patient,String familyRelation);
}

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

@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.auth.OauthRsaKeyDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.dao.OauthRsaKeyDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.RSAEncrypt;
import com.yihu.utils.security.MD5;
@ -19,8 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -44,6 +44,9 @@ public class OauthSsoService {
    @Autowired
    private  BasePatientWechatDao basePatientWechatDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    public static String getAuthCode()throws Exception{
@ -140,6 +143,23 @@ public class OauthSsoService {
                        basePatientWechatDao.save(wechatDo);
                    }
                    //保存就诊人信息
                    WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(basePatientDO.getId(),"7");
                    if (basePatientFamilyMemberDO==null){
                        basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                        basePatientFamilyMemberDO.setPatient(basePatientDO.getId());
                        basePatientFamilyMemberDO.setFamilyRelation("7");
                        basePatientFamilyMemberDO.setFamilyRelationName("自己");
                        basePatientFamilyMemberDO.setCardType("身份证");
                        basePatientFamilyMemberDO.setCardNo(basePatientDO.getIdcard());
                        basePatientFamilyMemberDO.setCreateTime(new Date());
                        basePatientFamilyMemberDO.setUpdateTime(new Date());
                        basePatientFamilyMemberDO.setIsAuthorize(1);
                        basePatientFamilyMemberDO.setIsDel(1);
                        basePatientFamilyMemberDO.setFamilyMember(basePatientDO.getId());
                        familyMemberDao.save(basePatientFamilyMemberDO);
                    }
                    return rs;
                }
@ -171,6 +191,22 @@ public class OauthSsoService {
                wechatDo.setWechatId(appId);
                basePatientWechatDao.save(wechatDo);
                //保存就诊人信息
                WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(temp.getId(),"7");
                if (basePatientFamilyMemberDO==null){
                    basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                    basePatientFamilyMemberDO.setPatient(temp.getId());
                    basePatientFamilyMemberDO.setFamilyRelation("7");
                    basePatientFamilyMemberDO.setFamilyRelationName("自己");
                    basePatientFamilyMemberDO.setCardType("身份证");
                    basePatientFamilyMemberDO.setCardNo(temp.getIdcard());
                    basePatientFamilyMemberDO.setCreateTime(new Date());
                    basePatientFamilyMemberDO.setUpdateTime(new Date());
                    basePatientFamilyMemberDO.setIsAuthorize(1);
                    basePatientFamilyMemberDO.setIsDel(1);
                    basePatientFamilyMemberDO.setFamilyMember(temp.getId());
                    familyMemberDao.save(basePatientFamilyMemberDO);
                }
                rs.put("code",1);
                rs.put("mes","获取居民信息成功");
                rs.put("patient",temp);

+ 35 - 7
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -4,10 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.security.dao.OauthYlzConfigDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.utils.ByteToInputStream;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.QrcodeUtil;
@ -21,12 +22,8 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import java.io.InputStream;
import java.util.Date;
@ -45,6 +42,8 @@ public class OauthYlzConfigService {
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
//    @Value("${fastDFS.fastdfs_file_url}")
//    private String fastdfs_file_url;
@ -236,13 +235,42 @@ public class OauthYlzConfigService {
                        patient.setCreateTime(new Date());
                        patient.setUpdateTime(new Date());
                        patient.setBirthday(DateUtil.strToDate(biz.getString("birthday"),"yyyyMMdd"));
                        basePatientDao.save(patient);
                        patientDO = basePatientDao.save(patient);
                        WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                        if (basePatientFamilyMemberDO==null){
                            basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                            basePatientFamilyMemberDO.setPatient(patientDO.getId());
                            basePatientFamilyMemberDO.setFamilyRelation("7");
                            basePatientFamilyMemberDO.setFamilyRelationName("自己");
                            basePatientFamilyMemberDO.setCardType("身份证");
                            basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
                            basePatientFamilyMemberDO.setCreateTime(new Date());
                            basePatientFamilyMemberDO.setUpdateTime(new Date());
                            basePatientFamilyMemberDO.setIsAuthorize(1);
                            basePatientFamilyMemberDO.setIsDel(1);
                            basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
                            familyMemberDao.save(basePatientFamilyMemberDO);
                        }
                        rsMap.put("sCode",auth_status);
                        rsMap.put("sMes","success");
                        rsMap.put("patient",patient);
                        return rsMap;
                    }else{
                        WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                        if (basePatientFamilyMemberDO==null){
                            basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                            basePatientFamilyMemberDO.setPatient(patientDO.getId());
                            basePatientFamilyMemberDO.setFamilyRelation("7");
                            basePatientFamilyMemberDO.setFamilyRelationName("自己");
                            basePatientFamilyMemberDO.setCardType("身份证");
                            basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
                            basePatientFamilyMemberDO.setCreateTime(new Date());
                            basePatientFamilyMemberDO.setUpdateTime(new Date());
                            basePatientFamilyMemberDO.setIsAuthorize(1);
                            basePatientFamilyMemberDO.setIsDel(1);
                            basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
                            familyMemberDao.save(basePatientFamilyMemberDO);
                        }
                        rsMap.put("sCode",auth_status);
                        rsMap.put("sMes","success");
                        rsMap.put("patient",patientDO);

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

@ -52,12 +52,19 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
    @GetMapping(value = "/getDoctorInfo")
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    @ApiOperation(value = "同步医生信息", notes = "同步医生信息")
    public ObjEnvelop getDoctorInfo(@ApiParam(name = "idCard", value = "身份证号", required = false)
                                        @RequestParam(value = "idCard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.getDoctorInfo(idcard));
    }
    @GetMapping(value = "/selectDoctorInfo")
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop selectDoctorInfo(@ApiParam(name = "idCard", value = "身份证号", required = false)
                                    @RequestParam(value = "idCard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectDoctorInfo(idcard));
    }
    @GetMapping(value = "/getJobTitle")
    @ApiOperation(value = "同步职称", notes = "同步职称")
    public ObjEnvelop getJobTitle()throws Exception{