| 
					
				 | 
			
			
				@ -3,26 +3,25 @@ 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.entity.base.message.BaseMessageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.dao.IntUpErrorLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.dao.InternetUpLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.dao.MedicalSkillOrdersDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.entity.InternetUpErrorLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.entity.MedicalSkillOrdersDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.entity.InternetUpLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.wsapi.Wsapi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.internet.wsapi.WsapiProxy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.message.dao.MessageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.JSONUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.encode.AESUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.LinkedCaseInsensitiveMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Calendar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -34,6 +33,8 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private InternetUpErrorLogService internetUpErrorLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private InternetUpLogDao internetUpLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private MedicalSkillOrdersDao medicalSkillOrdersDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -245,13 +246,14 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 3 医师基本信息	micc.upNsDoctorRecord   --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsDoctorRecord(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsDoctorRecord(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upNsDoctorRecord"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //  因为要上传的是医师信息,所以针对到注册用户且无部门信息的用户数据不上传 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -263,12 +265,15 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   and b.dept_code != '' \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   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(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and a.update_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.update_time < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -277,50 +282,62 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<list.size(); i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap)list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 中山医院 监管平台  职务字典强转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dutyInfo = classToduty(info.get("job_title_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("organ_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("organ_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("doc_name", info.get("name")== null ? "0":info.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("docimg", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_card", info.get("idcard")== null ? "0":info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("sex", info.get("sex")== null ? "0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrLong((Date)info.get("birthday"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("subject", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("subject_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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("prac_type", "1");   // 因为上传的是医师的信息,所以该字段全部默认设置为 1 医师 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("title_code", dutyInfo[0].toString());  // 需要与监管平台的字典进行映射 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("first_compeny_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("first_compeny_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("secd_compeny_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("secd_compeny_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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("txt_introduction", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token, api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("3",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 中山医院 监管平台  职务字典强转 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dutyInfo = classToduty(info.get("job_title_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("organ_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("organ_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("doc_name", info.get("name")== null ? "0":info.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("docimg", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_card", info.get("idcard")== null ? "0":info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("sex", info.get("sex")== null ? "0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrLong((Date)info.get("birthday"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("subject", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("subject_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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("prac_type", "1");   // 因为上传的是医师的信息,所以该字段全部默认设置为 1 医师 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("title_code", dutyInfo[0].toString());  // 需要与监管平台的字典进行映射 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("first_compeny_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("first_compeny_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("secd_compeny_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("secd_compeny_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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("txt_introduction", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"3",info.get("id").toString(),"数据格式错误",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //上传监管平台 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token, api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"3",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"3",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -341,16 +358,18 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 5 网上预约挂号	micc.upAppointmentOnline  --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upAppointmentOnline(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upAppointmentOnline(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upAppointmentOnline"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT p.register_no, p.status, p.dept, p.dept_name,patient.name as paName,d.name as docName\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT p.id,p.register_no, p.status, p.dept, p.dept_name,patient.name as paName,d.name as docName\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     , patient.sex, patient.idcard, patient.mobile, dic.req_fee,reg.date\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM wlyy_outpatient p\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLeft JOIN wlyy_patient_register reg on reg.register_no = p.register_no\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -359,65 +378,80 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLeft JOIN base_patient patient on patient.id = p.patient\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE dic.dept_type_code = p.win_no\n" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and reg.date >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and reg.date < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and  p.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        total = list.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i< total; i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap)list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(info.get("dept").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id", orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_org", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_time", info.get("date") == null?"1900-01-01":info.get("date")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("fg_visit",  fgConvent(info.get("status") == null?"-1":info.get("status").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_dep_code",  info.get("dept") == null?"0":info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_dep_name",  info.get("dept_name") == null?"0":info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_subject_code",  dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_subject_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("reg_price",  info.get("req_fee") == null?"0":info.get("req_fee")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_name", info.get("name") == null?"0":info.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ge_code",   info.get("sex") == null?"0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_age", IdCardUtil.getAgeForIdcard(info.get("idcard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_no",  info.get("idcard") == null?"0":info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_tel",  info.get("mobile") == null?"0":info.get("mobile")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("crt_date",DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"5",info.get("id").toString(),res,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dept = depToSubject(info.get("dept").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id", orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_org", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_time", info.get("date") == null?"1900-01-01":info.get("date")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("fg_visit",  fgConvent(info.get("status") == null?"-1":info.get("status").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_dep_code",  info.get("dept") == null?"0":info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_dep_name",  info.get("dept_name") == null?"0":info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_subject_code",  dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_subject_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("reg_price",  info.get("req_fee") == null?"0":info.get("req_fee")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_name", info.get("name") == null?"0":info.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ge_code",   info.get("sex") == null?"0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_age", IdNOToAge(info.get("idcard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_no",  info.get("idcard") == null?"0":info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_tel",  info.get("mobile") == null?"0":info.get("mobile")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("crt_date",DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("5",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"5",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"5",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 6 在线医技预约 	micc.upMedicalOnline --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upMedicalOnline(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upMedicalOnline(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upMedicalOnline"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " i.id, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -435,62 +469,77 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "JOIN base_patient p ON p.id = o.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " i.create_time >='"+startDate+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and i.create_time <='"+endDate+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and i.create_time <='"+endDate+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and i.dept is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and i.id = '"+keyId+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<MedicalSkillOrdersDO> medicalSkillOrdersDOs= medicalSkillOrdersDao.findMedicalSkillOrdersByAppTime(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list != null && list.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            total = list.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String,Object> ins :list ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(ins.get("dept").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String docInterId = achNsDoctorRecord(ins.get("doctor").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id",orgCode + ins.get("id").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_org", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("app_time",DateUtil.dateToStr(new Date((Long)ins.get("register_date")),"YYYY-MM-DD HH:mm:SS")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("app_dep_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("app_class_code", ins.get("code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_doctor", docInterId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("fg_handle", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("handle_time", DateUtil.dateToStr(new Date((Long)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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_no", ins.get("idcard").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_tel", ins.get("mobile").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("crt_date",DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String[] dept = depToSubject(ins.get("dept").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String docInterId = achNsDoctorRecord(ins.get("doctor").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("id",orgCode + ins.get("id").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("cd_org", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("app_time",DateUtil.dateToStr(new Date((Long)ins.get("register_date")),"YYYY-MM-DD HH:mm:SS")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("app_dep_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("app_class_code", ins.get("code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("id_doctor", docInterId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("fg_handle", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("handle_time", DateUtil.dateToStr(new Date((Long)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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("id_no", ins.get("idcard").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("pt_tel", ins.get("mobile").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jb.put("crt_date",DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"6",ins.get("id ").toString(),res,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog("6",ins.get("id ").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        saveErrorLog(upid,"6",ins.get("id ").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"6",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 7 医生评价信息	micc.upNsDoctorScore  --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsDoctorScore(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsDoctorScore(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upNsDoctorScore"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -505,12 +554,15 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   and c.id = a.doctor" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   and c.id = d.doctor_code"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and a.create_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.create_time < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -518,53 +570,66 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String interId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String idCard = info.get("docIdCard") == null ? "0":info.get("docIdCard").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if( info.get("docIdCard") == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                interId = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                interId = achNsDoctorRecord(idCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String interId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String idCard = info.get("docIdCard") == null ? "0":info.get("docIdCard").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if( info.get("docIdCard") == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    interId = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    interId = achNsDoctorRecord(idCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id",orgCode + 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("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",info.get("create_time") == null ? "1900-01-01": DateUtil.dateToStrLong((Date)info.get("create_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("grade_content", info.get("content") == null ? "0": info.get("content")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("crt_date", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("7",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id",orgCode + 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("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",info.get("create_time") == null ? "1900-01-01": DateUtil.dateToStrLong((Date)info.get("create_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("grade_content", info.get("content") == null ? "0": info.get("content")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("crt_date", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"7",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"7",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"7",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 8 网络咨询服务信息	micc.upNsOnlineAsk  --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsOnlineAsk(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsOnlineAsk(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upNsOnlineAsk"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select a.id,a.type,c.name as docName,c.idcard as docIdCard,c.id as docId\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "      ,b.patient,b.name as patientName,b.birthday,a.czrq,a.end_time\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -576,12 +641,16 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "        LEFT JOIN base_doctor_hospital e on e.doctor_code = b.doctor\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where a.id = b.consult "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and a.czrq >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.czrq < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -589,86 +658,102 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<total; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //基于科室转换成国家诊疗科目代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String visitDocCode = achNsDoctorRecord(info.get("docId").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_online_ask", info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("net_service_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_class_code", "1"/*info.get("type")*/); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_pop_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_name",orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_name",  info.get("docName")== null? "0":info.get("docName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_id_no",  info.get("docIdCard")== null? "0":info.get("docIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_code",  visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_dept_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_dept_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_no", info.get("patientName")== null? "0":info.get("patientName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_age", IdCardUtil.getAgeForIdcard(info.get("patIdCard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cost_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_birthdate", info.get("birthday") == null? "":info.get("birthday").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ge_code", info.get("sex")== null? "0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_tel",info.get("phone") == null ? "0":info.get("phone")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_no", info.get("patIdCard")== null? "0":info.get("patIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_district",info.get("city_code") == null?"":info.get("city_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("apply_time", info.get("czrq")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("czrq"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_time", info.get("czrq")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("czrq"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_finish_time", info.get("end_time")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("end_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("complaint_content", info.get("symptoms")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("proc_file", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("price", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("fg_reply", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("crt_time", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"8",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //基于科室转换成国家诊疗科目代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String visitDocCode = achNsDoctorRecord(info.get("docId").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_online_ask", info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("net_service_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_class_code", "1"/*info.get("type")*/); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_pop_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_name",orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_orgSub", orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_area", orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_name",  info.get("docName")== null? "0":info.get("docName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_id_no",  info.get("docIdCard")== null? "0":info.get("docIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_code",  visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_dept_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_dept_name", dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_no", info.get("patientName")== null? "0":info.get("patientName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_age", IdNOToAge(info.get("patIdCard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cost_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_birthdate", info.get("birthday") == null? "":info.get("birthday").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ge_code", info.get("sex")== null? "0":info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_tel",info.get("phone") == null ? "0":info.get("phone")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_no", info.get("patIdCard")== null? "0":info.get("patIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_district",info.get("city_code") == null?"":info.get("city_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("apply_time", info.get("czrq")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("czrq"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_time", info.get("czrq")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("czrq"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_finish_time", info.get("end_time")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("end_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("complaint_content", info.get("symptoms")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("proc_file", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("price", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("fg_reply", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("crt_time", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("8",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"8",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"8",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 9 网络诊疗服务信息 	micc.upNsOnlineMed  --- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsOnlineMed(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upNsOnlineMed(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upNsOnlineMed"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select a.id,a.register_no, a.type, b.id as docId, a.doctor_name, b.idcard as docIdCard\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     , a.dept, a.dept_name, c.name, c.idcard as paId, c.sex,c.mobile,a.create_time,b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     , a.dept, a.dept_name, c.name as paName, c.idcard as paId, c.sex,c.mobile,a.create_time,b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     ,a.register_date, a.end_time,a.icd10,a.icd10_name,a.origin_adm_no, a.description ,d.req_fee\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  from wlyy_outpatient a \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "         left join base_doctor b on b.id = a.doctor\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "         left join wlyy_charge_dict d on d.charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "         left join base_patient c on c.id = a.patient\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where a.register_no != ''" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where a.register_no != '' and a.dept is not null and a.dept != '' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and a.register_date is not null " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and a.create_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.create_time < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -676,75 +761,93 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //基于科室转换成国家诊疗科目代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] dept = depToSubject(info.get("dept").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String visitDocCode = achNsDoctorRecord(info.get("docId").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_online_med", orgCode + info.get("register_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("net_service_code", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_class_code", info.get("type")== ""?"1":info.get("type")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_orgSub",orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cd_area",orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_name",  info.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_id_no", info.get("docIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_doc_code", visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_subject_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_ subject _name",dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_dept_code", info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_dept_name", info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_no", info.get("paName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_age", IdCardUtil.getAgeForIdcard(info.get("paId").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cost_type", info.get("charge_type").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_birthdate", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ge_code", info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_tel", info.get("moble")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_no", info.get("paId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_district", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_card_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_card_no",info.get("card_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("apply_time", info.get("create_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_time", info.get("register_date")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date date = (Date) info.get("register_date"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String dateStr = DateUtil.dateToStr(DateUtil.getPreDays(date,1),"yyyy-MMM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("visit_finish_time", dateStr+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("old_diag_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("old_diag_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diag_code",info.get("icd10")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diag_name", info.get("icd10_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diseases_type", info.get("origin_adm_no") == null ? "1":"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("complaint_content", info.get("description")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("proc_file", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("price",info.get("req_fee")==null?"0":info.get("req_fee").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("fg_reply", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("crt_time", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"9",info.get("id").toString(),res,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //基于科室转换成国家诊疗科目代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] dept = depToSubject(info.get("dept_code").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String visitDocCode = achNsDoctorRecord(info.get("docId").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_online_med", orgCode + info.get("register_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("net_service_code", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_class_code", info.get("type")== ""?"1":info.get("type")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_name", orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_orgSub",orgSub); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cd_area",orgArea); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_name",  info.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_id_no", info.get("docIdCard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_doc_code", visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_subject_code", dept[0].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_ subject _name",dept[1].toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_dept_code", info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_dept_name", info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_no", info.get("paName")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_age",  IdNOToAge(info.get("paId").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cost_type", info.get("charge_type").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_birthdate", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ge_code", info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_tel", info.get("moble")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_no", info.get("paId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_district", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_card_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_card_no",info.get("card_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("apply_time", info.get("create_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_time", info.get("register_date")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("visit_finish_time", info.get("end_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("old_diag_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("old_diag_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diag_code",info.get("icd10")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diag_name", info.get("icd10_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diseases_type", info.get("origin_adm_no") == null ? "1":"2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("complaint_content", info.get("description")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("proc_file", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("price", Integer.parseInt(info.get("req_fee").toString())  == 0 ? 0:info.get("req_fee") ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("fg_reply", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("crt_time", DateUtil.dateToStrLong(DateUtil.getNow())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("9",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"9",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"9",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 10 电子处方表 micc.upPrescription    --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upPrescription(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upPrescription(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upPrescription"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid =getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -754,14 +857,17 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  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  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  c.idcard is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "   a.create_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "  and a.create_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.create_time < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id = '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -769,83 +875,95 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<total; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String visitDocCode = achNsDoctorRecord(info.get("docIdcard").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_prescription", orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_no",info.get("real_order")== null?"0":info.get("real_order")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_class_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_class_name", "西药"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_id", info.get("patient_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_rd_no", info.get("outpatient_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_class_code", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("med_class_name", "在线复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_no", info.get("patient_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ge_code", info.get("sex")== null?"0": info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_age",IdCardUtil.getAgeForIdcard(info.get("idcard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("birthday", info.get("birthday")  == null?"": DateUtil.dateToStrLong((Date)info.get("birthday"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_no", info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("guarder_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("guarder_no", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_tel",info.get("mobile") == null?"": info.get("mobile")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pt_district", info.get("city_code")== null?"": info.get("city_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("allergic_history", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("cost_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ins_class_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("ins_class_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_name",orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_subject_code", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_subject_name", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_dept_code", info.get("dept")== null?"0":info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_dept_name",info.get("dept_name")== null?"0":info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_time", info.get("create_time")== null?"1900-01-01 00:00:00":DateUtil.dateToStrLong((Date)info.get("create_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_doc_code", visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_doc_name", info.get("doctor_name")== null?"0":info.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_doc_id_no", info.get("docIdcard")== null?"0":info.get("docIdcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("trial_doc_code", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("trial_doc_name", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("trial_doc_id_no", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diag_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diag_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("diseases_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("mobility_flag", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("long_medical_flag", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_effec_days", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("total_price",info.get("his_register_fee")== null?  0 : info.get("his_register_fee")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("upload_time", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_photo", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_photos_list", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_photos", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"10",info.get("id").toString(),res,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 获取监管平台唯一标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String visitDocCode = achNsDoctorRecord(info.get("docIdcard").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_prescription", orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_no",info.get("real_order")== null?"0":info.get("real_order")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_class_code", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_class_name", "西药"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_id", info.get("patient_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_rd_no", info.get("outpatient_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_class_code", "4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("med_class_name", "在线复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_no", info.get("patient_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ge_code", info.get("sex")== null?"0": info.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_age",IdNOToAge( info.get("idcard").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("birthday", info.get("birthday")  == null?"": DateUtil.dateToStrLong((Date)info.get("birthday"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("card_type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_no", info.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("guarder_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("guarder_no", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_tel",info.get("mobile") == null?"": info.get("mobile")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pt_district", info.get("city_code")== null?"": info.get("city_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("allergic_history", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("cost_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ins_class_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("ins_class_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_code", orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_name",orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_subject_code", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_subject_name", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_dept_code", info.get("dept")== null?"0":info.get("dept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_dept_name",info.get("dept_name")== null?"0":info.get("dept_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_time", info.get("create_time")== null?"1900-01-01 00:00:00":DateUtil.dateToStrLong((Date)info.get("create_time"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_doc_code", visitDocCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_doc_name", info.get("doctor_name")== null?"0":info.get("doctor_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_doc_id_no", info.get("docIdcard")== null?"0":info.get("docIdcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("trial_doc_code", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("trial_doc_name", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("trial_doc_id_no", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diag_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diag_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("diseases_type", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("mobility_flag", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("long_medical_flag", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_effec_days", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("total_price",info.get("his_register_fee")== null?  0 : info.get("his_register_fee")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("upload_time", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_photo", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_photos_list", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_photos", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("10",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"10",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"10",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 11 电子处方_药品明细表	micc.upPrescriptionDrug     --- 完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upPrescriptionDrug(String startDate, String endDate) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String upPrescriptionDrug(String startDate, String endDate,String keyId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String api = "micc.upPrescriptionDrug"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String upid = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String token = upNsUserToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int success = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int error = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int dataError = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select a.id, a.prescription_id, a.drug_no,a.drug_name, a.dosage\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "      ,a.unit,a.quantity,a.pack_unit,a.usage_code,a.supply_code\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -853,13 +971,16 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "  from wlyy_prescription_info a \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "     LEFT JOIN wlyy_prescription b \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "             on b.id = a.prescription_id\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(startDate.length() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  a.dosage is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql + "   b.create_time >=  '" + startDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(endDate.length() > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and b.create_time < '" + endDate + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(keyId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql =  sql +  "  and a.id < '" + keyId + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        total = list.size(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -867,60 +988,71 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0; i<total; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jb = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("id_prescription_drug",orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("pres_no", info.get("prescription_id") == null? "0": info.get("prescription_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("org_code",orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("appr_drug_code", info.get("drug_no") == null? "0": info.get("drug_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("appr_drug_name", info.get("drug_name") == null? "0": info.get("drug_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("drug_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("drug_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("drug_form", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("dosage",info.get("dosage") == null? 0: info.get("dosage")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("dosage_unit", info.get("unit") == null? "0": info.get("unit")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("total_dosage", info.get("quantity") == null? 0: info.get("quantity")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("total_dosage_unit", info.get("pack_unit") == null? "0": info.get("pack_unit")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("medicine_freq", info.get("usage_code") == null? "0": info.get("usage_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("drug_total_price",info.get("drug_total_price") == null? 0: info.get("drug_total_price")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("comments", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("anti_comments", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jb.put("dec_meth_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog("11",info.get("id").toString(),res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean errorFlag = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("id_prescription_drug",orgCode + info.get("id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("pres_no", info.get("prescription_id") == null? "0": info.get("prescription_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("org_code",orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("appr_drug_code", info.get("drug_no") == null? "0": info.get("drug_no")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("appr_drug_name", info.get("drug_name") == null? "0": info.get("drug_name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("drug_code", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("drug_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("drug_form", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("dosage",info.get("dosage") == null? 0: info.get("dosage")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("dosage_unit", info.get("unit") == null? "0": info.get("unit")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("total_dosage", info.get("quantity") == null? 0: info.get("quantity")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("total_dosage_unit", info.get("pack_unit") == null? "0": info.get("pack_unit")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("medicine_freq", info.get("usage_code") == null? "0": info.get("usage_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("drug_total_price",info.get("drug_total_price") == null? 0: info.get("drug_total_price")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("comments", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("anti_comments", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jb.put("dec_meth_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                errorFlag = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                saveErrorLog(upid,"11",info.get("id").toString(),res,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                dataError++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.error(e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!errorFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.add(jb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res = postToInter(token,api, jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject resJson = (JSONObject) JSONObject.parse(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("200".equals(resJson.get("msg").toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    success++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    saveErrorLog(upid,"11",info.get("id").toString(),res,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        saveUpLog(upid,"11",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //基于身份证号计算年龄 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public static int IdNOToAge(String IdNO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int leh = IdNO.length(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String dates=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (leh == 18) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int se = Integer.valueOf(IdNO.substring(leh - 1)) % 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            dates = IdNO.substring(6, 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SimpleDateFormat df = new SimpleDateFormat("yyyy"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String year=df.format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int u=Integer.parseInt(year)-Integer.parseInt(dates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return u; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            dates = IdNO.substring(6, 8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Integer.parseInt(dates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public static int IdNOToAge(String IdNO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        int leh = IdNO.length(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String dates=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (leh == 18) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            int se = Integer.valueOf(IdNO.substring(leh - 1)) % 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            dates = IdNO.substring(6, 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            SimpleDateFormat df = new SimpleDateFormat("yyyy"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String year=df.format(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            int u=Integer.parseInt(year)-Integer.parseInt(dates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            return u; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            dates = IdNO.substring(6, 8); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            return Integer.parseInt(dates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 基于医生所在科室,转换成国家诊疗科目代码(中山医院专用) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 当科室信息在列表中不存在的情况,全部配置为预防保健科 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1107,13 +1239,30 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 将上传失败的数据存储到LOG 中,便于后续补传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveErrorLog(String type, String id, String errorInfo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveErrorLog(String upId,String type, String id, String errorInfo,Integer errorType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        InternetUpErrorLogDO internetUpErrorLogDO = new InternetUpErrorLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogDO.setUpId(upId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogDO.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogDO.setKeyId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogDO.setErrorInfo(errorInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogDO.setErrorType(errorType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpErrorLogService.save(internetUpErrorLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveUpLog(String upid,String code,Date startDate,Date endDate,Integer suc,Integer err,Integer dataErr,String remark){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        InternetUpLogDO internetUpLogDO = new InternetUpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setId(upid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setStartDate(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setEndDate(endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setSuc(suc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setErr(err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setDataErr(dataErr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDO.setRemark(remark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        internetUpLogDao.save(internetUpLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    // 基于中山医院的职务字典,强转为监管平台的字典(该部分过滤掉字典与监管理无法匹配的部分) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public static  String[]  classToduty(String duty){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1212,6 +1361,9 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case "1202": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res[0] = "252"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res[1] = "副主护师"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res[0] = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res[1] = "未知"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |