|  | @ -33,6 +33,7 @@ import jxl.Sheet;
 | 
	
		
			
				|  |  | import jxl.Workbook;
 | 
	
		
			
				|  |  | import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -72,6 +73,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |     private ArchiveDao archiveDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyPatientLabelDao patientLabelDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
 | 
	
		
			
				|  |  |     @ApiOperation(value = "创建")
 | 
	
	
		
			
				|  | @ -226,33 +229,21 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |      *   姓名	性别	年龄	身份证号	      联系方式	   小区	            地址	                 签约团队	        能力类型
 | 
	
		
			
				|  |  |      * 沈xxx	女	    88	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区10幢4单元103	    虹园/稻香园服务团队	    能力完好
 | 
	
		
			
				|  |  |      * 沈xxx	女	    86	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区天盛居4幢1202室	  大木桥服务团队	    能力完好
 | 
	
		
			
				|  |  |      * @param request
 | 
	
		
			
				|  |  |      * @param file
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/importPatientFromExcel", produces = "application/json;charset=UTF-8",method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @RequestMapping(value = "/open/importPatientFromTmp" ,method = RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public ObjEnvelop importPatientFromExcel(HttpServletRequest request, @ApiParam(value = "文件", required = true)
 | 
	
		
			
				|  |  |     @RequestParam(value = "file", required = true) MultipartFile file) {
 | 
	
		
			
				|  |  |         Calendar c1 = Calendar.getInstance();
 | 
	
		
			
				|  |  |         /**
 | 
	
		
			
				|  |  |          * c1  签约结束时间
 | 
	
		
			
				|  |  |          */
 | 
	
		
			
				|  |  |         c1.set(2023, 12 - 1, 31,23,59,59);
 | 
	
		
			
				|  |  |         List errorLs = new ArrayList<>();
 | 
	
		
			
				|  |  |     public ObjEnvelop importPatientFromTmp() {
 | 
	
		
			
				|  |  |         Calendar cal = Calendar.getInstance();
 | 
	
		
			
				|  |  |         int year= 100;
 | 
	
		
			
				|  |  |         List correctLs = new ArrayList<>();
 | 
	
		
			
				|  |  |         List idcardList = new ArrayList<>();
 | 
	
		
			
				|  |  |         Map<String, String> errorMsgMap = new HashMap<>();
 | 
	
		
			
				|  |  |         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |         List<String> deviceCodes = new ArrayList<>();
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             request.setCharacterEncoding("UTF-8");
 | 
	
		
			
				|  |  |             InputStream inputStream = file.getInputStream();
 | 
	
		
			
				|  |  |             Workbook rwb = Workbook.getWorkbook(inputStream);
 | 
	
		
			
				|  |  |             Sheet[] sheets = rwb.getSheets();
 | 
	
		
			
				|  |  |             int rows;
 | 
	
		
			
				|  |  |             int row;
 | 
	
		
			
				|  |  |             String name=null;//用户姓名
 | 
	
		
			
				|  |  |             String sql = "select * from patient_tmp";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String name;//用户姓名
 | 
	
		
			
				|  |  |             String sex; //性别
 | 
	
		
			
				|  |  |             String age; //年龄
 | 
	
		
			
				|  |  |             String idcard;  //身份证号
 | 
	
	
		
			
				|  | @ -261,24 +252,18 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |             String address; //居住地址
 | 
	
		
			
				|  |  |             String signTeam; //签约团队
 | 
	
		
			
				|  |  |             String label; //能力类型
 | 
	
		
			
				|  |  |             Sheet sheet = sheets[0];    //第一张表
 | 
	
		
			
				|  |  |             rows = sheet.getRows();
 | 
	
		
			
				|  |  |             for (int j = 1; j < rows; j++) {
 | 
	
		
			
				|  |  |                 if (sheet.getRow(j).length == 0) {
 | 
	
		
			
				|  |  |                     continue;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             for (Map<String,Object> map:list) {
 | 
	
		
			
				|  |  |                 BasePatientDO basePatientVO = new BasePatientDO();
 | 
	
		
			
				|  |  |                 JSONObject infoMap = new JSONObject();
 | 
	
		
			
				|  |  |                 row = j;
 | 
	
		
			
				|  |  |                 name = sheet.getCell(0, row).getContents().trim();    //0 用户姓名
 | 
	
		
			
				|  |  |                 sex = sheet.getCell(1, row).getContents().trim();  //1 性别
 | 
	
		
			
				|  |  |                 age = sheet.getCell(2, row).getContents().trim();   //2 年龄
 | 
	
		
			
				|  |  |                 idcard = sheet.getCell(3, row).getContents().trim(); //3 身份证号
 | 
	
		
			
				|  |  |                 mobile = sheet.getCell(4, row).getContents().trim();  //4 联系方式
 | 
	
		
			
				|  |  |                 residentialArea = sheet.getCell(5, row).getContents().trim(); //5 居住小区
 | 
	
		
			
				|  |  |                 address = sheet.getCell(6, row).getContents().trim(); //6 居住地址
 | 
	
		
			
				|  |  |                 signTeam = sheet.getCell(7, row).getContents().trim();; //签约团队
 | 
	
		
			
				|  |  |                 label = sheet.getCell(8, row).getContents().trim();; //能力类型
 | 
	
		
			
				|  |  |                 name = map.get("name")+"";    //0 用户姓名
 | 
	
		
			
				|  |  |                 sex = map.get("sex")+"";  //1 性别
 | 
	
		
			
				|  |  |                 age = map.get("age")+"";   //2 年龄
 | 
	
		
			
				|  |  |                 idcard = map.get("idcard")+""; //3 身份证号
 | 
	
		
			
				|  |  |                 mobile = map.get("mobile")+"";  //4 联系方式
 | 
	
		
			
				|  |  |                 residentialArea = map.get("area")+""; //5 居住小区
 | 
	
		
			
				|  |  |                 address = map.get("address")+""; //6 居住地址
 | 
	
		
			
				|  |  |                 signTeam = map.get("sign")+""; //签约团队
 | 
	
		
			
				|  |  |                 label = map.get("label")+""; //能力类型
 | 
	
		
			
				|  |  |                 if (StringUtils.isBlank(idcard)){
 | 
	
		
			
				|  |  |                     continue;
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -352,7 +337,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |                         signRecordDO.setName(name);
 | 
	
		
			
				|  |  |                         signRecordDO.setStatus(1);
 | 
	
		
			
				|  |  |                         signRecordDO.setStartTime(new Date());
 | 
	
		
			
				|  |  |                         signRecordDO.setEndTime(c1.getTime());
 | 
	
		
			
				|  |  |                         cal.add(Calendar.YEAR,year);
 | 
	
		
			
				|  |  |                         signRecordDO.setEndTime(cal.getTime());
 | 
	
		
			
				|  |  |                         BaseTeamDO teamDO = baseTeamDao.findByName(signTeam);
 | 
	
		
			
				|  |  |                         if (teamDO == null) {
 | 
	
		
			
				|  |  |                             errorMsgMap.put(idcard,"团队信息获取失败");
 | 
	
	
		
			
				|  | @ -403,7 +389,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |             //包装导入结果(导入成功数量、错误对象集合)
 | 
	
		
			
				|  |  |             Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  |             map.put("successNum", correctLs.size());
 | 
	
		
			
				|  |  |             map.put("failedNum", rows-1 - correctLs.size() );
 | 
	
		
			
				|  |  |             map.put("failedNum", list.size() - correctLs.size() );
 | 
	
		
			
				|  |  |             map.put("errorData", JSON.toJSONString(errorMsgMap, SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |             System.out.println(map);
 | 
	
		
			
				|  |  |             return ObjEnvelop.getSuccess("获取成功",map);
 |