| 
															
																@ -1,13 +1,17 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																package com.yihu.jw.hospital.prescription.service.entrance; 
															 | 
															
															 | 
															
																package com.yihu.jw.hospital.prescription.service.entrance; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.fasterxml.jackson.core.type.TypeReference; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.fasterxml.jackson.databind.ObjectMapper; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil; 
															 | 
															
															 | 
															
																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.WlyyPrescriptionDiagnosisVO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.web.ListEnvelop; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.web.ListEnvelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.date.DateUtil; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import io.swagger.annotations.ApiParam; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import net.sf.json.JSONArray; 
															 | 
															
															 | 
															
																import net.sf.json.JSONArray; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
															
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.json.JSONObject; 
															 | 
															
															 | 
															
																import org.json.JSONObject; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -15,6 +19,7 @@ import org.springframework.core.io.ClassPathResource; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.core.io.Resource; 
															 | 
															
															 | 
															
																import org.springframework.core.io.Resource; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.stereotype.Controller; 
															 | 
															
															 | 
															
																import org.springframework.stereotype.Controller; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
															
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.springframework.web.bind.annotation.RequestParam; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.io.BufferedReader; 
															 | 
															
															 | 
															
																import java.io.BufferedReader; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.io.IOException; 
															 | 
															
															 | 
															
																import java.io.IOException; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -193,13 +198,14 @@ public class EntranceService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 门诊处方信息(所有处方)根据处方信息封装到实体中 
															 | 
															
															 | 
															
																     * 门诊处方信息(所有处方)根据处方信息封装到实体中 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param REGISTER_SN 流水号 
															 | 
															
															 | 
															
																     * @param REGISTER_SN 流水号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param realOrder 处方号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param PAT_NO 病人id 
															 | 
															
															 | 
															
																     * @param PAT_NO 病人id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param ADM_NO 就诊唯一号 
															 | 
															
															 | 
															
																     * @param ADM_NO 就诊唯一号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param demoFlag 是否获取demo数据 
															 | 
															
															 | 
															
																     * @param demoFlag 是否获取demo数据 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<WlyyPrescriptionVO>  BS16017ReturnObj(String REGISTER_SN,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public List<WlyyPrescriptionVO>  BS16017ReturnObj(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String fid=BS16017; 
															 | 
															
															 | 
															
																        String fid=BS16017; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String resp = ""; 
															 | 
															
															 | 
															
																        String resp = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (demoFlag) { 
															 | 
															
															 | 
															
																        if (demoFlag) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -215,6 +221,9 @@ public class EntranceService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if (StringUtils.isNotBlank(REGISTER_SN)) { 
															 | 
															
															 | 
															
																            if (StringUtils.isNotBlank(REGISTER_SN)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                sbs.append("<query compy=\"=\" item=\"REGISTER_SN\" splice=\"and\" value=\"'" + REGISTER_SN + "'\"/>"); 
															 | 
															
															 | 
															
																                sbs.append("<query compy=\"=\" item=\"REGISTER_SN\" splice=\"and\" value=\"'" + REGISTER_SN + "'\"/>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (StringUtils.isNotBlank(realOrder)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sbs.append("<query compy=\"=\" item=\"real_order\" splice=\"and\" value=\"'" + realOrder + "'\"/>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if (StringUtils.isNotBlank(PAT_NO)) { 
															 | 
															
															 | 
															
																            if (StringUtils.isNotBlank(PAT_NO)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + PAT_NO + "'\"/>"); 
															 | 
															
															 | 
															
																                sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + PAT_NO + "'\"/>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -544,30 +553,58 @@ public class EntranceService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  线上处方 
															 | 
															
															 | 
															
																     *  线上处方 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  @param card_no 卡号 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  @param doctor 医生工号 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  @param dept 科室编码 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  @param charge_code 号别 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     *  @param win_no 分部号 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @throws Exception 
															 | 
															
															 | 
															
																     * @throws Exception 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public net.sf.json.JSONObject BS10112(String card_no, String doctor, String dept, String charge_code, String win_no, String charge_flag, String quantity, String serial_no, String group_no, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                                          String serial, String icd_code, String diag_two, String diag_three, String diag_four, String diag_five, String dosage, String unit, String usage, String supply_code, String days, String frequency, boolean demoFlag) throws Exception { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public net.sf.json.JSONObject BS10112(String jsonData, boolean demoFlag) throws Exception { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String fid=BS10112; 
															 | 
															
															 | 
															
																        String fid=BS10112; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        ObjectMapper objectMapper = new ObjectMapper(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<WlyyHisPrescriptionVO> patientSubscribeJkedus = objectMapper.readValue(jsonData,  new TypeReference<List<WlyyHisPrescriptionVO>>(){}); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String resp=""; 
															 | 
															
															 | 
															
																        String resp=""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (demoFlag) { 
															 | 
															
															 | 
															
																        if (demoFlag) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            resp = getJosnFileResullt(fid); 
															 | 
															
															 | 
															
																            resp = getJosnFileResullt(fid); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } else { 
															 | 
															
															 | 
															
																        } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //多个request? 诊断2到诊断4 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            StringBuffer sbs = new StringBuffer(); 
															 | 
															
															 | 
															
																            StringBuffer sbs = new StringBuffer(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("<ESBEntry><AccessControl><Fid>BS10112</Fid><UserName>jkzl</UserName><Password>123456</Password></AccessControl>"); 
															 | 
															
															 | 
															
																            sbs.append("<ESBEntry><AccessControl><Fid>BS10112</Fid><UserName>jkzl</UserName><Password>123456</Password></AccessControl>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("<MessageHeader><Fid>BS10112</Fid><MsgDate>2018-10-09 16:52:39</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>"); 
															 | 
															
															 | 
															
																            sbs.append("<MessageHeader><Fid>BS10112</Fid><MsgDate>2018-10-09 16:52:39</MsgDate><SourceSysCode>S60</SourceSysCode><TargetSysCode>S01</TargetSysCode></MessageHeader>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("<MsgInfo><endNum>20000</endNum><Msg><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root>"); 
															 | 
															
															 | 
															
																            sbs.append("<MsgInfo><endNum>20000</endNum><Msg><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("<resquest card_no=\"" + card_no + "\" doctor=\"" + doctor + "\" dept=\"" + dept + "\" charge_code=\"" + charge_code + "\" win_no=\"" + win_no + "\" charge_flag=\"" + charge_flag + "\" "); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("quantity=\"" + quantity + "\"  serial_no=\"" + serial_no + "\"  group_no=\"" + group_no + "\"   serial=\"" + serial + "\"   icd_code=\"" + icd_code/*+"\" dosage=\""+dosage+"\" unit=\""+unit+"\" "*/); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append(/*"usage=\""+usage+"\" supply_code=\""+supply_code+"\" days=\""+days+"\" frequency=\""+frequency+*/"\" days=\"" + days + "\" frequency=\"" + frequency + "\"/>"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            for(WlyyHisPrescriptionVO vo:patientSubscribeJkedus){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //必输字段 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sbs.append("<resquest card_no=\"" + vo.getCardNo() + "\" doctor=\"" + vo.getDoctor() + "\" dept=\"" + vo.getDept() + "\" charge_code=\"" + vo.getChargeCode() + "\" win_no=\"" + vo.getWinNo() + "\" charge_flag=\"" + vo.getChargeFlag() + "\" "); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sbs.append("quantity=\"" + vo.getQuantity() + "\"  serial_no=\"" + vo.getSerialNo() + "\"  group_no=\"" + vo.getGroupNo() + "\"   serial=\"" + vo.getSerial() + "\"   icd_code=\"" + vo.getIcdCode()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //选填字段 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getDiagTwo())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" diag_two=\""+vo.getDiagTwo()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getDiagThree())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" diag_three=\""+vo.getDiagThree()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getDiagFour())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" diag_four=\""+vo.getDiagFour()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (StringUtils.isNotBlank(vo.getDiagFive())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" diag_five=\"" + vo.getDiagFive() + "\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (StringUtils.isNotBlank(vo.getDosage())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" dosage=\"" + vo.getDosage() + "\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (StringUtils.isNotBlank(vo.getUnit())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" unit=\"" + vo.getUnit() + "\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (StringUtils.isNotBlank(vo.getUsage())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" usage=\"" + vo.getUsage() + "\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getSupplyCode())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" supply_code=\""+vo.getSupplyCode()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getDays())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" days=\""+vo.getDays()+"\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(StringUtils.isNotBlank(vo.getFrequency())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    sbs.append("\" frequency=\""+vo.getFrequency()+ "\""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                sbs.append("/>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sbs.append("</root>]]></Msg><startNum>1</startNum></MsgInfo></ESBEntry>"); 
															 | 
															
															 | 
															
																            sbs.append("</root>]]></Msg><startNum>1</startNum></MsgInfo></ESBEntry>"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid); 
															 | 
															
															 | 
															
																            resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            resp = MqSdkUtil.xml2jsonArrayRootRow(resp); 
															 | 
															
															 | 
															
																            resp = MqSdkUtil.xml2jsonArrayRootRow(resp); 
															 |