|  | @ -8,6 +8,7 @@ import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.dict.BaseJobCategoryDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.dict.DictIcd10DO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
	
		
			
				|  | @ -41,8 +42,10 @@ import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.utils.network.HttpResponse;
 | 
	
		
			
				|  |  | import com.yihu.utils.network.HttpUtils;
 | 
	
		
			
				|  |  | import com.yihu.utils.security.MD5;
 | 
	
		
			
				|  |  | import jxl.write.DateTime;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.jsoup.helper.DataUtil;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @ -77,10 +80,14 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private final static String jdbcUrl="http://192.168.20.55:10023/ykyy/jdbcSQLQuery";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private final static String updateJdxx="http://192.168.20.55:10023/ykyy/updateJdxx";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private final static String orgCode ="350211A5004";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private final static String orgName ="厦门大学附属厦门眼科中心";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private final static String saveJdxxUrl="http://192.168.20.55:10023/ykyy/saveJdxx";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DictHospitalDeptDao hospitalDeptDao;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -129,8 +136,6 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DictDoctorDutyDao dictDoctorDutyDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BasePatientMedicareCardDao patientMedicareCardDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyInspectionDao wlyyInspectionDao;
 | 
	
	
		
			
				|  | @ -141,6 +146,8 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     private PrescriptionEmrDao prescriptionEmrDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private FileUploadService fileUploadService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseNatAppointmentDao baseNatAppointmentDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
 | 
	
	
		
			
				|  | @ -1890,6 +1897,266 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void saveKsjc(BaseNatAppointmentDO natAppointmentDO,Boolean demoFlag) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //挂号
 | 
	
		
			
				|  |  |         Map<String,Object> map = findYkDoctor(natAppointmentDO.getHospitalFlag());
 | 
	
		
			
				|  |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(natAppointmentDO.getPatientId());
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",natAppointmentDO.getPatientId(),"1");
 | 
	
		
			
				|  |  |         Integer GHXH = 0;
 | 
	
		
			
				|  |  |         //挂号明细表HLW_GHMX
 | 
	
		
			
				|  |  |         HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
 | 
	
		
			
				|  |  |         hlwGhmxDO.setSBXH(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setGHCS(1);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setGHJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setZLJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setZJFY(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setBLJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setXJJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setZPJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setZHJE(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setHBWC(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setQTYS(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setTHBZ(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setCZPB(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setMZLB(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setYSPB(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setSFFS(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setJZZT(2);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setJZXH(0);
 | 
	
		
			
				|  |  |         hlwGhmxDO.setKSDM(map.get("deptCode").toString());
 | 
	
		
			
				|  |  |         hlwGhmxDO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
 | 
	
		
			
				|  |  |         hlwGhmxDO.setGHSJ(new Date());//挂号时间
 | 
	
		
			
				|  |  |         hlwGhmxDO.setGHLB(1);//挂号类别
 | 
	
		
			
				|  |  |         hlwGhmxDO.setYSDM(map.get("doctorCode").toString());//医生代码
 | 
	
		
			
				|  |  |         hlwGhmxDO.setJZYS(map.get("doctorCode").toString());//接诊医生
 | 
	
		
			
				|  |  |         //病人性质
 | 
	
		
			
				|  |  |         JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
 | 
	
		
			
				|  |  |         if(jsonArray!=null&&jsonArray.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray.getJSONObject(0);
 | 
	
		
			
				|  |  |             hlwGhmxDO.setBRXZ(json.getInteger("brxz"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //获取医生信息
 | 
	
		
			
				|  |  |         hlwGhmxDO.setCZGH(map.get("doctorMappingCode").toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         // 同一个医生同一个病人,一天一条挂号记录。
 | 
	
		
			
				|  |  |         JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |         if(ja!=null&&ja.size()>0){
 | 
	
		
			
				|  |  |             //更新
 | 
	
		
			
				|  |  |             JSONObject json = ja.getJSONObject(0);
 | 
	
		
			
				|  |  |             hlwGhmxDO.setSBXH(json.getInteger("SBXH"));
 | 
	
		
			
				|  |  |             hlwGhmxDO.setGHSJ(DateUtil.strToDate(json.getString("GHSJ")));
 | 
	
		
			
				|  |  |             GHXH = json.getInteger("SBXH");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String jsonString = JSONObject.toJSONString(hlwGhmxDO);
 | 
	
		
			
				|  |  |             Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |             params.put("json",jsonString);
 | 
	
		
			
				|  |  |             params.put("table","HlwGhmxDO");
 | 
	
		
			
				|  |  |             logger.info("HlwGhmxDO:"+jsonString);
 | 
	
		
			
				|  |  |             HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
 | 
	
		
			
				|  |  |             if (response.getStatus()==200){
 | 
	
		
			
				|  |  |                 logger.info("content"+response.getContent());
 | 
	
		
			
				|  |  |                 logger.info("表hlwGhmxDo更新成功!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 logger.info("表hlwGhmxDo更新失败!"+response.getErrorMsg());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             //新增
 | 
	
		
			
				|  |  |             String jsonString = JSONObject.toJSONString(hlwGhmxDO);
 | 
	
		
			
				|  |  |             Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |             params.put("json",jsonString);
 | 
	
		
			
				|  |  |             params.put("table","HlwGhmxDO");
 | 
	
		
			
				|  |  |             logger.info("HlwGhmxDO:"+jsonString);
 | 
	
		
			
				|  |  |             HttpResponse response = HttpUtils.doGet(saveUrl,params);
 | 
	
		
			
				|  |  |             if (response.getStatus()==200){
 | 
	
		
			
				|  |  |                 String content = response.getContent();
 | 
	
		
			
				|  |  |                 logger.info("content"+content);
 | 
	
		
			
				|  |  |                 JSONObject jsonObject = JSONObject.parseObject(content);
 | 
	
		
			
				|  |  |                 JSONObject object = jsonObject.getJSONObject("obj");
 | 
	
		
			
				|  |  |                 if (object!=null){
 | 
	
		
			
				|  |  |                     GHXH = object.getInteger("sbxh");
 | 
	
		
			
				|  |  |                     logger.info("GHXH=========="+GHXH);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("表hlwGhmxDo新增成功!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Integer icd10Flag = 0;
 | 
	
		
			
				|  |  |         //就诊历史表HLWYS_MZ_JZLS
 | 
	
		
			
				|  |  |         HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setJZXH(0);
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setGHXH(GHXH);
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setKSDM(Integer.parseInt(map.get("deptCode").toString()));
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setYSDM(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setKSSJ(DateUtil.getNowDate());
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setJZZT(9);
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setJZLX(3);//就诊类型
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setZDMC("健康查体");
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setMQZD("健康查体");
 | 
	
		
			
				|  |  |         /*if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
 | 
	
		
			
				|  |  |             hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
 | 
	
		
			
				|  |  |         }*/
 | 
	
		
			
				|  |  |         //V_HLW_ICD10.FLAG
 | 
	
		
			
				|  |  |         JSONArray jsonArray2 = findHisIcd10("Z00.001");
 | 
	
		
			
				|  |  |         if(jsonArray2!=null&&jsonArray2.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray2.getJSONObject(0);
 | 
	
		
			
				|  |  |             icd10Flag = json.getInteger("FLAG");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         hlwYsMzJzLsDO.setZYZD(icd10Flag);
 | 
	
		
			
				|  |  |         String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
 | 
	
		
			
				|  |  |         Map<String,Object> params2 = new HashedMap();
 | 
	
		
			
				|  |  |         params2.put("json",jsonString2);
 | 
	
		
			
				|  |  |         params2.put("table","HlwYsMzJzLsDO");
 | 
	
		
			
				|  |  |         logger.info("HlwYsMzJzLsDO:"+jsonString2);
 | 
	
		
			
				|  |  |         HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
 | 
	
		
			
				|  |  |         Integer jzxh = null;
 | 
	
		
			
				|  |  |         if (response2.getStatus()==200) {
 | 
	
		
			
				|  |  |             String content = response2.getContent();
 | 
	
		
			
				|  |  |             logger.info("content" + content);
 | 
	
		
			
				|  |  |             //获取就诊序号,更新处方表数据
 | 
	
		
			
				|  |  |             JSONObject jsonObject = JSONObject.parseObject(content);
 | 
	
		
			
				|  |  |             JSONObject object = jsonObject.getJSONObject("obj");
 | 
	
		
			
				|  |  |             if (object != null) {
 | 
	
		
			
				|  |  |                 jzxh = object.getInteger("jzxh");
 | 
	
		
			
				|  |  |                 logger.info("JZXH==========" + jzxh);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("表hlwYsMzJzLsDO同步成功!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //疾病诊断表HLWYS_MZ_JBZD
 | 
	
		
			
				|  |  |             HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
 | 
	
		
			
				|  |  |             //hlwYsMzJbzdDO.setJLBH(0);
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setYSDM(map.get("doctorCode").toString());
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setICD("Z00.001");
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setMSZD("健康查体");
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setJBBH(icd10Flag);
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setZDLB(11);//诊断类别
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setZDSJ(DateUtil.getNowDate());//诊断时间
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setZFPB(0);//作废标志
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setQZSJ(DateUtil.getNowDate());//确诊时间
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setJBMC("健康查体");//诊断名称
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setZDLX(1);//诊断类型
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setTJBZ(1);//提交标志
 | 
	
		
			
				|  |  |             hlwYsMzJbzdDO.setJZXH(jzxh);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
 | 
	
		
			
				|  |  |             Map<String, Object> params1 = new HashedMap();
 | 
	
		
			
				|  |  |             params1.put("json", jsonString1);
 | 
	
		
			
				|  |  |             params1.put("table", "HlwYsMzJbzdDO");
 | 
	
		
			
				|  |  |             logger.info("HlwYsMzJbzdDO:" + jsonString1);
 | 
	
		
			
				|  |  |             HttpResponse response1 = HttpUtils.doGet(saveUrl, params1);
 | 
	
		
			
				|  |  |             if (response1.getStatus() == 200) {
 | 
	
		
			
				|  |  |                 String content1 = response1.getContent();
 | 
	
		
			
				|  |  |                 logger.info("content" + content1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 logger.info("表hlwYsMzJbzdDO同步成功!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //同步核酸检验
 | 
	
		
			
				|  |  |         List<YkEmrJcsqDO> ykEmrJcsqDOS = new ArrayList<>();
 | 
	
		
			
				|  |  |         YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJzxh(jzxh);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setXmid(Integer.valueOf("12220"));
 | 
	
		
			
				|  |  |         JSONArray jsonArray1 = this.findZlxm(null, "12220");
 | 
	
		
			
				|  |  |         String deptNo = null;
 | 
	
		
			
				|  |  |         if (jsonArray1 != null && jsonArray1.size() > 0) {
 | 
	
		
			
				|  |  |             JSONObject deptobject = jsonArray1.getJSONObject(0);
 | 
	
		
			
				|  |  |             deptNo = deptobject.getString("dept");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setZxks(deptNo == null ? 0 : Integer.parseInt(deptNo));
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJcxm("新冠病毒核酸检测");
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setXmdj(new BigDecimal("80"));
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setSqsl(1);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJclx(1);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setXmdw("人次");
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setKdsj(new Date());
 | 
	
		
			
				|  |  |         Integer brxb = 0;
 | 
	
		
			
				|  |  |         String brxm = "";
 | 
	
		
			
				|  |  |         Date csny =null;
 | 
	
		
			
				|  |  |         Integer brnl =0;
 | 
	
		
			
				|  |  |         String doctorHis="";
 | 
	
		
			
				|  |  |         Integer kdks = 0;
 | 
	
		
			
				|  |  |         Integer brid=0;
 | 
	
		
			
				|  |  |         String mzhm="0";
 | 
	
		
			
				|  |  |         JSONArray jsonArray3 = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
 | 
	
		
			
				|  |  |         Map<String,Object> resultMap = new HashMap();
 | 
	
		
			
				|  |  |         if(jsonArray3!=null&&jsonArray3.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray3.getJSONObject(0);
 | 
	
		
			
				|  |  |             brxb = json.getInteger("brxb");
 | 
	
		
			
				|  |  |             brxm = json.getString("brxm");
 | 
	
		
			
				|  |  |             csny = json.getDate("csny");
 | 
	
		
			
				|  |  |             brnl = this.getBrnl(csny);
 | 
	
		
			
				|  |  |             brid=json.getInteger("brid");
 | 
	
		
			
				|  |  |             mzhm = json.getString("mzhm");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //操作医生信息
 | 
	
		
			
				|  |  |         doctorHis=map.get("doctorCode").toString();
 | 
	
		
			
				|  |  |         kdks = Integer.parseInt(map.get("deptCode").toString());
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setBrid(brid);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJjbz(0);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJczt(1);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setZfbz(0);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setQxbz(0);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setBrxb(brxb);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setBrxm(natAppointmentDO.getName());
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setBrnl(brnl);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setKdys(doctorHis);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setBrks(kdks);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setTjys(doctorHis);
 | 
	
		
			
				|  |  |         ykEmrJcsqDO.setJzhm(mzhm);
 | 
	
		
			
				|  |  |         ykEmrJcsqDOS.add(ykEmrJcsqDO);
 | 
	
		
			
				|  |  |         String jsonString = JSONObject.toJSONString(ykEmrJcsqDOS);
 | 
	
		
			
				|  |  |         Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("json",jsonString);
 | 
	
		
			
				|  |  |         params.put("table","ykEmrJcsqDO");
 | 
	
		
			
				|  |  |         logger.info("ykEmrJcsqDO:"+jsonString);
 | 
	
		
			
				|  |  |         HttpResponse response = HttpUtils.doGet(orderUrl,params);
 | 
	
		
			
				|  |  |         String content = response.getContent();
 | 
	
		
			
				|  |  |         logger.info("response:"+content);
 | 
	
		
			
				|  |  |         JSONObject rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |         Integer status = rs.getInteger("status");
 | 
	
		
			
				|  |  |         JSONArray array= new JSONArray();
 | 
	
		
			
				|  |  |         if (status==200){
 | 
	
		
			
				|  |  |             array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |             JSONObject object = array.getJSONObject(0);
 | 
	
		
			
				|  |  |             String yjxh = object.getString("yjxh");
 | 
	
		
			
				|  |  |             natAppointmentDO.setRealOrder(yjxh);
 | 
	
		
			
				|  |  |             natAppointmentDO.setIsSuccess("1");
 | 
	
		
			
				|  |  |             baseNatAppointmentDao.save(natAppointmentDO);
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> findYkDoctor(String hospitalFlag){
 | 
	
		
			
				|  |  |         String sql = "select t.id as \"id\"," +
 | 
	
		
			
				|  |  |                 "t.doctor_mapping_code as \"doctorMappingCode\"," +
 | 
	
		
			
				|  |  |                 "t.doctor_code as \"doctorCode\"," +
 | 
	
		
			
				|  |  |                 "t.dept_code as \"deptCode\"," +
 | 
	
		
			
				|  |  |                 "t.start_time as \"startTime\"," +
 | 
	
		
			
				|  |  |                 "t.end_time as \"endTime\"," +
 | 
	
		
			
				|  |  |                 "t.doctor_name as \"doctorName\"," +
 | 
	
		
			
				|  |  |                 "t.dept_name  as \"deptName\" from base_doctor_time_mapping t where 1=1 ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(hospitalFlag)){
 | 
	
		
			
				|  |  |             sql+=" and t.hospital_flag = '"+hospitalFlag+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  |         if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             return list.get(0);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 诊断
 | 
	
		
			
				|  |  |      * @param wlyyPrescriptionVO
 | 
	
	
		
			
				|  | @ -2763,6 +3030,74 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject selectByAddress(String cardNo) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String address = null;
 | 
	
		
			
				|  |  |         String zydm = null;
 | 
	
		
			
				|  |  |         String jtdh = null;
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         String sql = "SELECT brid as \"brid\",hkdz as \"hkdz\",zydm as \"zydm\",jtdh as \"jtdh\" from portal_his.V_ZKSG_BRCX@xec_link where jzkh = '"+cardNo+"'";
 | 
	
		
			
				|  |  |         Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("sql",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");
 | 
	
		
			
				|  |  |             if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                 JSONObject object = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                 address=object.getString("hkdz");
 | 
	
		
			
				|  |  |                 zydm = object.getString("zydm");
 | 
	
		
			
				|  |  |                 jtdh = object.getString("jtdh");
 | 
	
		
			
				|  |  |                 jsonObject.put("address",address);
 | 
	
		
			
				|  |  |                 jsonObject.put("zydm",zydm);
 | 
	
		
			
				|  |  |                 jsonObject.put("jtdh",jtdh);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return  jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 通过卡号更新患者信息
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void updatePatientJd(String patient,String address,String phone,Float zy, boolean demoFlag) throws Exception {
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
	
		
			
				|  |  |         JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
 | 
	
		
			
				|  |  |         if(jsonArray!=null&&jsonArray.size()>0){
 | 
	
		
			
				|  |  |             //获取居民信息
 | 
	
		
			
				|  |  |             JSONObject json = jsonArray.getJSONObject(0);
 | 
	
		
			
				|  |  |             String brid = json.getString("brid");
 | 
	
		
			
				|  |  |             Float id = Float.parseFloat(brid);
 | 
	
		
			
				|  |  |             Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |             params.put("brid",id);
 | 
	
		
			
				|  |  |             params.put("sfzh",basePatientDO.getIdcard());
 | 
	
		
			
				|  |  |             params.put("lxdh",phone);
 | 
	
		
			
				|  |  |             params.put("lxdz",address);
 | 
	
		
			
				|  |  |             params.put("zy",zy);
 | 
	
		
			
				|  |  |             HttpResponse response = HttpUtils.doGet(updateJdxx,params);
 | 
	
		
			
				|  |  |             logger.info("更新患者信息"+response);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String saveJdxx(String brxm,String csny,Float brxb,String czgh,String sfzh,Float sjhm,String ybkh,String lxdz,Float zy){
 | 
	
		
			
				|  |  |         return  hibenateUtils.saveJdxx(brxm,DateUtil.strToDateShort(csny),brxb,czgh,sfzh,sjhm,ybkh,lxdz,zy);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String updateJdxx(Float brid,String sfzh,String lxdz,Float zy,String lxdh){
 | 
	
		
			
				|  |  |         return  hibenateUtils.updateJdxx(brid,sfzh,lxdz,zy,lxdh);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String findInfoBysql(String sql) throws Exception {
 | 
	
		
			
				|  |  |         Map<String,Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("sql",sql);
 | 
	
	
		
			
				|  | @ -2771,4 +3106,84 @@ public class YkyyEntranceService {
 | 
	
		
			
				|  |  |         String content = response.getContent();
 | 
	
		
			
				|  |  |         return content;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //判断居民是否建过档,没有就建档
 | 
	
		
			
				|  |  |     public JSONObject patientJDKH(String patientId, String idcard, String name,String phoneNum, String medicare) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject res = new JSONObject();
 | 
	
		
			
				|  |  |         //查询是否建档
 | 
	
		
			
				|  |  |         String brid = "";
 | 
	
		
			
				|  |  |         String bridSql = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where jzkh = '" + medicare + "' ";
 | 
	
		
			
				|  |  |         Map<String, Object> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("sql", bridSql);
 | 
	
		
			
				|  |  |         logger.info("bridSql:" + bridSql);
 | 
	
		
			
				|  |  |         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) {
 | 
	
		
			
				|  |  |             JSONArray array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |             int size = array.size();
 | 
	
		
			
				|  |  |             if (size == 1) {
 | 
	
		
			
				|  |  |                 brid = ((JSONObject) array.get(0)).getString("BRID");
 | 
	
		
			
				|  |  |             } else if (size > 1) {
 | 
	
		
			
				|  |  |                 res.put("status", -1);
 | 
	
		
			
				|  |  |                 res.put("message", "该居民存在多条建档信息!");
 | 
	
		
			
				|  |  |                 return res;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //先通过身份证查询是否有这个病人id 如果有直接返回 如果没有则新建
 | 
	
		
			
				|  |  |         if (StringUtil.isBlank(brid)) {
 | 
	
		
			
				|  |  |             Map<String, Object> params1 = new HashedMap();
 | 
	
		
			
				|  |  |             params1.put("brxm", name);
 | 
	
		
			
				|  |  |             params1.put("csny", IdCardUtil.getBirthdayForIdcardStr(idcard));
 | 
	
		
			
				|  |  |             params1.put("brxb", IdCardUtil.getSexForIdcard_new(idcard));
 | 
	
		
			
				|  |  |             params1.put("czgh", "1996");
 | 
	
		
			
				|  |  |             params1.put("sfzh", idcard);
 | 
	
		
			
				|  |  |             params1.put("sjhm", phoneNum);
 | 
	
		
			
				|  |  |             params1.put("ybkh", medicare);
 | 
	
		
			
				|  |  |             params1.put("lxdz", 0);
 | 
	
		
			
				|  |  |             params1.put("zy", 0);
 | 
	
		
			
				|  |  |             HttpResponse response1 = HttpUtils.doGet(saveJdxxUrl, params1);
 | 
	
		
			
				|  |  |             String content1 = response1.getContent();
 | 
	
		
			
				|  |  |             logger.info("params1:" + params1);
 | 
	
		
			
				|  |  |             logger.info("response1:" + content1);
 | 
	
		
			
				|  |  |             JSONObject rs1 = JSON.parseObject(content1);
 | 
	
		
			
				|  |  |             if (rs1.getInteger("status") != 200) {
 | 
	
		
			
				|  |  |                 res.put("status", -1);
 | 
	
		
			
				|  |  |                 res.put("message", "操作失败,失败原因:" + rs1.getString("message"));
 | 
	
		
			
				|  |  |                 return res;
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 if (rs1.get("message")!=null){
 | 
	
		
			
				|  |  |                     if (rs1.getString("message").contains("已经建过档案")){
 | 
	
		
			
				|  |  |                         res.put("status", 200);
 | 
	
		
			
				|  |  |                         res.put("message",rs1.getString("message"));
 | 
	
		
			
				|  |  |                         return res;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //获取病人id
 | 
	
		
			
				|  |  |                 response = HttpUtils.doGet(url, params);
 | 
	
		
			
				|  |  |                 content = response.getContent();
 | 
	
		
			
				|  |  |                 rs = JSON.parseObject(content);
 | 
	
		
			
				|  |  |                 status = rs.getInteger("status");
 | 
	
		
			
				|  |  |                 if (status == 200) {
 | 
	
		
			
				|  |  |                     res.put("status", 200);
 | 
	
		
			
				|  |  |                     /*JSONArray array = rs.getJSONArray("detailModelList");
 | 
	
		
			
				|  |  |                     int size = array.size();
 | 
	
		
			
				|  |  |                     if(size == 1){
 | 
	
		
			
				|  |  |                         logger.info("array:" + array.toString());
 | 
	
		
			
				|  |  |                         brid = ((JSONObject)array.get(0)).getString("brid");
 | 
	
		
			
				|  |  |                         res.put("status", 200);
 | 
	
		
			
				|  |  |                         res.put("message", brid);
 | 
	
		
			
				|  |  |                         logger.info("brid:" + brid);
 | 
	
		
			
				|  |  |                     }else if (size > 1){
 | 
	
		
			
				|  |  |                         res.put("status", -1);
 | 
	
		
			
				|  |  |                         res.put("message", "该居民存在多条建档信息!");
 | 
	
		
			
				|  |  |                         return res;
 | 
	
		
			
				|  |  |                     }*/
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return res;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |