Trick пре 5 година
родитељ
комит
99022af3ae

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

@ -93,6 +93,36 @@
            <version>2.4</version>
        </dependency>
        <!-- mq消息 end -->
        <!-- webService start -->
        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.rpc</groupId>
            <artifactId>javax.xml.rpc-api</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.5</version>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>2.5.0</version>
        </dependency>
        <!-- webService end -->
    </dependencies>
    <build>
        <resources>

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

@ -21,8 +21,6 @@ import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -96,9 +94,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public JSONArray findOutpatientList(String patNo, String startTime, String endTime, boolean demoFlag)throws Exception{
//        return entranceService.BS30025(patNo,startTime,endTime,demoFlag);
        return null;
    public  List<WlyyOutpatientVO> findOutpatientList(String patNo, String startTime, String endTime, boolean demoFlag)throws Exception{
        return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag);
    }
    /**
@ -496,19 +493,5 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return true;
    }
    /**
     * 获取所有机构
     * @return
     */
    public List<BaseOrgVO> findAllOrg(){
        List<BaseOrgDO> list = baseOrgDao.findByDel("1");
        List<BaseOrgVO> rs = new ArrayList<>();
        return convertToModels(list,rs,BaseOrgVO.class);
    }
    public List<DictHospitalDeptVO> findDeptByOrg(String orgCode){
        List<DictHospitalDeptDO> list = dictHospitalDeptDao.findByOrgCode(orgCode);
        List<DictHospitalDeptVO> rs = new ArrayList<>();
        return convertToModels(list,rs,DictHospitalDeptVO.class);
    }
}

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

@ -7,28 +7,23 @@ import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.restmodel.hospital.prescription.WlyyHisPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.transaction.Transactional;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -114,22 +109,29 @@ public class EntranceService {
        if(demoFlag){
            resp=getJosnFileResullt(fid);
        }else{
            JSONObject msg=new JSONObject();
            msg.put("endNum","20000");
            msg.put("Msg", new net.sf.json.JSONArray() );
            JSONObject query=new JSONObject();
            query.put("@compy","=");
            query.put("@item","CARD_NO");
            query.put("@splice","and");
            query.put("@value",cardNo);
            msg.put("query",query);
            msg.put("startNum",1);
            List<String> stringList=new ArrayList<>();
            stringList.add(cardNo);
            //获取消息
            resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
            //解析
            resp= MqSdkUtil.xml2jsonObject(resp);
            //先调用银医通获取下载余额到his,再查询his中卡余额
            net.sf.json.JSONObject jsonObject= callYYTServerService(cardNo);
           if(null!=jsonObject && "1".equals(jsonObject.get("code").toString())){
               JSONObject msg=new JSONObject();
               msg.put("endNum","20000");
               msg.put("Msg", new net.sf.json.JSONArray() );
               JSONObject query=new JSONObject();
               query.put("@compy","=");
               query.put("@item","CARD_NO");
               query.put("@splice","and");
               query.put("@value",cardNo);
               msg.put("query",query);
               msg.put("startNum",1);
               List<String> stringList=new ArrayList<>();
               stringList.add(cardNo);
               //获取消息
               resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
               //解析
               resp= MqSdkUtil.xml2jsonObject(resp);
           }else {
               return jsonObject;
           }
        }
        return  ConvertUtil.convertObjectEnvelopByString(resp);
    }
@ -376,8 +378,8 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public JSONArray BS30025(String PAT_NO,String admNo,String registerSn,String startTime,String endTime,boolean demoFlag) throws Exception {
        String fid=BS30025;
    public  List<WlyyOutpatientVO> BS30025(String PAT_NO,String admNo,String registerSn,String startTime,String endTime,boolean demoFlag) throws Exception {
        String fid = BS30025;
        String resp = "";
        if (demoFlag) {
            resp = getJosnFileResullt(fid);
@ -409,7 +411,39 @@ public class EntranceService {
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
        }
        return ConvertUtil.convertListEnvelopInRow(resp);
        JSONArray jsonArray = ConvertUtil.convertListEnvelopInRow(resp);
        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
        WlyyOutpatientVO wlyyOutpatientVO;
        for (Object object : jsonArray) {
            net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object;
            if (null != jsonObjectMgsInfo) {
                wlyyOutpatientVO = new WlyyOutpatientVO();
                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "");
                wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + "");
                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("ADM_SPEC_NAME") ? "" : jsonObjectMgsInfo.get("ADM_SPEC_NAME") + "");
                wlyyOutpatientVO.setPatient(null == jsonObjectMgsInfo.get("PAT_NO") ? "" : jsonObjectMgsInfo.get("PAT_NO") + "");
                wlyyOutpatientVO.setPatientName(null == jsonObjectMgsInfo.get("PAT_NAME") ? "" : jsonObjectMgsInfo.get("PAT_NAME") + "");
                wlyyOutpatientVO.setDoctor(null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "");
                wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + "");
                wlyyOutpatientVO.setIdcard(null == jsonObjectMgsInfo.get("social_no") ? "" : jsonObjectMgsInfo.get("social_no") + "");
                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
                String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
                String[] icdcodeAndName = icds.split("&");
                wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
                wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : "");
                String admDate = null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "";
                String conDate = null == jsonObjectMgsInfo.get("ADM_NO") ? "" : jsonObjectMgsInfo.get("ADM_NO") + "";
                wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVOS.add(wlyyOutpatientVO);
            }
        }
        return wlyyOutpatientVOS;
    }
    /**
@ -819,4 +853,127 @@ public class EntranceService {
        return resp;
    }
    /**
     * 银医通下载
     * @param cardNo 待查询的卡号
     **/
    public net.sf.json.JSONObject callYYTServerService(String cardNo) throws Exception {
        String re = "";
        net.sf.json.JSONObject jsonObject=new net.sf.json.JSONObject();
        String action = "CallYYTServerService";
        String info_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" +
                "<root><ip>172.16.50.40</ip><port>5516</port></root>";
        String reqmsg_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" +
                "<root><sick_id>" + cardNo + "</sick_id><cus_card_no>" + cardNo + "</cus_card_no>" +
                "<req_type>2001</req_type><trade_type>2001</trade_type><req_oper>8644</req_oper><req_term>192001019019</req_term><win_no>6</win_no></root>";
        Map<String, String> params = new HashMap<>();
        params.put("ServerInfo", info_xml);
        params.put("RegMsg", reqmsg_xml);
        String urlString = "http://172.16.50.40:80/ZyXmyytRequestService/ZyXmyytRequestServiceWs.dll?Handler=ZyXmyytRequestServiceWsService";
        String namespace = "zysoft";
        re = WebserviceUtil.post(urlString, namespace, action, params);
        XMLSerializer xmlSerializer = new XMLSerializer();
        JSON json = xmlSerializer.read(re);
        Object errorCode = ((net.sf.json.JSONObject) json).get("error_code");
        if ("ok".equals(errorCode)) {
            JSON json2 = xmlSerializer.read(((net.sf.json.JSONObject) json).get("response").toString());
            System.out.println("银医通下载response:" + json2.toString(1));
            jsonObject.element("code","1");
            jsonObject.element("obj",json);
        } else {
            Object errorMsg = ((net.sf.json.JSONObject) json).get("error_msg");
            jsonObject.element("code","-1");
            jsonObject.element("obj","银医通下载失败," +errorMsg);
            //{"error_type":"0","error_code":"10002","error_msg":"卡号无效"}
        }
        if (StringUtils.isEmpty(re)) {
            throw new Exception("返回为空!");
        } else {
            if (re.startsWith("error")) {
                throw new Exception(re);
            }
        }
        return jsonObject;
    }
    /**
     *  患者门诊就诊记录
     *  按照患者唯一号、科室、医生、获取当前时间往前24小时的挂号记录。获取最新一条判断是否有效(医保当天有效,自费24小时有效)
     *  若是自费,则有效
     *  若是医保,判断日期是否和当前时间同一天,否则无效
     *  @param patNo 居民唯一号 必传参数
     *  @param dept 挂号科室 必传参数
     *  @param doctor 挂号医生 必传参数
     * @return true 已挂号 ,false 未挂号
     * @throws Exception
     */
    public boolean guahao(String patNo,String dept,String doctor,boolean demoFlag) throws Exception {
        String fid = BS30025;
        StringBuffer sbs = new StringBuffer();
        String resp;
        if (demoFlag) {
            resp = getJosnFileResullt(fid);
        } else {
            //AccessControl :用户、密码、服务id
            sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>JKZL</UserName><Password>123456</Password></AccessControl>");
            //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
            sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>");
            //查询信息拼接
            sbs.append("<MsgInfo><onceFlag>1</onceFlag><startNum>1</startNum><endNum>50000</endNum><Msg/>");
            if (StringUtils.isNotBlank(patNo)) {
                sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + patNo + "'\"/>");
            }
            if (StringUtils.isNotBlank(dept)) {
                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + dept + "'\"/>");
            }
            if (StringUtils.isNotBlank(doctor)) {
                sbs.append("<query compy=\"=\" item=\"CON_DOC\" splice=\"and\" value=\"'" + doctor + "'\"/>");
            }
            //获取当前时间 查询当前时间往前推24小时是否有挂号 (医保当天有效,自费24小时有效)
            String now = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD_HH_MM_SS);
            String preday = DateUtil.dateToStr(DateUtil.getPreDays(DateUtil.getNowDate(), -1), DateUtil.YYYY_MM_DD_HH_MM_SS);
            if (StringUtils.isNotBlank(preday)) {
                sbs.append("<query compy=\"&gt;\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + preday + "'\"/>");
            }
            if (StringUtils.isNotBlank(now)) {
                sbs.append("<query compy=\"&lt;\" item=\"ADM_DAT\" splice=\"and\" value=\"'" + now + "'\"/>");
            }
            sbs.append("<order item=\"ADM_DAT\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");
            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
            resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
        }
        //解析返回结果
        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(resp);
        if (null != jsonObject.get("MsgInfo")) {
            net.sf.json.JSONArray jsonArray = (net.sf.json.JSONArray) jsonObject.get("MsgInfo");
            //获取第一条
            net.sf.json.JSONObject object = (net.sf.json.JSONObject) jsonArray.get(0);
            if(null!=object){
                object = (net.sf.json.JSONObject) object.get("row");
            }
            String ybFlag=null != object.get("yb_flag")?object.get("yb_flag").toString():"";
            //市医保,1;省医保,2;自费,3,其他医保,99)
            if ("2".equals(ybFlag)) {
                return true;
            }
            if (("1".equals(ybFlag) || "3".equals(ybFlag))) {
                String admDateStr = object.get("ADM_DAT")+"";
                //挂号时间
                Date admDate = DateUtil.strToDate(admDateStr + "", DateUtil.YYYY_MM_DD_);
                SimpleDateFormat format = new SimpleDateFormat(DateUtil.YYYY_MM_DD_);
                //获取当前时间
                String dateString = format.format(new Date());
                Date nowDate = DateUtil.strToDate(dateString, DateUtil.YYYY_MM_DD_);
                if (0 == nowDate.compareTo(admDate)) {
                    return true;
                } else {
                    return false;
                }
            }
        }
        return false;
    }
}

+ 55 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/WebserviceUtil.java

@ -0,0 +1,55 @@
package com.yihu.jw.hospital.prescription.service.entrance.util;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
import java.util.Map;
/**
 * Created by zdm on 2019/5/31.
 * webservice调用服务
 **/
public class WebserviceUtil {
    private static Logger logger = LoggerFactory.getLogger(WebserviceUtil.class);
   /*  * webservice 调用接口*/
    public static String post(String urlString,String namespace,String api, Map<String,String> params) throws Exception {
        try {
            Service service = new Service();
            // 通过service创建call对象
            Call call = (Call) service.createCall();
            // 设置service所在URL
            call.setTargetEndpointAddress(new java.net.URL(urlString));
            call.setOperationName(new QName(namespace, api));
            call.setUseSOAPAction(true);
            Object[] objs = null;
            if (params != null && params.size() > 0) {
                objs = new Object[params.size()];
                int i = 0;
                for (String key : params.keySet()) {
                    //接口的参数
                    call.addParameter(new QName(key), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
                    objs[i] = params.get(key);
                    i++;
                }
            }
            //设置返回类型
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
            String ret = (String) call.invoke(objs);
            logger.info("=======>请求结果.toString():" + ret.toString());
            return ret.toString();
        } catch (Exception e) {
            logger.info("=======>CA请求报错:" + e.getMessage());
            e.printStackTrace();
            throw e;
        }
    }
}

+ 3 - 3
business/base-service/src/mqConfig/mqdata/BS30025.json

@ -8,11 +8,11 @@
			"BIRTH_DATE": "1959/01/01 00:00:00",
			"ID_CARD": [],
			"PAT_NO": "P11160895-0   ",
			"ADM_DAT": "2018/08/07 01:37:52",
			"ADM_DAT": "2019/06/03 01:37:52",
			"ADM_SPEC": "1190007",
			"ADM_SPEC_NAME": "急诊外科",
			"CON_NO": "2",
			"CON_DATE": "2018/08/07 01:37:52",
			"CON_DATE": "2019/06/03 01:37:52",
			"CON_DOC": "8632 ",
			"CON_DOC_NAME": "赵冰",
			"CON_SPEC": "1190007",
@ -24,7 +24,7 @@
			"REGISTER_SN": "45127672",
			"MJZ": "JZ",
			"social_no": [],
			"yb_flag": "4",
			"yb_flag": "1",
			"icd_name": "毒蛇咬伤&T63.001",
			"diag_two": "&",
			"diag_three": "&",

+ 33 - 0
business/base-service/src/mqConfig/mqdata/yyt.json

@ -0,0 +1,33 @@
{
	"error_type": "2",
	"error_code": "ok",
	"error_msg": [],
	"his_log_no": "9851BE4A-FC77-4987-9A97-5383B1E0572F",
	"response": {
		"@version": "1.0",
		"ans_type": "2001",
		"ans_name": "余额下载",
		"ans_date": "20190531",
		"ans_time": "172420205",
		"ans_code": "00",
		"ans_msg": "交易成功",
		"ans_seq": "0113183",
		"req_date": "20190531",
		"req_org": "0000350211A1002",
		"req_seq": "5132388",
		"cus_guid": "f9d4fdfb-52c2-4aa3-8f77-4b629140a100",
		"cus_card_no": "DB8687139",
		"cus_acc_no": "00156000000030525052",
		"cus_acc_type": "0",
		"cus_currency": "156",
		"cus_acc_status": "000",
		"cus_acc_occupy": "1",
		"cus_occ_org": "0000350211A1002",
		"cus_bal": "60.89",
		"cus_ava_bal": "60.89",
		"cus_total_freeze": "0.00",
		"cus_totfre_count": "0",
		"cus_freeze": "0.00",
		"cus_freeze_count": "0"
	}
}

+ 14 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java

@ -64,6 +64,11 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 * 咨询类型: 1图文 2视频 3图文+视频
	 */
	private Integer consultType;
	
	/**
	 * 门诊记录ID
	 */
	private String outpatientId;
	@Column(name = "saas_id")
@ -137,7 +142,13 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
    public void setConsultType(Integer consultType) {
        this.consultType = consultType;
    }
	
	@Column(name = "outpatient_id")
	public String getOutpatientId() {
		return outpatientId;
	}
	
	public void setOutpatientId(String outpatientId) {
		this.outpatientId = outpatientId;
	}
}

+ 2 - 0
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -28,6 +28,8 @@ public class DateUtil {
    public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    public static final String YYYY_M_D_HH_MM_SS = "yyyy/M/d HH:mm:ss";
    public static final String YYYY_MM_DD_ = "yyyy/MM/dd";
    public static final String YYYY_MM_DD_HH_MM_SS_ = "yyyy/MM/dd HH:mm:ss";
    public static final String YYYYMMddHHmmssSSS  = "yyyyMMddHHmmssSSS";
    public static final String YYYY_MM ="yyyy-MM";

+ 33 - 114
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -4,6 +4,7 @@ package com.yihu.jw.entrance.controller;
import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -87,7 +88,7 @@ public class MqSdkController extends EnvelopRestEndpoint {
                               @RequestParam(value = "startTime", required = false) String startTime,
                               @ApiParam(name = "endTime", value = "结束时间")
                               @RequestParam(value = "endTime", required = false) String endTime) throws Exception {
        JSONArray obj = entranceService.BS30025(patNo,admNo,registerSn, startTime, endTime, demoFlag);
        List<WlyyOutpatientVO> obj = entranceService.BS30025(patNo,admNo,registerSn, startTime, endTime, demoFlag);
        return success(obj);
    }
@ -203,100 +204,6 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return success(obj);
    }
    /**
     * 返回单个对象数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public ObjEnvelop convertObjectEnvelopByString(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONObject jsonObjectMgsInfo=(JSONObject)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                return  ObjEnvelop.getSuccess("获取成功",jsonObjectMgsInfo.get("Msg").toString());
            }else {
                return null;
            }
        }else {
            return ObjEnvelop.getError("获取失败");
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public ListEnvelop convertListEnvelopByString(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                return success(jsonObjectMgsInfo);
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public ListEnvelop convertListEnvelopInBodyRow(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;
                    jsonObjectBody= (JSONObject)jsonObjectBody.get("body");
                  if(null!=jsonObjectBody){
                      jsonArray.add(jsonObjectBody.get("row")) ;
                  }
                }
                return success(jsonArray);
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public ListEnvelop convertListEnvelopInRow(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;
                    if(null!=jsonObjectBody){
                        jsonArray.add(jsonObjectBody.get("row")) ;
                    }
                }
                return success(jsonArray);
            }else {
                return null;
            }
        }else {
            return  null;
        }
    }
    /**
     * 返回对象数组数据解析
@ -332,25 +239,6 @@ public class MqSdkController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 返回对象数组数据解析
     * @param obj
     * @return
     * @throws Exception
     */
    public ObjEnvelop convertListEnvelopInRequest(String obj)throws Exception{
        JSONObject jsonObject=JSONObject.fromObject(obj);
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody = (JSONObject) object;
                    return ObjEnvelop.getSuccess("获取成功", jsonObjectBody.get("resquest"));
                }
            }
        }
        return  null;
    }
    @GetMapping(value = "/MS25002")
    @ApiOperation(value = " 检查检验字典接口 ")
@ -373,6 +261,37 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return "";
    }
    @GetMapping(value = "/yytDown")
    @ApiOperation(value = " 银医通下载 ")
    public ObjEnvelop yytDown(
            @ApiParam(name = "cardNo", value = "卡号", required = true)
            @RequestParam(value = "cardNo") String cardNo) {
        try {
            JSONObject  obj= entranceService.callYYTServerService(cardNo);
            return success(obj);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    @GetMapping(value = "/guahao")
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录 V1.00")
    public ObjEnvelop guahao(@ApiParam(name = "patNo", value = "居民id")
                         @RequestParam(value = "patNo",required = false) String patNo,
                         @ApiParam(name = "dept", value = "挂号科室")
                         @RequestParam(value = "dept",required = false) String dept,
                         @ApiParam(name = "doctor", value = "就诊医生")
                         @RequestParam(value = "doctor",required = false) String doctor) {
        try {
            boolean  obj = entranceService.guahao(patNo,dept,doctor,demoFlag);
            return success(obj);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败:"+e.getMessage());
        }
    }
}