Commit 1c4619a9f392fa99d027871e6136e1a8ebb3241a

Authored by shiyang
1 parent 078fb6a8f8

民生工程数据接口-分娩记录(主)C301

Showing 3 changed files with 599 additions and 112 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 1c4619a
... ... @@ -1734,6 +1734,148 @@
1734 1734 return doubleValue;
1735 1735 }
1736 1736  
  1737 + /**
  1738 + * 身份证-获取出生日期
  1739 + *
  1740 + * @return 返回字符串类型
  1741 + */
  1742 + public static String getBirthFromIdCard(String idCard) {
  1743 + if (idCard.length() != 18 && idCard.length() != 15) {
  1744 + return null;
  1745 + }
  1746 + if (idCard.length() == 18) {
  1747 + String year = idCard.substring(6).substring(0, 4);// 得到年份
  1748 + String month = idCard.substring(10).substring(0, 2);// 得到月份
  1749 + String day = idCard.substring(12).substring(0, 2);// 得到日
  1750 + return (year + "-" + month + "-" + day);
  1751 + } else if (idCard.length() == 15) {
  1752 + String year = "19" + idCard.substring(6, 8);// 年份
  1753 + String month = idCard.substring(8, 10);// 月份
  1754 + String day = idCard.substring(10, 12);// 得到日
  1755 + return (year + "-" + month + "-" + day);
  1756 + }
  1757 + return null;
  1758 + }
  1759 +
  1760 + /**
  1761 + * 身份证-获取出生日期
  1762 + *
  1763 + * @return 返回日期格式
  1764 + */
  1765 + public static Date getBirthDayFromIdCard(String idCard) throws ParseException {
  1766 + Date birth = null;
  1767 + if (idCard.length() == 18) {
  1768 + String year = idCard.substring(6).substring(0, 4);// 得到年份
  1769 + String month = idCard.substring(10).substring(0, 2);// 得到月份
  1770 + String day = idCard.substring(12).substring(0, 2);// 得到日
  1771 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  1772 + birth = format.parse(year + "-" + month + "-" + day);
  1773 + } else if (idCard.length() == 15) {
  1774 + String year = "19" + idCard.substring(6, 8);// 年份
  1775 + String month = idCard.substring(8, 10);// 月份
  1776 + String day = idCard.substring(10, 12);// 得到日
  1777 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  1778 + birth = format.parse(year + "-" + month + "-" + day);
  1779 + }
  1780 + return birth;
  1781 + }
  1782 +
  1783 + /**
  1784 + * 身份证-获取性别
  1785 + * 9=未说明的性别,0=女性,1=男性
  1786 + * @return int
  1787 + */
  1788 + public static int getSexFromIdCard(String idCard) {
  1789 + int sex = 9;
  1790 + // 身份证号码为空
  1791 + if (idCard == "" || idCard.length() <= 0){
  1792 + return sex;
  1793 + }
  1794 + if (idCard.length() == 18) {
  1795 + if (Integer.parseInt(idCard.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
  1796 + sex = 0; // 女
  1797 + } else {
  1798 + sex = 1; // 男
  1799 + }
  1800 + } else if (idCard.length() == 15) {
  1801 + String usex = idCard.substring(14, 15);// 用户的性别
  1802 + if (Integer.parseInt(usex) % 2 == 0) {
  1803 + sex = 0; // 女
  1804 + } else {
  1805 + sex = 1; // 男
  1806 + }
  1807 + }
  1808 + return sex;
  1809 + }
  1810 +
  1811 + /**
  1812 + * 根据身份证的号码算出当前身份证持有者的年龄
  1813 + *
  1814 + * @param
  1815 + * @throws Exception
  1816 + * @return 0 (身份证号码为空/异常)
  1817 + */
  1818 + public static int getAgeForIdcard(String idcard) {
  1819 + try {
  1820 + int age = 0;
  1821 + if (StringUtils.isEmpty(idcard)) {
  1822 + return age;
  1823 + }
  1824 +
  1825 + String birth = "";
  1826 + if (idcard.length() == 18) {
  1827 + birth = idcard.substring(6, 14);
  1828 + } else if (idcard.length() == 15) {
  1829 + birth = "19" + idcard.substring(6, 12);
  1830 + }
  1831 +
  1832 + int year = Integer.valueOf(birth.substring(0, 4));
  1833 + int month = Integer.valueOf(birth.substring(4, 6));
  1834 + int day = Integer.valueOf(birth.substring(6));
  1835 + Calendar cal = Calendar.getInstance();
  1836 + age = cal.get(Calendar.YEAR) - year;
  1837 + //周岁计算
  1838 + if (cal.get(Calendar.MONTH) < (month - 1) || (cal.get(Calendar.MONTH) == (month - 1) && cal.get(Calendar.DATE) < day)) {
  1839 + age--;
  1840 + }
  1841 + return age;
  1842 + } catch (Exception e) {
  1843 + e.getMessage();
  1844 + }
  1845 + return 0;
  1846 + }
  1847 +
  1848 + /**
  1849 + * 15 位身份证号码转 18 位
  1850 + * <p>
  1851 + * 15位身份证号码:第7、8位为出生年份(两位数),第9、10位为出生月份,第11、12位代表出生日期,第15位代表性别,奇数为男,偶数为女。
  1852 + * 18位身份证号码:第7、8、9、10位为出生年份(四位数),第11、第12位为出生月份,第13、14位代表出生日期,第17位代表性别,奇数为男,偶数为女。
  1853 + */
  1854 + public static StringBuffer IdCardMethod15To18(String idCard) {
  1855 + //将字符串转化为buffer进行操作
  1856 + StringBuffer stringBuffer = new StringBuffer(idCard);
  1857 + //身份证最后一位校验码,X代表10(顺序固定)
  1858 + char[] checkIndex = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
  1859 + int sum = 0;
  1860 + //在第6位插入年份的前两位19
  1861 + stringBuffer.insert(6, "19");
  1862 + for (int i = 0; i < stringBuffer.length(); i++) {
  1863 + char c = stringBuffer.charAt(i);
  1864 + //前17位数字
  1865 + int ai = Integer.valueOf(String.valueOf(c));
  1866 + //前17位每位对应的系数(7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 )
  1867 + int wi = ((int) Math.pow(2, stringBuffer.length() - i)) % 11;
  1868 + //总和(每位数字乘以系数再相加)
  1869 + sum = sum + ai * wi;
  1870 + }
  1871 + //总和除以11求余
  1872 + int indexOf = sum % 11;
  1873 + //根据余数作为下表在校验码数组里取值
  1874 + stringBuffer.append(checkIndex[indexOf]);
  1875 + return stringBuffer;
  1876 + }
  1877 +
  1878 +
1737 1879 public static void main(String[] args) {
1738 1880  
1739 1881 Date startDate = DateUtil.parseYMDHMS(DateUtil.getyyyy_MM_dd( DateUtil.addDay(new Date(), -3)) + " 00:00:00");
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LivelihoodProjectsController.java View file @ 1c4619a
... ... @@ -88,5 +88,29 @@
88 88 @RequestParam(required = false) String endDate) {
89 89 return livelihoodProjectsFacade.getMsgcC201(startDate,endDate);
90 90 }
  91 + /**
  92 + * 孕分娩记录(主)C301
  93 + * @param startDate
  94 + * @param endDate
  95 + * @return
  96 + */
  97 + @RequestMapping(value = "/getMsgcC301", method = RequestMethod.GET)
  98 + @ResponseBody
  99 + public BaseObjectResponse getMsgcC301(@RequestParam(required = false) String startDate,
  100 + @RequestParam(required = false) String endDate) {
  101 + return livelihoodProjectsFacade.getMsgcC301(startDate,endDate);
  102 + }
  103 + /**
  104 + * 新生儿信息(从)C401
  105 + * @param startDate
  106 + * @param endDate
  107 + * @return
  108 + */
  109 + @RequestMapping(value = "/getMsgcC401", method = RequestMethod.GET)
  110 + @ResponseBody
  111 + public BaseObjectResponse getMsgcC401(@RequestParam(required = false) String startDate,
  112 + @RequestParam(required = false) String endDate) {
  113 + return livelihoodProjectsFacade.getMsgcC401(startDate,endDate);
  114 + }
91 115 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LivelihoodProjectsFacade.java View file @ 1c4619a
... ... @@ -11,10 +11,12 @@
11 11 import com.lyms.platform.common.enums.YnEnums;
12 12 import com.lyms.platform.common.result.BaseObjectResponse;
13 13 import com.lyms.platform.common.utils.DateUtil;
  14 +import com.lyms.platform.common.utils.JsonUtil;
14 15 import com.lyms.platform.common.utils.SystemConfig;
15 16 import com.lyms.platform.operate.web.result.BasicConfigResult;
16 17 import com.lyms.platform.operate.web.utils.CollectionUtils;
17 18 import com.lyms.platform.operate.web.utils.CommonsHelper;
  19 +import com.lyms.platform.permission.dao.master.CouponMapper;
18 20 import com.lyms.platform.permission.model.Users;
19 21 import com.lyms.platform.permission.service.OrganizationService;
20 22 import com.lyms.platform.permission.service.UsersService;
21 23  
... ... @@ -23,9 +25,11 @@
23 25 import com.lyms.platform.query.PatientsQuery;
24 26 import com.lyms.platform.query.ResidentsArchiveQuery;
25 27 import org.apache.commons.lang.StringUtils;
  28 +import org.apache.commons.lang.math.NumberUtils;
26 29 import org.slf4j.Logger;
27 30 import org.slf4j.LoggerFactory;
28 31 import org.springframework.beans.factory.annotation.Autowired;
  32 +import org.springframework.data.mongodb.core.MongoTemplate;
29 33 import org.springframework.data.mongodb.core.query.Criteria;
30 34 import org.springframework.data.mongodb.core.query.Query;
31 35 import org.springframework.stereotype.Component;
... ... @@ -53,6 +57,10 @@
53 57 private BabyBookbuildingService babyBookbuildingService;
54 58 @Autowired
55 59 private PatientsService patientsService;
  60 + @Autowired
  61 + private MongoTemplate mongoTemplate;
  62 + @Autowired
  63 + private CouponMapper couponMapper;
56 64  
57 65  
58 66 public BaseObjectResponse getMsgcC101(String startDate, String endDate) {
59 67  
... ... @@ -78,9 +86,9 @@
78 86 //id
79 87 map.put("id",model.getId());
80 88 //档案编号
81   - map.put("file_number","");
  89 + map.put("file_number","/");
82 90 //纸质档案编号
83   - map.put("file_number_paper","");
  91 + map.put("file_number_paper","/");
84 92 //证件类型(lyms_basicconfig表中查"parentId": "c914bb2e-1825-4036-8a41-fe617c90d405")
85 93 String credentials_type_code="99";
86 94 if(StringUtils.isNotEmpty(model.getCertificateTypeId())){
87 95  
88 96  
89 97  
90 98  
91 99  
92 100  
93 101  
94 102  
95 103  
96 104  
97 105  
98 106  
... ... @@ -101,37 +109,49 @@
101 109 }
102 110 map.put("credentials_type_code",credentials_type_code);
103 111 //其他身份证件名称
104   - map.put("other_credentials_type","");
  112 + map.put("other_credentials_type","/");
105 113 //证件号码
106   - map.put("credentials_number",StringUtils.isNotEmpty(model.getCertificateNum())?model.getCertificateNum():"");
  114 + map.put("credentials_number",StringUtils.isNotEmpty(model.getCertificateNum())?model.getCertificateNum():"/");
107 115 //出生日期
108   - map.put("birthday",null!=model.getBirthday()?DateUtil.getyyyy_MM_dd_hms(model.getBirthday()):null);
  116 + String birthday=DateUtil.getyyyy_MM_dd_hms(model.getBirthday());
  117 + if(StringUtils.isEmpty(birthday)){
  118 + if(StringUtils.isNotEmpty(model.getCertificateNum())){
  119 + //用身份证获取
  120 + birthday=DateUtil.getBirthFromIdCard(model.getCertificateNum());
  121 + if(StringUtils.isEmpty(birthday)){
  122 + birthday=DateUtil.getyyyy_MM_dd_hms(new Date());
  123 + }
  124 + }else {
  125 + birthday=DateUtil.getyyyy_MM_dd_hms(new Date());
  126 + }
  127 + }
  128 + map.put("birthday",birthday);
109 129 //姓名
110   - map.put("name",StringUtils.isNotEmpty(model.getUsername())?model.getUsername():"");
  130 + map.put("name",StringUtils.isNotEmpty(model.getUsername())?model.getUsername():"/");
111 131 //姓名简拼
112   - map.put("en_name","");
  132 + map.put("en_name","/");
113 133 //所属民族
114 134 String nation_code= CdGwNationEnums.getId(getBasicConfig(model.getNationId()));
115 135 map.put("nation_code",StringUtils.isNotEmpty(nation_code)?nation_code:"99");
116 136 //性别
117 137 map.put("gender_code","2");
118 138 //工作单位
119   - map.put("work_unit",StringUtils.isNotEmpty(model.getWorkUnit())?model.getWorkUnit():"");
  139 + map.put("work_unit",StringUtils.isNotEmpty(model.getWorkUnit())?model.getWorkUnit():"/");
120 140 //固定电话
121   - map.put("tel","");
  141 + map.put("tel","/");
122 142 //手机号
123   - map.put("phone",StringUtils.isNotEmpty(model.getPhone())?model.getPhone():"");
  143 + map.put("phone",StringUtils.isNotEmpty(model.getPhone())?model.getPhone():"/");
124 144 //联系人姓名
125   - map.put("contact_name","");
  145 + map.put("contact_name","/");
126 146 //联系人电话
127   - map.put("contact_phone","");
  147 + map.put("contact_phone","/");
128 148 //是否常驻
129   - map.put("is_permanent_code","");
  149 + map.put("is_permanent_code","/");
130 150 //流动情况
131   - map.put("permanent_type_code","");
  151 + map.put("permanent_type_code","/");
132 152  
133 153 //户籍类型(lyms_basicconfig表中查"parentId": "57624ba30cf23d4631523e9d")
134   - String address_type_code="1";
  154 + String address_type_code="2";
135 155 if(StringUtils.isNotEmpty(model.getCensusTypeId())){
136 156 switch (model.getCensusTypeId()){
137 157 case "57624bf90cf23d4631523e9e":
138 158  
139 159  
140 160  
141 161  
142 162  
143 163  
144 164  
... ... @@ -146,23 +166,30 @@
146 166 }
147 167 map.put("census_register_type_code",address_type_code);
148 168 //居住类型
149   - map.put("address_type_code","");
  169 + map.put("address_type_code","/");
150 170 //户籍区划编码
151   - map.put("residence_district_id","");
  171 + map.put("residence_district_id","/");
152 172 //户籍地址区划详情
153   - map.put("residence_district_detail","");
  173 + map.put("residence_district_detail","/");
154 174 //户籍地址
155   - map.put("residence_address","");
  175 + map.put("residence_address","/");
156 176 //身份证住址
157   - map.put("id_card_address","");
  177 + map.put("id_card_address","/");
158 178 //年龄
159   - map.put("age",null!=model.getAge()?model.getAge():null);
160   - //身高(cm)??????
161   - map.put("height",null);
  179 + Integer age=model.getAge();
  180 + if(null==model.getAge()){
  181 + if(StringUtils.isNotEmpty(model.getCertificateNum())){
  182 + //用身份证获取
  183 + age=DateUtil.getAgeForIdcard(model.getCertificateNum());
  184 + }
  185 + }
  186 + map.put("age",age);
  187 + //身高(cm)系统中不能获取 没有就传最小取值
  188 + map.put("height",20);
162 189 //血型
163   - map.put("blood_type_code","");
  190 + map.put("blood_type_code","/");
164 191 //RH阴性
165   - map.put("blood_type_rh_code","");
  192 + map.put("blood_type_rh_code","/");
166 193 //文化程度(lyms_basicconfig表中查"parentId": "8046934b-ebe8-4037-98b6-a9ec47996700")
167 194 String edu_attainment_code="10";
168 195 if(StringUtils.isNotEmpty(model.getLevelTypeId())){
... ... @@ -215,7 +242,7 @@
215 242 }
216 243 map.put("edu_attainment_code",edu_attainment_code);
217 244 //职业
218   - map.put("profession_code","");
  245 + map.put("profession_code","/");
219 246 //婚姻状况(lyms_basicconfig表中查"parentId": "0ab3e86b-dfdb-47eb-a58b-a2f2d978b69f")
220 247 String marital_status_code="5";
221 248 if(StringUtils.isNotEmpty(model.getMarriageId())){
222 249  
... ... @@ -232,9 +259,9 @@
232 259 }
233 260 map.put("marital_status_code",marital_status_code);
234 261 //责任医生
235   - map.put("doctor_name","");
  262 + map.put("doctor_name","/");
236 263 //建档人
237   - String create_doctor="";
  264 + String create_doctor="/";
238 265 if(StringUtils.isNotEmpty(model.getBuildDoctor())) {
239 266 Users user = usersService.getUsers(Integer.parseInt(model.getBuildDoctor()));
240 267 if (null!=user && StringUtils.isNotEmpty(user.getName())) {
241 268  
242 269  
243 270  
244 271  
245 272  
... ... @@ -243,17 +270,17 @@
243 270 }
244 271 map.put("create_doctor",create_doctor);
245 272 //建档日期
246   - map.put("this_date",null!=model.getBuildDay()?DateUtil.getyyyy_MM_dd_hms(model.getBuildDay()):null);
  273 + map.put("this_date",null!=model.getBuildDay()?DateUtil.getyyyy_MM_dd_hms(model.getBuildDay()):DateUtil.getyyyy_MM_dd_hms(new Date()));
247 274 //出生人口编码
248   - map.put("childbirth_code","");
  275 + map.put("childbirth_code","/");
249 276 //是否孕妇
250   - map.put("is_gravida","");
  277 + map.put("is_gravida","/");
251 278 //是否产妇
252   - map.put("is_puerpera","");
  279 + map.put("is_puerpera","/");
253 280 //系统录入时间
254   - map.put("entering_time",null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):new Date());
  281 + map.put("entering_time",null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
255 282 //所属机构编码
256   - String organ_id="";
  283 + String organ_id="/";
257 284 if(StringUtils.isNotEmpty(model.getHospitalId())){
258 285 organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
259 286 }
260 287  
... ... @@ -268,9 +295,9 @@
268 295 }
269 296 map.put("district_nation_code", organizationService.getAreaCode(areaName));
270 297 //母亲姓名简拼
271   - map.put("mother_en_name","");
  298 + map.put("mother_en_name","/");
272 299 //数据上传时间
273   -// map.put("import_time","");
  300 +// map.put("import_time",null);
274 301 //修改时间
275 302 map.put("last_modified_time",null);
276 303 //删除状态,0正常,1删除
277 304  
278 305  
279 306  
280 307  
281 308  
282 309  
283 310  
284 311  
285 312  
286 313  
287 314  
... ... @@ -319,32 +346,53 @@
319 346 //id
320 347 map.put("id",model.getId());
321 348 //档案编号
322   - map.put("babyModels", "");
  349 + map.put("babyModels", "/");
323 350 //纸质档案编号
324   - map.put("file_number_paper", "");
  351 + map.put("file_number_paper", "/");
325 352 //证件类型
326   - map.put("credentials_type_code", "");
  353 + map.put("credentials_type_code", "/");
327 354 //其他证件名称
328   - map.put("other_credentials_type", "");
  355 + map.put("other_credentials_type", "/");
329 356 //证件号码
330   - map.put("credentials_number", StringUtils.isNotEmpty(model.getCardNo())?model.getCardNo():"");
  357 + map.put("credentials_number", StringUtils.isNotEmpty(model.getCardNo())?model.getCardNo():"/");
331 358 //出生日期
332   - map.put("birthday", null!=model.getBirth()?DateUtil.getyyyy_MM_dd_hms(model.getBirth()):null);
  359 + String birthday=DateUtil.getyyyy_MM_dd_hms(model.getBirth());
  360 + if(StringUtils.isEmpty(birthday)){
  361 + if(StringUtils.isNotEmpty(model.getCardNo())){
  362 + //用身份证获取
  363 + birthday=DateUtil.getBirthFromIdCard(model.getCardNo());
  364 + if(StringUtils.isEmpty(birthday)){
  365 + birthday=DateUtil.getyyyy_MM_dd_hms(new Date());
  366 + }
  367 + }else {
  368 + birthday=DateUtil.getyyyy_MM_dd_hms(new Date());
  369 + }
  370 + }
  371 + map.put("birthday", birthday);
333 372 //姓名
334   - map.put("name", StringUtils.isNotEmpty(model.getName())?model.getName():"");
  373 + map.put("name", StringUtils.isNotEmpty(model.getName())?model.getName():"/");
335 374 //姓名简拼
336   - map.put("en_name", "");
  375 + map.put("en_name", "/");
337 376 //所属民族
338 377 String nation_code= CdGwNationEnums.getId(getBasicConfig(model.getBnationId()));
339 378 map.put("nation_code",StringUtils.isNotEmpty(nation_code)?nation_code:"99");
340 379 //性别
341   - map.put("gender_code", null!=model.getSex()?(model.getSex()==1?"1":"2"):"9");
  380 + String gender_code="9";
  381 + if(null!=model.getSex()){
  382 + gender_code=model.getSex()==1?"1":"2";
  383 + }else {
  384 + if(StringUtils.isNotEmpty(model.getCardNo())){
  385 + gender_code=String.valueOf(DateUtil.getSexFromIdCard(model.getCardNo()));
  386 + gender_code=gender_code.equals("1")?"1":gender_code.equals("0")?"2":"9";
  387 + }
  388 + }
  389 + map.put("gender_code", gender_code);
342 390 //接种条码
343   - map.put("vaccination_code", "");
  391 + map.put("vaccination_code", "/");
344 392 //固话
345   - map.put("tel", "");
  393 + map.put("tel", "/");
346 394 //手机号
347   - String phone="";
  395 + String phone="/";
348 396 if(StringUtils.isNotEmpty(model.getMphone())){
349 397 phone=model.getMphone();
350 398 }
351 399  
352 400  
353 401  
354 402  
355 403  
356 404  
357 405  
358 406  
359 407  
360 408  
361 409  
... ... @@ -353,41 +401,50 @@
353 401 }
354 402 map.put("phone", phone);
355 403 //是否常住
356   - map.put("is_permanent_code", "");
  404 + map.put("is_permanent_code", "/");
357 405 //流动情况
358   - map.put("permanent_type_code", "");
359   - //户籍类型???
360   - map.put("census_register_type_code", "");
  406 + map.put("permanent_type_code", "/");
  407 + //户籍类型 系统中不能获取,默认2
  408 + map.put("census_register_type_code", "2");
361 409 //居住类型
362   - map.put("address_type_code", "");
  410 + map.put("address_type_code", "/");
363 411 //户籍地址区划Id
364   - map.put("residence_district_id", "");
  412 + map.put("residence_district_id", "/");
365 413 //户籍地址区划详情
366   - map.put("residence_district_detail", "");
  414 + map.put("residence_district_detail", "/");
367 415 //户籍地址
368   - map.put("residence_address", "");
  416 + map.put("residence_address", "/");
369 417 //身份证住址
370   - map.put("id_card_address", "");
  418 + map.put("id_card_address", "/");
371 419 //年龄
372   - map.put("age", null!=model.getBirth()?DateUtil.getAge(model.getBirth()):null);
373   - //身高(cm)
374   - Integer babyHeight=null;
  420 + Integer age=0;
  421 + if(null!=model.getBirth()){
  422 + age=DateUtil.getAge(model.getBirth());
  423 + }else {
  424 + if(StringUtils.isNotEmpty(model.getCardNo())){
  425 + //用身份证获取
  426 + age=DateUtil.getAgeForIdcard(model.getCardNo());
  427 + }
  428 + }
  429 + map.put("age", age);
  430 + //身高(cm) 默认取 最小值
  431 + Integer babyHeight=20;
375 432 if(StringUtils.isNotEmpty(model.getBabyHeight())){
376 433 babyHeight=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(model.getBabyHeight()))));
377 434 }
378 435 map.put("height", babyHeight);
379   - //体重(g)
380   - Integer babyWeight=null;
  436 + //体重(g) 默认取 最小值
  437 + Integer babyWeight=200;
381 438 if(StringUtils.isNotEmpty(model.getBabyWeight())){
382 439 babyWeight=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(model.getBabyWeight()))));
383 440 }
384 441 map.put("weight", babyWeight);
385 442 //血型
386   - map.put("blood_type_code", "");
  443 + map.put("blood_type_code", "/");
387 444 //RH阴性
388   - map.put("blood_type_rh_code", "");
  445 + map.put("blood_type_rh_code", "/");
389 446 //责任医生
390   - String create_doctor="";
  447 + String create_doctor="/";
391 448 if(StringUtils.isNotEmpty(model.getBuildDoctor())) {
392 449 if ("a9e5507f-e7da-4ec6-b8db-9a1e4d1b7c29".equals(model.getBuildDoctor())) {
393 450 create_doctor="产科病房";
394 451  
... ... @@ -402,9 +459,9 @@
402 459 //建档人
403 460 map.put("create_doctor",create_doctor);
404 461 //建档日期
405   - map.put("this_date", null!=model.getBuildDate()?DateUtil.getyyyy_MM_dd_hms(model.getBuildDate()):null);
  462 + map.put("this_date", null!=model.getBuildDate()?DateUtil.getyyyy_MM_dd_hms(model.getBuildDate()):DateUtil.getyyyy_MM_dd_hms(new Date()));
406 463 //母亲姓名
407   - map.put("mother_name", StringUtils.isNotEmpty(model.getMname())?model.getMname():"");
  464 + map.put("mother_name", StringUtils.isNotEmpty(model.getMname())?model.getMname():"/");
408 465 //母亲证件类型(lyms_basicconfig表中查"parentId": "c914bb2e-1825-4036-8a41-fe617c90d405")
409 466 String mother_credentials_type_code="99";
410 467 if(StringUtils.isNotEmpty(model.getMcertTypeId())){
411 468  
412 469  
413 470  
414 471  
415 472  
... ... @@ -425,21 +482,21 @@
425 482 }
426 483 map.put("mother_credentials_type_code", mother_credentials_type_code);
427 484 //母亲其他证件名称
428   - map.put("mother_other_credentials_type", "");
  485 + map.put("mother_other_credentials_type", "/");
429 486 //母亲证件号码
430   - map.put("mother_credentials_number", StringUtils.isNotEmpty(model.getMcertNo())?model.getMcertNo():"");
  487 + map.put("mother_credentials_number", StringUtils.isNotEmpty(model.getMcertNo())?model.getMcertNo():"/");
431 488 //出生人口编码
432   - map.put("childbirth_code", "");
  489 + map.put("childbirth_code", "/");
433 490 //录入系统时间
434   - map.put("entering_time", null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):null);
  491 + map.put("entering_time", null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
435 492 //所属机构编码
436   - String organ_id="";
  493 + String organ_id="/";
437 494 if(StringUtils.isNotEmpty(model.getHospitalId())){
438 495 organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
439 496 }
440 497 map.put("organ_id", organ_id);
441   - //现住址国家区划编码(取 县/区 级的编码) 分别两个地址获取,谁有用谁
442   - String areaName="";
  498 + //现住址国家区划编码(取 县/区 级的编码) 分别两个地址获取,谁不是空用谁
  499 + String areaName="/";
443 500 if(StringUtils.isNotEmpty(model.getAreaId())){
444 501 areaName=CommonsHelper.getName1(model.getAreaId(), basicConfigService);
445 502 }
446 503  
... ... @@ -448,9 +505,9 @@
448 505 }
449 506 map.put("district_nation_code", organizationService.getAreaCode(areaName));
450 507 //母亲姓名简拼
451   - map.put("mother_en_name", "");
  508 + map.put("mother_en_name", "/");
452 509 //导入时间(存入数据)
453   -// map.put("import_time", "");
  510 +// map.put("import_time", null);
454 511 //修改时间
455 512 map.put("last_modified_time", null);
456 513 //删除状态 0正常,1删除
457 514  
458 515  
459 516  
... ... @@ -489,13 +546,13 @@
489 546 //id
490 547 map.put("id",patients.getId());
491 548 //档案状态
492   - map.put("file_status_code", null!=patients.getType()?(patients.getType()==1?"1":"2"):"");
  549 + map.put("file_status_code", null!=patients.getType()?(patients.getType()==1?"1":"2"):"/");
493 550 //末次月经
494   - map.put("last_menstrual_period", patients.getLastMenses());
  551 + map.put("last_menstrual_period",null!=patients.getLastMenses()?DateUtil.getyyyy_MM_dd(patients.getLastMenses()):DateUtil.getyyyy_MM_dd(new Date()));
495 552 //预产期
496   - map.put("expected_date", patients.getDueDate());
  553 + map.put("expected_date", null!=patients.getDueDate()?DateUtil.getyyyy_MM_dd(patients.getDueDate()):DateUtil.getyyyy_MM_dd(new Date()));
497 554 //建档医生
498   - String doctor_name="";
  555 + String doctor_name="/";
499 556 if(StringUtils.isNotEmpty(patients.getBookbuildingDoctor())) {
500 557 Users user = usersService.getUsers(Integer.parseInt(patients.getBookbuildingDoctor()));
501 558 if (null!=user && StringUtils.isNotEmpty(user.getName())) {
502 559  
503 560  
504 561  
505 562  
506 563  
507 564  
... ... @@ -512,21 +569,30 @@
512 569 //结案时间
513 570 map.put("close_date", null);
514 571 //结案原因
515   - map.put("close_reason_code", "");
  572 + map.put("close_reason_code", "/");
516 573 //结案原因-其它
517   - map.put("close_reason_detailed", "");
  574 + map.put("close_reason_detailed", "/");
518 575 //母子保健卡号
519   - map.put("health_card_number", "");
  576 + map.put("health_card_number", "/");
520 577 //姓名
521   - map.put("mother_name", patients.getUsername());
  578 + map.put("mother_name", StringUtils.isNotEmpty(patients.getUsername())?patients.getUsername():"/");
522 579 //年龄
523   - map.put("mother_age", patients.getAge());
  580 + Integer mother_age=patients.getAge();
  581 + if(null==mother_age){
  582 + if(StringUtils.isNotEmpty(patients.getCardNo())){
  583 + //用身份证获取
  584 + mother_age=DateUtil.getAgeForIdcard(patients.getCardNo());
  585 + }else {
  586 + mother_age=0;
  587 + }
  588 + }
  589 + map.put("mother_age", mother_age);
524 590 //国籍
525 591 String gj= CdGwPcountryEnums.getId(getBasicConfig(patients.getPcountryId()));
526   - map.put("mother_nationality_code", gj);
  592 + map.put("mother_nationality_code", StringUtils.isNotEmpty(gj)?gj:"156");
527 593 //民族
528 594 String mz=NationEnums.getId(getBasicConfig(patients.getPnationId()));
529   - map.put("mother_nation_code", mz);
  595 + map.put("mother_nation_code", StringUtils.isNotEmpty(mz)?mz:"99");
530 596 //母亲现住址标识,母亲现住址区划编码(居委会/村)取 县/区 级的编码
531 597 String areaRegisterName="";
532 598 if(StringUtils.isNotEmpty(patients.getAreaRegisterId())){
... ... @@ -543,8 +609,14 @@
543 609 map.put("mother_address_id", organizationService.getAreaCode(areaName));
544 610 //母亲户籍地址--详情部分
545 611 map.put("mother_address_detail", patients.getAddress());
546   - //母亲地址(出生证明母亲地址)?????
547   - map.put("mother_address", "");
  612 + //母亲地址(出生证明母亲地址) 获取母亲 户籍地址,没有 就/
  613 + String mother_address="/";
  614 + if(StringUtils.isNotEmpty(patients.getProvinceId()) && StringUtils.isNotEmpty(patients.getCityId()) &&
  615 + StringUtils.isNotEmpty(patients.getAreaId()) && StringUtils.isNotEmpty(patients.getStreetId()) &&
  616 + StringUtils.isNotEmpty(patients.getAddress())){
  617 + mother_address= CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService);
  618 + }
  619 + map.put("mother_address", mother_address);
548 620 //证件类型(lyms_basicconfig表中查"parentId": "c914bb2e-1825-4036-8a41-fe617c90d405")
549 621 String mother_credentials_type_code="99";
550 622 if(StringUtils.isNotEmpty(patients.getPcerteTypeId())){
551 623  
552 624  
553 625  
554 626  
555 627  
... ... @@ -565,19 +637,28 @@
565 637 }
566 638 map.put("mother_credentials_type_code", mother_credentials_type_code);
567 639 //其他证件名称
568   - map.put("mother_other_credentials_type", "");
  640 + map.put("mother_other_credentials_type", "/");
569 641 //有效身份证件号码
570   - map.put("mother_credentials_number", patients.getCardNo());
  642 + map.put("mother_credentials_number", StringUtils.isNotEmpty(patients.getCardNo())?patients.getCardNo():"/");
571 643 //丈夫姓名
572   - map.put("father_name", patients.getHusbandName());
  644 + map.put("father_name", StringUtils.isNotEmpty(patients.getHusbandName())?patients.getHusbandName():"/");
573 645 //丈夫年龄
574   - map.put("father_age", DateUtil.getAge(patients.getHusbandBirth()));
  646 + Integer father_age=DateUtil.getAge(patients.getHusbandBirth());
  647 + if(null==father_age){
  648 + if(StringUtils.isNotEmpty(patients.getHcertificateNum())){
  649 + //用身份证获取
  650 + father_age=DateUtil.getAgeForIdcard(patients.getHcertificateNum());
  651 + }else {
  652 + father_age=0;
  653 + }
  654 + }
  655 + map.put("father_age", father_age);
575 656 //丈夫国籍
576 657 String hgj= CdGwPcountryEnums.getId(getBasicConfig(patients.getHcountryId()));
577   - map.put("father_nationality_code", hgj);
  658 + map.put("father_nationality_code", StringUtils.isNotEmpty(hgj)?hgj:"156");
578 659 //丈夫民族
579 660 String hmz=NationEnums.getId(getBasicConfig(patients.getHnationId()));
580   - map.put("father_nation_code", hmz);
  661 + map.put("father_nation_code", StringUtils.isNotEmpty(hmz)?hmz:"99");
581 662 //丈夫现住址标识,丈夫现住址区划编码(居委会/村)取 县/区 级的编码
582 663 String hareaName="";
583 664 if(StringUtils.isNotEmpty(patients.getHareaId())){
... ... @@ -593,9 +674,15 @@
593 674 }
594 675 map.put("father_address_id", organizationService.getAreaCode(hareaRegisterName));
595 676 //丈夫户籍地址--详情部分
596   - map.put("father_address_detail", patients.getHaddressRegister());
597   - //父亲地址(出生证明父亲地址)?????
598   - map.put("father_address", "");
  677 + map.put("father_address_detail", StringUtils.isNotEmpty(patients.getHaddressRegister())?patients.getHaddressRegister():"/");
  678 + //父亲地址(出生证明母亲地址) 获取父亲 户籍地址,没有 就/
  679 + String father_address="/";
  680 + if(StringUtils.isNotEmpty(patients.getHprovinceRegisterId()) && StringUtils.isNotEmpty(patients.getHcityRegisterId()) &&
  681 + StringUtils.isNotEmpty(patients.getHareaRegisterId()) && StringUtils.isNotEmpty(patients.getHstreetRegisterId()) &&
  682 + StringUtils.isNotEmpty(patients.getHaddressRegister())){
  683 + father_address= CommonsHelper.getResidence(patients.getHprovinceRegisterId(), patients.getHcityRegisterId(), patients.getHareaRegisterId(), patients.getHstreetRegisterId(), patients.getHaddressRegister(), basicConfigService);
  684 + }
  685 + map.put("father_address", father_address);
599 686 //丈夫证件类型(lyms_basicconfig表中查"parentId": "c914bb2e-1825-4036-8a41-fe617c90d405")
600 687 String father_credentials_type_code="99";
601 688 if(StringUtils.isNotEmpty(patients.getHcertificateTypeId())){
602 689  
603 690  
604 691  
605 692  
606 693  
607 694  
608 695  
609 696  
610 697  
611 698  
612 699  
... ... @@ -616,33 +703,33 @@
616 703 }
617 704 map.put("father_credentials_type_code", father_credentials_type_code);
618 705 //丈夫其他证件名称
619   - map.put("father_other_credentials_type", "");
  706 + map.put("father_other_credentials_type", "/");
620 707 //丈夫有效身份证件号码
621   - map.put("father_credentials_number", patients.getHcertificateNum());
  708 + map.put("father_credentials_number", StringUtils.isNotEmpty(patients.getHcertificateNum())?patients.getHcertificateNum():"/");
622 709 //手机号码
623   - map.put("phone", patients.getHusbandPhone());
  710 + map.put("phone", StringUtils.isNotEmpty(patients.getHusbandPhone())?patients.getHusbandPhone():"/");
624 711 //是否高危
625   - map.put("is_high_risk", "");
  712 + map.put("is_high_risk", "/");
626 713 //是否早孕建档
627   - map.put("is_early_pregnancy", "");
  714 + map.put("is_early_pregnancy", "/");
628 715 //是否已打印出生证明
629   - map.put("is_birth_certificate", "");
  716 + map.put("is_birth_certificate", "/");
630 717 //录入系统时间
631   - map.put("entering_time", DateUtil.getyyyy_MM_dd_hms(patients.getCreated()));
  718 + map.put("entering_time", null!=patients.getCreated()?DateUtil.getyyyy_MM_dd_hms(patients.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
632 719 //是否未提供男方信息(建档时是否未提供男方信息)
633   - map.put("not_provided_father_info", null!=patients.getReqHusband()?(patients.getReqHusband()?false:true):null);
  720 + map.put("not_provided_father_info", null!=patients.getReqHusband()?(patients.getReqHusband()?false:true):false);
634 721 //丈夫电话
635   - map.put("father_phone", "");
  722 + map.put("father_phone", "/");
636 723 //建档日期
637   - map.put("this_date", DateUtil.getyyyy_MM_dd_hms(patients.getBookbuildingDate()));
  724 + map.put("this_date",null!=patients.getBookbuildingDate()?DateUtil.getyyyy_MM_dd_hms(patients.getBookbuildingDate()):DateUtil.getyyyy_MM_dd_hms(new Date()));
638 725 //所属机构编码
639   - String organ_id="";
  726 + String organ_id="/";
640 727 if(StringUtils.isNotEmpty(patients.getHospitalId())){
641 728 organ_id =organizationService.getPlatHosNewCode(patients.getHospitalId());
642 729 }
643 730 map.put("organ_id", organ_id);
644 731 //关联妇女档id
645   - String person_id="";
  732 + String person_id="/";
646 733 if(StringUtils.isNotEmpty(patients.getCardNo())){
647 734 ResidentsArchiveQuery query = new ResidentsArchiveQuery();
648 735 query.setYn(YnEnums.YES.getId());
649 736  
... ... @@ -654,9 +741,9 @@
654 741 }
655 742 map.put("person_id", person_id);
656 743 //导入时间
657   -// map.put("import_time", "");
  744 +// map.put("import_time", null);
658 745 //修改时间
659   -// map.put("last_modified_time", "");
  746 + map.put("last_modified_time", null);
660 747 //删除状态
661 748 map.put("is_deleted", "0");
662 749 //删除时间
... ... @@ -667,6 +754,240 @@
667 754 e.printStackTrace();
668 755 }
669 756 }
  757 +
  758 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  759 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  760 + objectResponse.setErrormsg("成功");
  761 + objectResponse.setData(data);
  762 + return objectResponse;
  763 + }
  764 +
  765 + public BaseObjectResponse getMsgcC301(String startDate, String endDate) {
  766 +
  767 + Query query=new Query();
  768 + query.addCriteria(Criteria.where("yn").is(1));
  769 + if(StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)){
  770 + query.addCriteria(Criteria.where("dueDate1").gte(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate)))
  771 + .lte(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate))));
  772 + }else {
  773 + //当天的数据
  774 + query.addCriteria(Criteria.where("dueDate1").gte(DateUtil.getDayFirstSecond(new Date()))
  775 + .lte(DateUtil.getDayLastSecond(new Date())));
  776 + }
  777 + List<MaternalDeliverModel> fmList = mongoTemplate.find(query, MaternalDeliverModel.class);
  778 + List<Map> data = new ArrayList<>();
  779 + for (MaternalDeliverModel model : fmList) {
  780 + try {
  781 + Map map=new HashMap();
  782 + //id
  783 + map.put("id", StringUtils.isNotEmpty(model.getId())?model.getId():"/");
  784 + //分娩日期
  785 + map.put("this_date", null!=model.getDueDate1()?DateUtil.getyyyy_MM_dd_hms(model.getDueDate1()):DateUtil.getyyyy_MM_dd_hms(new Date()));
  786 + //住院病历号
  787 + map.put("medical_record_number", StringUtils.isNotEmpty(model.getInHospitalNo())?model.getInHospitalNo():"/");
  788 + //分娩时孕周
  789 + Integer week_num=0;
  790 + if(StringUtils.isNotEmpty(model.getDueWeek())){
  791 + String[] week = model.getDueWeek().split("周");
  792 + if (NumberUtils.isNumber(week[0])) {
  793 + week_num=Integer.parseInt(week[0]);
  794 + }
  795 + }
  796 + map.put("week_num",week_num);
  797 + //分娩时孕天
  798 + Integer day_num=0;
  799 + if(StringUtils.isNotEmpty(model.getDueWeek())){
  800 + String[] week = model.getDueWeek().split("[+]");
  801 + if (week.length==2 && NumberUtils.isNumber(week[1].substring(0,week[1].length()-1))) {
  802 + day_num=Integer.parseInt(week[1].substring(0,week[1].length()-1));
  803 + }
  804 + }
  805 + map.put("day_num", day_num);
  806 + //分娩方式
  807 + String birth_fashion_code = "6";
  808 + if (StringUtils.isNotEmpty(model.getDeliveryMode())) {
  809 + Map m = JsonUtil.str2Obj(model.getDeliveryMode(), Map.class);
  810 + if (m != null) {
  811 + Object b = m.get("fmfs");
  812 + if (b != null) {
  813 + switch (b.toString()) {
  814 + case "1":
  815 + birth_fashion_code = "1";
  816 + break;
  817 + case "2":
  818 + birth_fashion_code = "5";
  819 + break;
  820 + }
  821 + }
  822 + }
  823 + }
  824 + map.put("birth_fashion_code", birth_fashion_code);
  825 + //产程Ⅰ(小时)
  826 + map.put("production_process_one_hour", null);
  827 + //产程Ⅰ(分钟)
  828 + map.put("production_process_one_minute", null);
  829 + //产程Ⅱ(小时)
  830 + map.put("production_process_tow_hour", null);
  831 + //产程Ⅱ(分钟)
  832 + map.put("production_process_tow_minute", null);
  833 + //产程Ⅲ(小时)
  834 + map.put("production_process_three_hour", null);
  835 + //产程Ⅲ(分钟)
  836 + map.put("production_process_threeminute", null);
  837 + //总产程(小时)
  838 + map.put("production_process_total_hour", null);
  839 + //总产程(分钟)
  840 + map.put("production_process_totalminute", null);
  841 + //产后血压高压
  842 + map.put("blood_pressure_high", null);
  843 + //产后血压低压
  844 + map.put("blood_pressure_low", null);
  845 + //产后2小时血压高压
  846 + map.put("blood_pressure_secondhour_high", null);
  847 + //产后2小时血压低压
  848 + map.put("blood_pressure_second_hour_low", null);
  849 + //呼吸(次/分)
  850 + map.put("breathing_rate", null);
  851 + //脉搏(次/分)
  852 + map.put("pulse_rate", null);
  853 + //产时出血量(ml)
  854 + map.put("bleeding_amount_first_hour", null);
  855 + //产后2小时出血量(ml)
  856 + map.put("bleeding_amount_second_hour", null);
  857 + //总出血量
  858 + map.put("bleeding_amount_total", null);
  859 + //会阴情况
  860 + map.put("perineal_condition_code", "/");
  861 + //撕裂Ⅰ°
  862 + map.put("perineal_tearing_one", "/");
  863 + //撕裂Ⅱ°
  864 + map.put("perineal_tearing_two", "/");
  865 + //撕裂Ⅲ°
  866 + map.put("perineal_tearing_three", "/");
  867 + //撕裂缝线
  868 + map.put("perineal_tearing_suture", "/");
  869 + //新生儿情况
  870 + String neonatal_condition_code="/";
  871 + if (null!=model.getTireNumber()) {
  872 + switch (model.getTireNumber()){
  873 + case 1:
  874 + neonatal_condition_code="1";
  875 + break;
  876 + case 2:
  877 + neonatal_condition_code="2";
  878 + break;
  879 + default:
  880 + neonatal_condition_code="3";
  881 + }
  882 + }
  883 + map.put("neonatal_condition_code", neonatal_condition_code);
  884 + //畸形详细
  885 + map.put("malformation_detailed", "/");
  886 + //新生儿情况其它
  887 + map.put("neonatal_condition_other", "/");
  888 + //出院时间
  889 + map.put("out_time", null);
  890 + //分娩医院名称
  891 + String birth_hospital_name = couponMapper.findHospitalNameById(model.getFmHospital());
  892 + map.put("birth_hospital_name", StringUtils.isNotEmpty(birth_hospital_name)?birth_hospital_name:"/");
  893 + //接生者(接生医生)
  894 + String mid_wife="/";
  895 + if(StringUtils.isNotEmpty(model.getDeliverDoctor())) {
  896 + Users user = usersService.getUsers(Integer.parseInt(model.getDeliverDoctor()));
  897 + if (null!=user && StringUtils.isNotEmpty(user.getName())) {
  898 + mid_wife=user.getName();
  899 + }
  900 + }
  901 + map.put("mid_wife", mid_wife);
  902 + //产妇状态
  903 + String maternal_state_code=model.getMaternalInfo();
  904 + map.put("maternal_state_code", StringUtils.isNotEmpty(maternal_state_code)?maternal_state_code:"/");
  905 + //产时并发症
  906 + map.put("obstetric_morbidity_code", "/");
  907 + //产时并发症--详述
  908 + map.put("obstetric_morbidity_contents", "/");
  909 + //开奶时间
  910 + map.put("milk_open_time", null);
  911 + //分娩机构(分娩医疗机构统一社会信用代码)
  912 + String delivery_institution_id="/";
  913 + if(StringUtils.isNotEmpty(model.getFmHospital())){
  914 + delivery_institution_id =organizationService.getPlatHosNewCode(model.getFmHospital());
  915 + }
  916 + map.put("delivery_institution_id", delivery_institution_id);
  917 + //录入系统时间
  918 + map.put("entering_time", null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
  919 + //所属机构编码(所属医疗机构统一社会信用代码)
  920 + String organ_id="/";
  921 + if(StringUtils.isNotEmpty(model.getHospitalId())){
  922 + organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
  923 + }
  924 + map.put("organ_id", organ_id);
  925 + //关联妇女档id
  926 + String person_id="/";
  927 + if(StringUtils.isNotEmpty(model.getParentId())){
  928 + Patients patients = patientsService.findOnePatientById(model.getParentId());
  929 + if(null!=patients && StringUtils.isNotEmpty(patients.getCardNo())) {
  930 + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery();
  931 + archiveQuery.setYn(YnEnums.YES.getId());
  932 + archiveQuery.setCertificateNum(patients.getCardNo());
  933 + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(archiveQuery);
  934 + if (CollectionUtils.isNotEmpty(modelList)) {
  935 + person_id = modelList.get(0).getId();
  936 + }
  937 + }
  938 + }
  939 + map.put("person_id", person_id);
  940 + //关联专档id
  941 + map.put("file_id", StringUtils.isNotEmpty(model.getParentId())?model.getParentId():"/");
  942 + //导入时间
  943 +// map.put("import_time", null);
  944 + //修改时间
  945 + map.put("last_modified_time", null);
  946 + //删除状态
  947 + map.put("is_deleted", "0");
  948 + //删除时间
  949 + map.put("deleted_time", null);
  950 +
  951 + data.add(map);
  952 + } catch (Exception e) {
  953 + e.printStackTrace();
  954 + }
  955 + }
  956 +
  957 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  958 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  959 + objectResponse.setErrormsg("成功");
  960 + objectResponse.setData(data);
  961 + return objectResponse;
  962 + }
  963 +
  964 + public BaseObjectResponse getMsgcC401(String startDate, String endDate) {
  965 +
  966 + Query query=new Query();
  967 + query.addCriteria(Criteria.where("yn").is(1));
  968 + if(StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)){
  969 + query.addCriteria(Criteria.where("dueDate1").gte(DateUtil.getDayFirstSecond(DateUtil.parseYMD(startDate)))
  970 + .lte(DateUtil.getDayLastSecond(DateUtil.parseYMD(endDate))));
  971 + }else {
  972 + //当天的数据
  973 + query.addCriteria(Criteria.where("dueDate1").gte(DateUtil.getDayFirstSecond(new Date()))
  974 + .lte(DateUtil.getDayLastSecond(new Date())));
  975 + }
  976 + List<MaternalDeliverModel> fmList = mongoTemplate.find(query, MaternalDeliverModel.class);
  977 + List<Map> data = new ArrayList<>();
  978 + for (MaternalDeliverModel model : fmList) {
  979 + try {
  980 + Map map=new HashMap();
  981 +
  982 +
  983 +
  984 +
  985 + data.add(map);
  986 + } catch (Exception e) {
  987 + e.printStackTrace();
  988 + }
  989 + }
  990 +
670 991  
671 992 BaseObjectResponse objectResponse = new BaseObjectResponse();
672 993 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);