|  | @ -763,6 +763,71 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取his病人信息
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray findHisPatient(String idcard) throws Exception {
 | 
	
		
			
				|  |  |         String sql = "SELECT\n" +
 | 
	
		
			
				|  |  |                 "\tx.brid AS \"brid\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.mzhm AS \"mzhm\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.brxm AS \"brxm\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.sfzh AS \"sfzh\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.brxz AS \"brxz\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.brxb AS \"brxb\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.csny as \"csny\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.jzkh AS \"jzkh\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.jdsj AS \"jdsj\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.sjhm AS \"sjhm\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.fzxmc AS \"fzxmc\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.gzztmc AS \"gzztmc\",\n" +
 | 
	
		
			
				|  |  |                 "\tx.lxdz AS \"lxdz\"\n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "\tV_ZKSG_BRCX x\n" +
 | 
	
		
			
				|  |  |                 "WHERE\n" +
 | 
	
		
			
				|  |  |                 "\tsfzh.sfzh = '"+idcard+"' ";
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("sql",sql);
 | 
	
		
			
				|  |  |         logger.info("idcard:"+sql);
 | 
	
		
			
				|  |  |         HttpResponse response = HttpUtils.doGet(url,params);
 | 
	
		
			
				|  |  |         String content = response.getContent();
 | 
	
		
			
				|  |  |         logger.info("response:"+content);
 | 
	
		
			
				|  |  |         JSONObject rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |         Integer status = rs.getInteger("status");
 | 
	
		
			
				|  |  |         if (status==200){
 | 
	
		
			
				|  |  |             array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return array;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取his就诊卡号
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONArray findHisCard(String idcard) throws Exception {
 | 
	
		
			
				|  |  |         String sql = "select o.pat_no as \"pat_no\",o.card_no as \"card_no\",o.card_stat as \"card_stat\",o.op_date as \"op_date\",o.card_type as \"card_type\",o.card_type_name as \"card_type_name\" from v_zksg_brcx x,V_HLW_CARDINFO o where  o.pat_no = x.mzhm and x.sfzh = '"+idcard+"'";
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("sql",sql);
 | 
	
		
			
				|  |  |         logger.info("idcard:"+sql);
 | 
	
		
			
				|  |  |         HttpResponse response = HttpUtils.doGet(url,params);
 | 
	
		
			
				|  |  |         String content = response.getContent();
 | 
	
		
			
				|  |  |         logger.info("response:"+content);
 | 
	
		
			
				|  |  |         JSONObject rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |         Integer status = rs.getInteger("status");
 | 
	
		
			
				|  |  |         if (status==200){
 | 
	
		
			
				|  |  |             array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return array;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -781,14 +846,14 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |                 wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
 | 
	
		
			
				|  |  |             synPrecriptionHis(prescriptionVO);
 | 
	
		
			
				|  |  |             synPrecriptionHis(prescriptionVO,code);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return wlyyPrescriptionDOs.toString();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
 | 
	
		
			
				|  |  |     public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
 | 
	
		
			
				|  |  |         HlwCf01DO hlwCf01DO = new HlwCf01DO();
 | 
	
		
			
				|  |  |         if (wlyyPrescriptionVO!=null){
 | 
	
		
			
				|  |  |             hlwCf01DO.setSPZT(0);
 | 
	
	
		
			
				|  | @ -796,13 +861,24 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |             hlwCf01DO.setYFSB(3);
 | 
	
		
			
				|  |  |             hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
 | 
	
		
			
				|  |  |             hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
 | 
	
		
			
				|  |  |             hlwCf01DO.setZFPB(1);
 | 
	
		
			
				|  |  |             hlwCf01DO.setZFPB(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setFYBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setPYBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setDJYBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setCFTS(1);
 | 
	
		
			
				|  |  |             hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
 | 
	
		
			
				|  |  |             hlwCf01DO.setYXPB(1);
 | 
	
		
			
				|  |  |             hlwCf01DO.setDYBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setTSCF(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setTYBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setTSLX(6);
 | 
	
		
			
				|  |  |             hlwCf01DO.setCFBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setJZXH(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setYXPB(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setLSCFBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setZJFLAG(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setLSCFBZ(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setZJFLAG(0);
 | 
	
		
			
				|  |  |             hlwCf01DO.setFKZT(1);
 | 
	
		
			
				|  |  |             hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
 | 
	
		
			
				|  |  |             String patient = wlyyPrescriptionVO.getPatientCode();
 | 
	
		
			
				|  |  |             PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
	
	
		
			
				|  | @ -814,6 +890,8 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |             hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
 | 
	
		
			
				|  |  |             hlwCf01DO.setGUID(getCode());
 | 
	
		
			
				|  |  |             hlwCf01DO.setSJLY(1);
 | 
	
		
			
				|  |  |             hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
 | 
	
		
			
				|  |  |            /* hibenateUtils.save(hlwCf01DO);*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String jsonString = JSONObject.toJSONString(hlwCf01DO);
 | 
	
	
		
			
				|  | @ -823,7 +901,21 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |             logger.info("HLW_CF01:"+jsonString);
 | 
	
		
			
				|  |  |             HttpResponse response = HttpUtils.doGet(saveUrl,params);
 | 
	
		
			
				|  |  |             if (response.getStatus()==200){
 | 
	
		
			
				|  |  |                 logger.info("content"+response.getContent());
 | 
	
		
			
				|  |  |                 String content = response.getContent();
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = JSONObject.parseObject(content);
 | 
	
		
			
				|  |  |                 JSONObject object = jsonObject.getJSONObject("obj");
 | 
	
		
			
				|  |  |                 if (object!=null){
 | 
	
		
			
				|  |  |                     String cfsb = object.getString("cfsb");
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
 | 
	
		
			
				|  |  |                     if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
 | 
	
		
			
				|  |  |                         WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setRealOrder(cfsb);
 | 
	
		
			
				|  |  |                         prescriptionDao.save(wlyyPrescriptionDO);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("表HLW_CF01同步成功!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -850,6 +942,9 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |                 hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
 | 
	
		
			
				|  |  |                 hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
 | 
	
		
			
				|  |  |                 hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
 | 
	
		
			
				|  |  |                 hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
 | 
	
		
			
				|  |  |                 hlwCf02DO.setPSPB(0);
 | 
	
		
			
				|  |  |                 hlwCf02DO.setYYTS(1);
 | 
	
		
			
				|  |  |                 /*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
 | 
	
		
			
				|  |  |                 hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
 | 
	
		
			
				|  |  |               /*  hibenateUtils.save(hlwCf02DO);*/
 | 
	
	
		
			
				|  | @ -877,4 +972,10 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     public String getCode() {
 | 
	
		
			
				|  |  |         return UUID.randomUUID().toString().replaceAll("-", "");
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |