|  | @ -3,6 +3,7 @@ package com.yihu.jw.internet.service;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.internet.dao.HospitalImgDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.internet.dao.IntUpErrorLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.internet.dao.InternetUpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.internet.dao.MedicalSkillOrdersDao;
 | 
	
	
		
			
				|  | @ -12,6 +13,7 @@ import com.yihu.jw.internet.wsapi.Wsapi;
 | 
	
		
			
				|  |  | import com.yihu.jw.internet.wsapi.WsapiProxy;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.ImageConvertUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.JSONUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.encode.AESUtils;
 | 
	
		
			
				|  |  | import com.yihu.mysql.query.BaseJpaService;
 | 
	
	
		
			
				|  | @ -38,13 +40,15 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private MedicalSkillOrdersDao medicalSkillOrdersDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HospitalImgDao hospitalImgDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     static String userName = "xmzsyy";
 | 
	
		
			
				|  |  |     static String psw = "7j7s9e";
 | 
	
		
			
				|  |  |     static String appId = "ws007";
 | 
	
		
			
				|  |  |     static String AesEncodeKey = "98sfkf53sf19609j";
 | 
	
		
			
				|  |  |     //static String urlString = "http://10.120.102.202:18081/micc/wsapi/1.0?wsdl";  // 正式线路径
 | 
	
		
			
				|  |  |     static String urlString = "http://fjhlw.bsoft.com.cn:18081/micc/wsapi/1.0?wsdl";   // 测试线路径
 | 
	
		
			
				|  |  |     static String urlString = "http://10.120.102.202:18081/micc/wsapi/1.0?wsdl";  // 正式线路径
 | 
	
		
			
				|  |  |     //static String urlString = "http://fjhlw.bsoft.com.cn:18081/micc/wsapi/1.0?wsdl";   // 测试线路径
 | 
	
		
			
				|  |  |     static String method = "execute";
 | 
	
		
			
				|  |  |     static String token = "";
 | 
	
		
			
				|  |  |     static String orgCode = "123502004266006872";
 | 
	
	
		
			
				|  | @ -68,6 +72,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |         String deResult = AESUtils.decrypt(result, AesEncodeKey);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info(JSONUtils.toString(deResult));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return deResult;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -90,7 +95,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |         if("200".equals(resJson.get("msg").toString())) {
 | 
	
		
			
				|  |  |             token = resJson.get("token").toString();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("upNsUserToken : "+token);
 | 
	
		
			
				|  |  |         return token;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -114,11 +119,11 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |         jb.put("hospital_address", "厦门市思明区湖滨南路201-209号");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         jb.put("hospital_phone", "0592-2292201");
 | 
	
		
			
				|  |  |         jb.put("hospital_img","");
 | 
	
		
			
				|  |  |         jb.put("bus_lic", "");
 | 
	
		
			
				|  |  |         jb.put("corp_idcord_head","");
 | 
	
		
			
				|  |  |         jb.put("corp_idcord_tail", "");
 | 
	
		
			
				|  |  |         jb.put("pra_lic", "");
 | 
	
		
			
				|  |  |         jb.put("hospital_img",hospitalImgDao.findOne("hsimg").getImg());
 | 
	
		
			
				|  |  |         jb.put("bus_lic", hospitalImgDao.findOne("zyxkz").getImg());
 | 
	
		
			
				|  |  |         jb.put("corp_idcord_head",hospitalImgDao.findOne("idcardA").getImg());
 | 
	
		
			
				|  |  |         jb.put("corp_idcord_tail", hospitalImgDao.findOne("idcardB").getImg());
 | 
	
		
			
				|  |  |         jb.put("pra_lic", hospitalImgDao.findOne("zyxkz").getImg());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         jb.put("net_service", "1,3,4,5,7,9,10");
 | 
	
		
			
				|  |  |         jb.put("net_service_ot", "");
 | 
	
	
		
			
				|  | @ -258,11 +263,13 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //  因为要上传的是医师信息,所以针对到注册用户且无部门信息的用户数据不上传
 | 
	
		
			
				|  |  |         String sql = "select a.id,a.name,a.idcard,a.sex,a.birthday, a.cert_no, a.prac_no\n" +
 | 
	
		
			
				|  |  |                 "      ,a.mobile,b.dept_code,b.dept_name,a.job_title_code\n" +
 | 
	
		
			
				|  |  |                 "  from base_doctor a\n" +
 | 
	
		
			
				|  |  |                 "      ,base_doctor_hospital b\n" +
 | 
	
		
			
				|  |  |                 " where a.id = b.doctor_code\n"  +
 | 
	
		
			
				|  |  |                 "   and b.dept_code != '' \n" +
 | 
	
		
			
				|  |  |                 "      ,a.mobile,b.dept_code,b.dept_name,a.job_title_code,i.fzrq,i.zyz,i.zgz,i.cert_no,i.prac_no \n" +
 | 
	
		
			
				|  |  |                 "  from base_doctor a " +
 | 
	
		
			
				|  |  |                 "      ,base_doctor_hospital b" +
 | 
	
		
			
				|  |  |                 "      ,base_doctor_img i " +
 | 
	
		
			
				|  |  |                 " where a.id = b.doctor_code\n" +
 | 
	
		
			
				|  |  |                 "   and i.doctor = a.id " +
 | 
	
		
			
				|  |  |                 "   and b.dept_code != '' " +
 | 
	
		
			
				|  |  |                 "   and a.job_title_code  not in('4107','054','1313','1413','1415','018','1412','4105','1212','1312','4103','1315','1217','1215','3301','005',\n" +
 | 
	
		
			
				|  |  |                 "'1213','3501','017','020','058','002','1417','1214','1317','4101','4106') \n" ;
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(startDate)){
 | 
	
	
		
			
				|  | @ -301,7 +308,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                 jb.put("belong_dept",info.get("dept_code") == null ? dept[0].toString():info.get("dept_code"));
 | 
	
		
			
				|  |  |                 jb.put("belong_dept_name", info.get("dept_name") == null ? dept[1].toString():info.get("dept_name"));
 | 
	
		
			
				|  |  |                 jb.put("doo_tel", info.get("mobile")== null ? "":info.get("mobile"));
 | 
	
		
			
				|  |  |                 jb.put("title_rec_date", "1900-01-01");
 | 
	
		
			
				|  |  |                 jb.put("title_rec_date", info.get("fzrq"));
 | 
	
		
			
				|  |  |                 jb.put("prac_type", "1");   // 因为上传的是医师的信息,所以该字段全部默认设置为 1 医师
 | 
	
		
			
				|  |  |                 jb.put("title_code", dutyInfo[0].toString());  // 需要与监管平台的字典进行映射
 | 
	
		
			
				|  |  |                 jb.put("first_compeny_code", orgCode);
 | 
	
	
		
			
				|  | @ -311,15 +318,17 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                 jb.put("net_service", "1,3,4,5,7,9,10");
 | 
	
		
			
				|  |  |                 jb.put("cert_no",  info.get("cert_no")== null ? "0":info.get("cert_no"));
 | 
	
		
			
				|  |  |                 jb.put("prac_no",  info.get("prac_no")== null ? "0":info.get("prac_no"));
 | 
	
		
			
				|  |  |                 jb.put("doc_cert", "");
 | 
	
		
			
				|  |  |                 jb.put("cert_doc_prac", "");
 | 
	
		
			
				|  |  |                 //资质证书
 | 
	
		
			
				|  |  |                 jb.put("doc_cert",info.get("zgz"));
 | 
	
		
			
				|  |  |                 //执业证书
 | 
	
		
			
				|  |  |                 jb.put("cert_doc_prac", info.get("zyz"));
 | 
	
		
			
				|  |  |                 jb.put("txt_introduction", "");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 errorFlag = true;
 | 
	
		
			
				|  |  |                 saveErrorLog(upid,"3",info.get("id").toString(),"数据格式错误",1);
 | 
	
		
			
				|  |  |                 error++;
 | 
	
		
			
				|  |  |                 logger.error(e.toString());
 | 
	
		
			
				|  |  | //                logger.error(e.toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(!errorFlag){
 | 
	
		
			
				|  |  |                 //上传监管平台
 | 
	
	
		
			
				|  | @ -358,7 +367,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |         if("200".equals(msg)){
 | 
	
		
			
				|  |  |             JSONArray reqContent = rs.getJSONArray("reqContent");
 | 
	
		
			
				|  |  |             JSONObject req = (JSONObject)reqContent.get(0);
 | 
	
		
			
				|  |  |             return req.getString("id");
 | 
	
		
			
				|  |  |             return req.getString("miccId");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return "";
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -502,7 +511,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                     jb.put("app_class_code", ins.get("code"));
 | 
	
		
			
				|  |  |                     jb.put("id_doctor", docInterId);
 | 
	
		
			
				|  |  |                     jb.put("fg_handle", "1");
 | 
	
		
			
				|  |  |                     jb.put("handle_time", DateUtil.dateToStr((Date)ins.get("create_time"),"YYYY-MM-DD HH:mm:SS"));
 | 
	
		
			
				|  |  |                     jb.put("handle_time", DateUtil.dateToStr((Date)ins.get("create_time"),"yyyy-MM-dd HH:mm:ss"));
 | 
	
		
			
				|  |  |                     jb.put("pt_name",ins.get("name").toString());
 | 
	
		
			
				|  |  |                     String sex = IdCardUtil.getSexForIdcard_new(ins.get("idcard").toString());
 | 
	
		
			
				|  |  |                     jb.put("ge_code", sex=="3"?"9":sex);
 | 
	
	
		
			
				|  | @ -591,14 +600,14 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                     interId = achNsDoctorRecord(idCard);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String[] dept = depToSubject(info.get("dept_code").toString());
 | 
	
		
			
				|  |  | //                String[] dept = depToSubject(info.get("dept_code").toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 jb.put("id",orgCode + (String)info.get("id"));
 | 
	
		
			
				|  |  |                 jb.put("id_doctor",interId == null ? "0":interId);
 | 
	
		
			
				|  |  |                 jb.put("organ_code",orgCode);
 | 
	
		
			
				|  |  |                 jb.put("organ_name", orgName);
 | 
	
		
			
				|  |  |                 jb.put("net_service", dept[0].toString());
 | 
	
		
			
				|  |  |                 jb.put("net_service_name",dept[1].toString());
 | 
	
		
			
				|  |  |                 jb.put("net_service", "4");
 | 
	
		
			
				|  |  |                 jb.put("net_service_name","在线复诊");
 | 
	
		
			
				|  |  |                 jb.put("val_score",info.get("score") == null ? "0": info.get("score"));
 | 
	
		
			
				|  |  |                 jb.put("grader",info.get("patient_name") == null ? "0": info.get("patient_name"));
 | 
	
		
			
				|  |  |                 jb.put("dt_grade",DateUtil.dateToStrLong((Date)info.get("create_time")));
 | 
	
	
		
			
				|  | @ -778,6 +787,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                 String[] dept = depToSubject(info.get("dept").toString());
 | 
	
		
			
				|  |  |                 // 获取监管平台唯一标识
 | 
	
		
			
				|  |  |                 String visitDocCode = achNsDoctorRecord((String)info.get("docIdCard"));
 | 
	
		
			
				|  |  | //                String visitDocCode = achNsDoctorRecord("350102198005012428");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 jb.put("id_online_med", orgCode + info.get("register_no"));
 | 
	
		
			
				|  |  |                 jb.put("net_service_code", "4");
 | 
	
	
		
			
				|  | @ -835,7 +845,6 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |                 dataError++;
 | 
	
		
			
				|  |  |                 logger.error(e.toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String jbstr = jb.toJSONString();
 | 
	
		
			
				|  |  |             if(!errorFlag){
 | 
	
		
			
				|  |  |                 JSONArray jsonArray = new JSONArray();
 | 
	
		
			
				|  |  |                 jsonArray.add(jb);
 | 
	
	
		
			
				|  | @ -871,11 +880,12 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "select a.id,a.real_order,a.patient_code,a.outpatient_id,a.patient_name\n" +
 | 
	
		
			
				|  |  |                 "      ,b.sex,b.birthday,b.idcard,b.mobile,b.city_code,a.hospital\n" +
 | 
	
		
			
				|  |  |                 "      ,a.hospital_name,a.dept,a.dept_name,a.doctor,a.doctor_name,a.his_register_fee,c.idcard as docIdcard\n" +
 | 
	
		
			
				|  |  |                 "      ,a.hospital_name,p.dept,p.dept_name,a.doctor,a.doctor_name,a.his_register_fee,c.idcard as docIdcard\n" +
 | 
	
		
			
				|  |  |                 "  from  wlyy_prescription a\n" +
 | 
	
		
			
				|  |  |                 "         left JOIN base_patient b on a.patient_code = b.id\n" +
 | 
	
		
			
				|  |  |                 "         left JOIN base_doctor c on a.doctor = c.id\n" +
 | 
	
		
			
				|  |  |                 " where  c.idcard is not null  and a.real_order is not null ";
 | 
	
		
			
				|  |  |                 "         JOIN base_patient b on a.patient_code = b.id\n" +
 | 
	
		
			
				|  |  |                 "         JOIN base_doctor c on a.doctor = c.id\n" +
 | 
	
		
			
				|  |  |                 "         JOIN wlyy_outpatient p on p.id = a.outpatient_id\n " +
 | 
	
		
			
				|  |  |                 "  where  c.idcard is not null  and a.real_order is not null ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(startDate)){
 | 
	
		
			
				|  |  |             sql =  sql + "  and a.create_time >=  '" + startDate + "' ";
 | 
	
	
		
			
				|  | @ -895,9 +905,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |             LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
 | 
	
		
			
				|  |  |             JSONObject jb = new JSONObject();
 | 
	
		
			
				|  |  |             Boolean errorFlag = false;
 | 
	
		
			
				|  |  |             //基于科室转换成国家诊疗科目代码
 | 
	
		
			
				|  |  |             String[] dept = depToSubject(info.get("dept_code").toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 //基于科室转换成国家诊疗科目代码
 | 
	
		
			
				|  |  |                 String[] dept = depToSubject(info.get("dept").toString());
 | 
	
		
			
				|  |  |                 // 获取监管平台唯一标识
 | 
	
		
			
				|  |  |                 String visitDocCode = achNsDoctorRecord(info.get("docIdcard").toString());
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1480,5 +1491,4 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return  res;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |