#2395 导入居民

Zusammengeführt
shikejing hat 2 Commits von shikejing/dev nach Amoy2/dev vor 3 Jahren zusammengeführt

+ 21 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.endpoint.patient;
package com.yihu.jw.base.endpoint.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -202,6 +203,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    @RequestParam(value = "file", required = true) MultipartFile file) {
    @RequestParam(value = "file", required = true) MultipartFile file) {
        List errorLs = new ArrayList<>();
        List errorLs = new ArrayList<>();
        List correctLs = new ArrayList<>();
        List correctLs = new ArrayList<>();
        List idcardList = new ArrayList<>();
        Map<String, String> errorMsgMap = new HashMap<>();
        Map<String, String> errorMsgMap = new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<String> deviceCodes = new ArrayList<>();
        List<String> deviceCodes = new ArrayList<>();
@ -228,6 +230,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
                    continue;
                    continue;
                }
                }
                BasePatientDO basePatientVO = new BasePatientDO();
                BasePatientDO basePatientVO = new BasePatientDO();
                JSONObject infoMap = new JSONObject();
                row = j;
                row = j;
                name = sheet.getCell(0, row).getContents().trim();    //0 用户姓名
                name = sheet.getCell(0, row).getContents().trim();    //0 用户姓名
                sex = sheet.getCell(1, row).getContents().trim();  //1 性别
                sex = sheet.getCell(1, row).getContents().trim();  //1 性别
@ -280,6 +283,10 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
                basePatientVO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                basePatientVO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                basePatientVO.setSalt(salt);
                basePatientVO.setSalt(salt);
                correctLs.add(basePatientVO);
                correctLs.add(basePatientVO);
                infoMap.put("idcard",idcard);
                infoMap.put("signTeam",signTeam);
                infoMap.put("label",label);
                idcardList.add(infoMap);
            }
            }
            basePatientDao.save(correctLs);
            basePatientDao.save(correctLs);
@ -287,6 +294,16 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
            /**
            /**
             * 添加签约数据
             * 添加签约数据
             */
             */
            if (idcardList.size() > 0) {
                for (int i=0;i<idcardList.size();i++) {
                    idcard = retOne(idcardList.get(i).toString(),"idcard").toString();
                    signTeam = retOne(idcardList.get(i).toString(),"signTeam").toString();
                    label = retOne(idcardList.get(i).toString(),"label").toString();
                    System.out.println(idcard + "   " + signTeam + "    " + label);
                    //330103193308210720   虹园/稻香园服务团队    能力完好
                }
            }
            //包装导入结果(导入成功数量、错误对象集合)
            //包装导入结果(导入成功数量、错误对象集合)
            Map<String, Object> map = new HashMap<>();
            Map<String, Object> map = new HashMap<>();
@ -301,5 +318,9 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    public Object retOne(String str,String name){
        JSONObject object = JSONObject.parseObject(str);
        return object.get(""+name+"");
    }
}
}