Commit 17f7a5e85f2234503b6ae22ad966a73cf3ac7ede
1 parent
e33f8ff32b
Exists in
master
完成接口(简单对接版):孕妇建档,身份证查询历史建档信息,ID查询建档详情;封装新旧系统字段映射工具
Showing 14 changed files with 1017 additions and 153 deletions
- parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java
- parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml
- parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java
- parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java
- parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java
- parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java
- parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java
- parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java
- parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java
- parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java
- parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java
View file @
17f7a5e
| ... | ... | @@ -2,8 +2,13 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.hospital.entity.woman.WomanFetationRecord; |
| 4 | 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| 5 | + | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 5 | 7 | import org.springframework.stereotype.Repository; |
| 6 | 8 | import java.io.Serializable; |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 7 | 12 | /** |
| 8 | 13 | * <p> |
| 9 | 14 | * Mapper接口 |
| ... | ... | @@ -15,7 +20,21 @@ |
| 15 | 20 | @Repository |
| 16 | 21 | public interface WomanFetationRecordMapper extends BaseMapper<WomanFetationRecord> { |
| 17 | 22 | |
| 18 | - public Integer deleteLogicById(Serializable id); | |
| 23 | + public Integer deleteLogicById(Serializable id); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * <li>@Description:查询-查询历史建档记录(by证件信息和就诊卡号) | |
| 27 | + * <li>@param cardType | |
| 28 | + * <li>@param cardNo | |
| 29 | + * <li>@param vcCardNo | |
| 30 | + * <li>@return | |
| 31 | + * <li>创建人:xujiahong | |
| 32 | + * <li>创建时间:2017年4月20日 | |
| 33 | + * <li>修改人: | |
| 34 | + * <li>修改时间: | |
| 35 | + */ | |
| 36 | + public List<Map<String, Object>> selectHistory(@Param("cardType") String cardType, @Param("cardNo") String cardNo, | |
| 37 | + @Param("vcCardNo") String vcCardNo); | |
| 19 | 38 | |
| 20 | 39 | } |
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml
View file @
17f7a5e
| ... | ... | @@ -62,5 +62,25 @@ |
| 62 | 62 | <sql id="Base_Column_List"> |
| 63 | 63 | ID AS id, BASE_WOMAN_NAME AS baseWomanName, BASE_PAPERS_TYPE AS basePapersType, BASE_PAPERS_NUMBER AS basePapersNumber, BASE_WOMAN_COUNTRY AS baseWomanCountry, BASE_WOMAN_NATION AS baseWomanNation, BASE_WOMAN_BIRTH AS baseWomanBirth, BASE_REGISTER_TYPE AS baseRegisterType, BASE_DWELL_TYPE AS baseDwellType, BASE_OCCUPATION_TYPE AS baseOccupationType, BASE_WOMAN_CULTURE AS baseWomanCulture, BASE_FAMILY_INCOME AS baseFamilyIncome, CONTACT_WOMAN_WAY AS contactWomanWay, CONTACT_WORK_ADDRESS AS contactWorkAddress, CONTACT_DWELL_PROVINCE AS contactDwellProvince, CONTACT_DWELL_CITY AS contactDwellCity, CONTACT_DWELL_AREA AS contactDwellArea, CONTACT_DWELL_STREET AS contactDwellStreet, CONTACT_DWELL_DETAIL AS contactDwellDetail, CONTACT_REGISTER_PROVINCE AS contactRegisterProvince, CONTACT_REGISTER_CITY AS contactRegisterCity, CONTACT_REGISTER_AREA AS contactRegisterArea, CONTACT_REGISTER_STREET AS contactRegisterStreet, CONTACT_REGISTER_DETAIL AS contactRegisterDetail, CONTACT_POSTPARTUM_PROVINCE AS contactPostpartumProvince, CONTACT_POSTPARTUM_CITY AS contactPostpartumCity, CONTACT_POSTPARTUM_AREA AS contactPostpartumArea, CONTACT_POSTPARTUM_STREET AS contactPostpartumStreet, CONTACT_POSTPARTUM_DETAIL AS contactPostpartumDetail, HOSPITAL_LAST_MENSTRUATION AS hospitalLastMenstruation, HOSPITAL_CORRECT_LAST_MENSTRUATION AS hospitalCorrectLastMenstruation, HOSPITAL_EXPECTED_DATE AS hospitalExpectedDate, HOSPITAL_PATIENT_CARD AS hospitalPatientCard, HOSPITAL_BARCODE AS hospitalBarcode, HOSPITAL_RECORD_NUMBER AS hospitalRecordNumber, HOSPITAL_SERVICE_TYPE AS hospitalServiceType, HOSPITAL_SERVICE_STATUS AS hospitalServiceStatus, HOSPITAL_MEMBER AS hospitalMember, HOSPITAL_RECORD_DOCTOR AS hospitalRecordDoctor, HOSPITAL_RECORD_DATE AS hospitalRecordDate, HOSPITAL_RECORD_REMARK AS hospitalRecordRemark, HOSPITAL_MEMBER_DATE AS hospitalMemberDate, BUILD_DATE AS buildDate, HOSTPITAL_ID AS hostpitalId, BUILD_TYPE AS buildType, CREATE_ID AS createId, CREATE_TIME AS createTime, MODIFY_ID AS modifyId, MODIFY_TIME AS modifyTime, IFDEL AS ifdel, ENALBLE AS enalble, WOMAN_PERSON_ID AS womanPersonId |
| 64 | 64 | </sql> |
| 65 | + | |
| 66 | + <select id="selectHistory" resultType="map"> | |
| 67 | + SELECT wf.HOSPITAL_RECORD_DATE AS bookbuildDate,org.`NAME` AS bookbuildHospital, | |
| 68 | + wf.`HOSTPITAL_ID` AS hospitalId,wf.`ID` AS id | |
| 69 | + FROM WOMAN_FETATION_RECORD wf | |
| 70 | + INNER JOIN SYS_ORGANIZATIONS org ON wf.`HOSTPITAL_ID`=org.`ID` | |
| 71 | + <where> | |
| 72 | + <if test="cardType!=null"> | |
| 73 | + AND wf.BASE_PAPERS_TYPE=#{cardType} | |
| 74 | + </if> | |
| 75 | + <if test="cardNo!=null"> | |
| 76 | + AND wf.BASE_PAPERS_NUMBER=#{cardNo} | |
| 77 | + </if> | |
| 78 | + <if test="vcCardNo!=null"> | |
| 79 | + AND wf.HOSPITAL_PATIENT_CARD = #{vcCardNo} | |
| 80 | + </if> | |
| 81 | + </where> | |
| 82 | + ORDER BY wf.HOSPITAL_RECORD_DATE DESC | |
| 83 | + </select> | |
| 84 | + | |
| 65 | 85 | </mapper> |
parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java
View file @
17f7a5e
| ... | ... | @@ -50,11 +50,6 @@ |
| 50 | 50 | @TableField(value="BASE_WOMAN_NATION") |
| 51 | 51 | private String baseWomanNation; |
| 52 | 52 | /** |
| 53 | - * 孕妇出生 | |
| 54 | - */ | |
| 55 | - @TableField(value="BASE_WOMAN_BIRTH") | |
| 56 | - private Date baseWomanBirth; | |
| 57 | - /** | |
| 58 | 53 | * 户籍类型 |
| 59 | 54 | */ |
| 60 | 55 | @TableField(value="BASE_REGISTER_TYPE") |
| 61 | 56 | |
| ... | ... | @@ -164,22 +159,8 @@ |
| 164 | 159 | */ |
| 165 | 160 | @TableField(value="CONTACT_POSTPARTUM_DETAIL") |
| 166 | 161 | private String contactPostpartumDetail; |
| 162 | + | |
| 167 | 163 | /** |
| 168 | - * 末次月经 | |
| 169 | - */ | |
| 170 | - @TableField(value="HOSPITAL_LAST_MENSTRUATION") | |
| 171 | - private Date hospitalLastMenstruation; | |
| 172 | - /** | |
| 173 | - * 纠正末次月经 | |
| 174 | - */ | |
| 175 | - @TableField(value="HOSPITAL_CORRECT_LAST_MENSTRUATION") | |
| 176 | - private Date hospitalCorrectLastMenstruation; | |
| 177 | - /** | |
| 178 | - * 预产期 | |
| 179 | - */ | |
| 180 | - @TableField(value="HOSPITAL_EXPECTED_DATE") | |
| 181 | - private Date hospitalExpectedDate; | |
| 182 | - /** | |
| 183 | 164 | * 就诊卡 |
| 184 | 165 | */ |
| 185 | 166 | @TableField(value="HOSPITAL_PATIENT_CARD") |
| 186 | 167 | |
| ... | ... | @@ -214,12 +195,8 @@ |
| 214 | 195 | */ |
| 215 | 196 | @TableField(value="HOSPITAL_RECORD_DOCTOR") |
| 216 | 197 | private String hospitalRecordDoctor; |
| 198 | + | |
| 217 | 199 | /** |
| 218 | - * 建档日期 | |
| 219 | - */ | |
| 220 | - @TableField(value="HOSPITAL_RECORD_DATE") | |
| 221 | - private Date hospitalRecordDate; | |
| 222 | - /** | |
| 223 | 200 | * 档案备注 |
| 224 | 201 | */ |
| 225 | 202 | @TableField(value="HOSPITAL_RECORD_REMARK") |
| 226 | 203 | |
| 227 | 204 | |
| ... | ... | @@ -279,9 +256,46 @@ |
| 279 | 256 | */ |
| 280 | 257 | @TableField(value="WOMAN_PERSON_ID") |
| 281 | 258 | private String womanPersonId; |
| 282 | - | |
| 283 | 259 | |
| 260 | + | |
| 261 | + /** | |
| 262 | + * 孕妇出生============================================================================ | |
| 263 | + */ | |
| 264 | + @TableField(value="BASE_WOMAN_BIRTH") | |
| 265 | + private Date baseWomanBirth; | |
| 266 | + /** | |
| 267 | + * 末次月经 | |
| 268 | + */ | |
| 269 | + @TableField(value="HOSPITAL_LAST_MENSTRUATION") | |
| 270 | + private Date hospitalLastMenstruation; | |
| 271 | + /** | |
| 272 | + * 纠正末次月经 | |
| 273 | + */ | |
| 274 | + @TableField(value="HOSPITAL_CORRECT_LAST_MENSTRUATION") | |
| 275 | + private Date hospitalCorrectLastMenstruation; | |
| 276 | + /** | |
| 277 | + * 预产期 | |
| 278 | + */ | |
| 279 | + @TableField(value="HOSPITAL_EXPECTED_DATE") | |
| 280 | + private Date hospitalExpectedDate; | |
| 281 | + /** | |
| 282 | + * 建档日期 | |
| 283 | + */ | |
| 284 | + @TableField(value="HOSPITAL_RECORD_DATE") | |
| 285 | + private Date hospitalRecordDate; | |
| 284 | 286 | |
| 287 | + //格式化字段 | |
| 288 | + @TableField(exist=false) | |
| 289 | + private String baseWomanBirthStr;//孕妇生日Str | |
| 290 | + @TableField(exist=false) | |
| 291 | + private String hospitalLastMenstruationStr;//末次月经Str | |
| 292 | + @TableField(exist=false) | |
| 293 | + private String hospitalCorrectLastMenstruationStr;//纠正末次月经Str | |
| 294 | + @TableField(exist=false) | |
| 295 | + private String hospitalExpectedDateStr;//预产期Str | |
| 296 | + @TableField(exist=false) | |
| 297 | + private String hospitalRecordDateStr;//建档日期Str | |
| 298 | + | |
| 285 | 299 | public String getId() { |
| 286 | 300 | return id; |
| 287 | 301 | } |
| ... | ... | @@ -330,14 +344,6 @@ |
| 330 | 344 | this.baseWomanNation = baseWomanNation; |
| 331 | 345 | } |
| 332 | 346 | |
| 333 | - public Date getBaseWomanBirth() { | |
| 334 | - return baseWomanBirth; | |
| 335 | - } | |
| 336 | - | |
| 337 | - public void setBaseWomanBirth(Date baseWomanBirth) { | |
| 338 | - this.baseWomanBirth = baseWomanBirth; | |
| 339 | - } | |
| 340 | - | |
| 341 | 347 | public String getBaseRegisterType() { |
| 342 | 348 | return baseRegisterType; |
| 343 | 349 | } |
| ... | ... | @@ -514,30 +520,6 @@ |
| 514 | 520 | this.contactPostpartumDetail = contactPostpartumDetail; |
| 515 | 521 | } |
| 516 | 522 | |
| 517 | - public Date getHospitalLastMenstruation() { | |
| 518 | - return hospitalLastMenstruation; | |
| 519 | - } | |
| 520 | - | |
| 521 | - public void setHospitalLastMenstruation(Date hospitalLastMenstruation) { | |
| 522 | - this.hospitalLastMenstruation = hospitalLastMenstruation; | |
| 523 | - } | |
| 524 | - | |
| 525 | - public Date getHospitalCorrectLastMenstruation() { | |
| 526 | - return hospitalCorrectLastMenstruation; | |
| 527 | - } | |
| 528 | - | |
| 529 | - public void setHospitalCorrectLastMenstruation(Date hospitalCorrectLastMenstruation) { | |
| 530 | - this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; | |
| 531 | - } | |
| 532 | - | |
| 533 | - public Date getHospitalExpectedDate() { | |
| 534 | - return hospitalExpectedDate; | |
| 535 | - } | |
| 536 | - | |
| 537 | - public void setHospitalExpectedDate(Date hospitalExpectedDate) { | |
| 538 | - this.hospitalExpectedDate = hospitalExpectedDate; | |
| 539 | - } | |
| 540 | - | |
| 541 | 523 | public String getHospitalPatientCard() { |
| 542 | 524 | return hospitalPatientCard; |
| 543 | 525 | } |
| ... | ... | @@ -594,14 +576,6 @@ |
| 594 | 576 | this.hospitalRecordDoctor = hospitalRecordDoctor; |
| 595 | 577 | } |
| 596 | 578 | |
| 597 | - public Date getHospitalRecordDate() { | |
| 598 | - return hospitalRecordDate; | |
| 599 | - } | |
| 600 | - | |
| 601 | - public void setHospitalRecordDate(Date hospitalRecordDate) { | |
| 602 | - this.hospitalRecordDate = hospitalRecordDate; | |
| 603 | - } | |
| 604 | - | |
| 605 | 579 | public String getHospitalRecordRemark() { |
| 606 | 580 | return hospitalRecordRemark; |
| 607 | 581 | } |
| ... | ... | @@ -697,6 +671,87 @@ |
| 697 | 671 | public void setWomanPersonId(String womanPersonId) { |
| 698 | 672 | this.womanPersonId = womanPersonId; |
| 699 | 673 | } |
| 674 | + | |
| 675 | + //==========================带格式化的字段================================ | |
| 676 | + | |
| 677 | + | |
| 678 | + public Date getBaseWomanBirth() { | |
| 679 | + return baseWomanBirth; | |
| 680 | + } | |
| 681 | + | |
| 682 | + public void setBaseWomanBirth(Date baseWomanBirth) { | |
| 683 | + this.baseWomanBirth = baseWomanBirth; | |
| 684 | + } | |
| 685 | + public Date getHospitalLastMenstruation() { | |
| 686 | + return hospitalLastMenstruation; | |
| 687 | + } | |
| 688 | + | |
| 689 | + public void setHospitalLastMenstruation(Date hospitalLastMenstruation) { | |
| 690 | + this.hospitalLastMenstruation = hospitalLastMenstruation; | |
| 691 | + } | |
| 692 | + | |
| 693 | + public Date getHospitalCorrectLastMenstruation() { | |
| 694 | + return hospitalCorrectLastMenstruation; | |
| 695 | + } | |
| 696 | + | |
| 697 | + public void setHospitalCorrectLastMenstruation(Date hospitalCorrectLastMenstruation) { | |
| 698 | + this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; | |
| 699 | + } | |
| 700 | + | |
| 701 | + public Date getHospitalExpectedDate() { | |
| 702 | + return hospitalExpectedDate; | |
| 703 | + } | |
| 704 | + | |
| 705 | + public void setHospitalExpectedDate(Date hospitalExpectedDate) { | |
| 706 | + this.hospitalExpectedDate = hospitalExpectedDate; | |
| 707 | + } | |
| 708 | + public Date getHospitalRecordDate() { | |
| 709 | + return hospitalRecordDate; | |
| 710 | + } | |
| 711 | + public void setHospitalRecordDate(Date hospitalRecordDate) { | |
| 712 | + this.hospitalRecordDate = hospitalRecordDate; | |
| 713 | + } | |
| 714 | + | |
| 715 | + public String getBaseWomanBirthStr() { | |
| 716 | + return baseWomanBirthStr; | |
| 717 | + } | |
| 718 | + | |
| 719 | + public void setBaseWomanBirthStr(String baseWomanBirthStr) { | |
| 720 | + this.baseWomanBirthStr = baseWomanBirthStr; | |
| 721 | + } | |
| 722 | + | |
| 723 | + public String getHospitalLastMenstruationStr() { | |
| 724 | + return hospitalLastMenstruationStr; | |
| 725 | + } | |
| 726 | + | |
| 727 | + public void setHospitalLastMenstruationStr(String hospitalLastMenstruationStr) { | |
| 728 | + this.hospitalLastMenstruationStr = hospitalLastMenstruationStr; | |
| 729 | + } | |
| 730 | + | |
| 731 | + public String getHospitalCorrectLastMenstruationStr() { | |
| 732 | + return hospitalCorrectLastMenstruationStr; | |
| 733 | + } | |
| 734 | + | |
| 735 | + public void setHospitalCorrectLastMenstruationStr(String hospitalCorrectLastMenstruationStr) { | |
| 736 | + this.hospitalCorrectLastMenstruationStr = hospitalCorrectLastMenstruationStr; | |
| 737 | + } | |
| 738 | + | |
| 739 | + public String getHospitalExpectedDateStr() { | |
| 740 | + return hospitalExpectedDateStr; | |
| 741 | + } | |
| 742 | + | |
| 743 | + public void setHospitalExpectedDateStr(String hospitalExpectedDateStr) { | |
| 744 | + this.hospitalExpectedDateStr = hospitalExpectedDateStr; | |
| 745 | + } | |
| 746 | + | |
| 747 | + public String getHospitalRecordDateStr() { | |
| 748 | + return hospitalRecordDateStr; | |
| 749 | + } | |
| 750 | + | |
| 751 | + public void setHospitalRecordDateStr(String hospitalRecordDateStr) { | |
| 752 | + this.hospitalRecordDateStr = hospitalRecordDateStr; | |
| 753 | + } | |
| 754 | + | |
| 700 | 755 | |
| 701 | 756 | } |
parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java
View file @
17f7a5e
| ... | ... | @@ -134,6 +134,11 @@ |
| 134 | 134 | */ |
| 135 | 135 | @TableField(value="CREATE_TIME") |
| 136 | 136 | private Date createTime; |
| 137 | + | |
| 138 | + //格式化字段 | |
| 139 | + @TableField(exist=false) | |
| 140 | + private String husbandBirthStr; | |
| 141 | + | |
| 137 | 142 | |
| 138 | 143 | |
| 139 | 144 | public String getId() { |
| ... | ... | @@ -311,6 +316,15 @@ |
| 311 | 316 | public void setCreateTime(Date createTime) { |
| 312 | 317 | this.createTime = createTime; |
| 313 | 318 | } |
| 319 | + | |
| 320 | + public String getHusbandBirthStr() { | |
| 321 | + return husbandBirthStr; | |
| 322 | + } | |
| 323 | + | |
| 324 | + public void setHusbandBirthStr(String husbandBirthStr) { | |
| 325 | + this.husbandBirthStr = husbandBirthStr; | |
| 326 | + } | |
| 327 | + | |
| 314 | 328 | |
| 315 | 329 | |
| 316 | 330 |
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java
View file @
17f7a5e
| 1 | 1 | package com.lyms.hospital.service.woman; |
| 2 | 2 | |
| 3 | 3 | import java.io.Serializable; |
| 4 | +import java.util.List; | |
| 4 | 5 | import java.util.Map; |
| 5 | 6 | |
| 6 | 7 | import com.lyms.hospital.entity.woman.WomanFetationRecord; |
| 7 | 8 | |
| 8 | 9 | |
| 9 | 10 | |
| ... | ... | @@ -10,17 +11,30 @@ |
| 10 | 11 | /** |
| 11 | 12 | * <p> |
| 12 | 13 | * 服务类 |
| 13 | - * </p> | |
| 14 | 14 | * (单表)新增-孕妇档案表记录 |
| 15 | - * 查询-根据孕妇建档ID查询表单详情 | |
| 15 | + * 查询-根据孕妇建档ID查询表单详情 | |
| 16 | + * 查询-查询历史建档记录(by证件信息和就诊卡号) | |
| 17 | + * </p> | |
| 16 | 18 | * |
| 17 | 19 | * @author fangcheng,xujiahong |
| 18 | 20 | * @since 2017-03-31 |
| 19 | 21 | */ |
| 20 | 22 | public interface WomanFetationRecordService extends BaseService<WomanFetationRecord> { |
| 21 | - | |
| 22 | - | |
| 23 | + | |
| 23 | 24 | /** |
| 25 | + * <li>@Description:查询-查询历史建档记录(by证件信息和就诊卡号) | |
| 26 | + * <li>@param cardType | |
| 27 | + * <li>@param cardNo | |
| 28 | + * <li>@param vcCardNo | |
| 29 | + * <li>@return | |
| 30 | + * <li>创建人:xujiahong | |
| 31 | + * <li>创建时间:2017年4月20日 | |
| 32 | + * <li>修改人: | |
| 33 | + * <li>修改时间: | |
| 34 | + */ | |
| 35 | + public List<Map<String, Object>> selectHistory(String cardType, String cardNo, String vcCardNo); | |
| 36 | + | |
| 37 | + /** | |
| 24 | 38 | * <li>@Description:查询-根据孕妇建档ID查询表单详情 |
| 25 | 39 | * <li>@return |
| 26 | 40 | * <li>创建人:xujiahong |
| 27 | 41 | |
| 28 | 42 | |
| 29 | 43 | |
| 30 | 44 | |
| ... | ... | @@ -28,63 +42,63 @@ |
| 28 | 42 | * <li>修改人: |
| 29 | 43 | * <li>修改时间: |
| 30 | 44 | */ |
| 31 | - public Map<String,Object> selectWomanFetationMapById(String id); | |
| 45 | + public Map<String, Object> selectWomanFetationMapById(String id); | |
| 32 | 46 | |
| 33 | - /** | |
| 34 | - * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 35 | - * <li>@param id 删除主键id | |
| 36 | - * <li>@return 大于0修改成功,否则为失败 | |
| 37 | - */ | |
| 38 | - public Integer deleteLogicById(Serializable id); | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * <li>@Description:(单表)新增-孕妇档案表记录 | |
| 42 | - * <li>@param womanFetationRecord | |
| 43 | - * <li>@return | |
| 44 | - * <li>创建人:xujiahong | |
| 45 | - * <li>创建时间:2017年4月18日 | |
| 46 | - * <li>修改人: | |
| 47 | - * <li>修改时间: | |
| 48 | - */ | |
| 49 | - public String create(WomanFetationRecord womanFetationRecord); | |
| 47 | + /** | |
| 48 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 49 | + * <li>@param id 删除主键id | |
| 50 | + * <li>@return 大于0修改成功,否则为失败 | |
| 51 | + */ | |
| 52 | + public Integer deleteLogicById(Serializable id); | |
| 50 | 53 | |
| 51 | - /** | |
| 52 | - * <li>@Description:添加孕妇建档 | |
| 53 | - * <li>@param womanRecord | |
| 54 | - * <li>@param womanHusband | |
| 55 | - * <li>@return | |
| 56 | - * <li>创建人:方承 | |
| 57 | - * <li>创建时间:2017年3月31日 | |
| 58 | - * <li>修改人: | |
| 59 | - * <li>修改时间: | |
| 60 | - */ | |
| 61 | - public boolean insertbuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); | |
| 54 | + /** | |
| 55 | + * <li>@Description:(单表)新增-孕妇档案表记录 | |
| 56 | + * <li>@param womanFetationRecord | |
| 57 | + * <li>@return | |
| 58 | + * <li>创建人:xujiahong | |
| 59 | + * <li>创建时间:2017年4月18日 | |
| 60 | + * <li>修改人: | |
| 61 | + * <li>修改时间: | |
| 62 | + */ | |
| 63 | + public String create(WomanFetationRecord womanFetationRecord); | |
| 62 | 64 | |
| 63 | - /** | |
| 64 | - * <li>@Description:修改孕妇建档 | |
| 65 | - * <li>@param womanRecord | |
| 66 | - * <li>@param womanHusband | |
| 67 | - * <li>@return | |
| 68 | - * <li>创建人:方承 | |
| 69 | - * <li>创建时间:2017年3月31日 | |
| 70 | - * <li>修改人: | |
| 71 | - * <li>修改时间: | |
| 72 | - */ | |
| 73 | - public boolean updatebuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); | |
| 65 | + /** | |
| 66 | + * <li>@Description:添加孕妇建档 | |
| 67 | + * <li>@param womanRecord | |
| 68 | + * <li>@param womanHusband | |
| 69 | + * <li>@return | |
| 70 | + * <li>创建人:方承 | |
| 71 | + * <li>创建时间:2017年3月31日 | |
| 72 | + * <li>修改人: | |
| 73 | + * <li>修改时间: | |
| 74 | + */ | |
| 75 | + public boolean insertbuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); | |
| 74 | 76 | |
| 75 | - /** | |
| 76 | - * <li>@Description:根据【证件类型和号码】【就诊卡和机构id】获取孕妇档案信息 | |
| 77 | - * <li>@param cardType 证件类型 | |
| 78 | - * <li>@param cardNum 证件编号 | |
| 79 | - * <li>@param patientNum 就诊卡号 | |
| 80 | - * <li>@param orgid 机构id | |
| 81 | - * <li>@return | |
| 82 | - * <li>创建人:方承 | |
| 83 | - * <li>创建时间:2017年3月31日 | |
| 84 | - * <li>修改人: | |
| 85 | - * <li>修改时间: | |
| 86 | - */ | |
| 87 | - public WomanFetationRecord findByCard(String cardType, String cardNum,String patientNum,String orgid); | |
| 77 | + /** | |
| 78 | + * <li>@Description:修改孕妇建档 | |
| 79 | + * <li>@param womanRecord | |
| 80 | + * <li>@param womanHusband | |
| 81 | + * <li>@return | |
| 82 | + * <li>创建人:方承 | |
| 83 | + * <li>创建时间:2017年3月31日 | |
| 84 | + * <li>修改人: | |
| 85 | + * <li>修改时间: | |
| 86 | + */ | |
| 87 | + public boolean updatebuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * <li>@Description:根据【证件类型和号码】【就诊卡和机构id】获取孕妇档案信息 | |
| 91 | + * <li>@param cardType 证件类型 | |
| 92 | + * <li>@param cardNum 证件编号 | |
| 93 | + * <li>@param patientNum 就诊卡号 | |
| 94 | + * <li>@param orgid 机构id | |
| 95 | + * <li>@return | |
| 96 | + * <li>创建人:方承 | |
| 97 | + * <li>创建时间:2017年3月31日 | |
| 98 | + * <li>修改人: | |
| 99 | + * <li>修改时间: | |
| 100 | + */ | |
| 101 | + public WomanFetationRecord findByCard(String cardType, String cardNum, String patientNum, String orgid); | |
| 88 | 102 | |
| 89 | 103 | } |
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java
View file @
17f7a5e
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import java.io.Serializable; |
| 4 | 4 | import java.util.Date; |
| 5 | +import java.util.HashMap; | |
| 5 | 6 | import java.util.List; |
| 6 | 7 | import java.util.Map; |
| 7 | 8 | |
| ... | ... | @@ -15,6 +16,8 @@ |
| 15 | 16 | import com.lyms.hospital.dao.woman.WomanFetationRecordMapper; |
| 16 | 17 | import com.lyms.hospital.entity.woman.WomanFetationRecord; |
| 17 | 18 | import com.lyms.hospital.entity.woman.WomanHusband; |
| 19 | +import com.lyms.hospital.enums.IfdelEnum; | |
| 20 | +import com.lyms.hospital.enums.StatusEnum; | |
| 18 | 21 | import com.lyms.hospital.service.woman.WomanFetationRecordService; |
| 19 | 22 | import com.lyms.hospital.service.woman.WomanHusbandService; |
| 20 | 23 | import com.lyms.hospital.service.woman.WomanPersonService; |
| ... | ... | @@ -36,6 +39,8 @@ |
| 36 | 39 | private WomanPersonService womanPersonService; |
| 37 | 40 | @Autowired |
| 38 | 41 | private WomanHusbandService womanHusbandService; |
| 42 | + @Autowired | |
| 43 | + private WomanFetationRecordMapper fetationMapper; | |
| 39 | 44 | |
| 40 | 45 | public Integer deleteLogicById(Serializable id){ |
| 41 | 46 | return baseMapper.deleteLogicById(id); |
| ... | ... | @@ -45,7 +50,7 @@ |
| 45 | 50 | @Transactional |
| 46 | 51 | public boolean insertbuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband) { |
| 47 | 52 | /* |
| 48 | - * (1)插入女性居民表 | |
| 53 | + * (1)插入女性居民表(如果证件吻合,则不会新增,返回原女性居民ID) | |
| 49 | 54 | * (2)插入孕妇建档表 |
| 50 | 55 | * (3)插入配偶信息表 |
| 51 | 56 | */ |
| ... | ... | @@ -75,7 +80,7 @@ |
| 75 | 80 | ew.and("BASE_PAPERS_TYPE={0}", cardType).and("BASE_PAPERS_NUMBER={0}", cardNum); |
| 76 | 81 | } |
| 77 | 82 | if(StrUtils.isNotEmpty(patientNum) && StrUtils.isNotEmpty(orgid)){ |
| 78 | - ew.and("HOSPITAL_PATIENT_CARD={0}", patientNum).and("hospitalId={0}", orgid); | |
| 83 | + ew.and("HOSPITAL_PATIENT_CARD={0}", patientNum).and("HOSTPITAL_ID={0}", orgid); | |
| 79 | 84 | } |
| 80 | 85 | List<WomanFetationRecord> dataList = baseMapper.selectList(ew); |
| 81 | 86 | return CollectionUtils.isNotEmpty(dataList) ? dataList.get(0) : null; |
| ... | ... | @@ -96,6 +101,8 @@ |
| 96 | 101 | String id = StrUtils.uuid(); |
| 97 | 102 | obj.setId(id); |
| 98 | 103 | obj.setCreateTime(new Date()); |
| 104 | + obj.setIfdel(IfdelEnum.NO.getStatus()); | |
| 105 | + obj.setEnalble(StatusEnum.ENABLED.getStatus()); | |
| 99 | 106 | if (insert(obj)) { |
| 100 | 107 | return id; |
| 101 | 108 | } |
| 102 | 109 | |
| 103 | 110 | |
| ... | ... | @@ -108,11 +115,19 @@ |
| 108 | 115 | * (1)查询孕妇建档信息详情 |
| 109 | 116 | * (2)查询相关的配偶信息详情 |
| 110 | 117 | */ |
| 118 | + Map<String, Object> map = new HashMap<>(); | |
| 111 | 119 | WomanFetationRecord fetationRecord = this.selectById(id); |
| 112 | 120 | if(fetationRecord!=null){ |
| 113 | - WomanHusband wh = womanHusbandService.selectByTarget(WomanHusband.TARGET_TYPE_ARCHIVE, fetationRecord.getId()); | |
| 121 | + WomanHusband womanHusband = womanHusbandService.selectByTarget(WomanHusband.TARGET_TYPE_ARCHIVE, fetationRecord.getId()); | |
| 122 | + map.put("fetationRecord", fetationRecord); | |
| 123 | + map.put("womanHusband", womanHusband); | |
| 114 | 124 | } |
| 115 | - return null; | |
| 125 | + return map; | |
| 126 | + } | |
| 127 | + | |
| 128 | + @Override | |
| 129 | + public List<Map<String, Object>> selectHistory(String cardType, String cardNo, String vcCardNo) { | |
| 130 | + return fetationMapper.selectHistory(cardType, cardNo, vcCardNo); | |
| 116 | 131 | } |
| 117 | 132 | } |
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java
View file @
17f7a5e
| ... | ... | @@ -55,6 +55,7 @@ |
| 55 | 55 | EntityWrapper<WomanHusband> ew = new EntityWrapper<WomanHusband>(); |
| 56 | 56 | ew.where("TARGET_ID={0}", obj.getTargetId()); |
| 57 | 57 | delete(ew); |
| 58 | + //插入 | |
| 58 | 59 | String id = StrUtils.uuid(); |
| 59 | 60 | obj.setId(id); |
| 60 | 61 | obj.setCreateTime(new java.util.Date()); |
| ... | ... | @@ -75,8 +76,8 @@ |
| 75 | 76 | @Override |
| 76 | 77 | public WomanHusband selectByTarget(int targetType, String targetId) { |
| 77 | 78 | EntityWrapper<WomanHusband> wrapper = new EntityWrapper<>(); |
| 78 | - wrapper.where("TARGET_TYPE", targetType); | |
| 79 | - wrapper.and("TARGET_ID", targetId); | |
| 79 | + wrapper.where("TARGET_TYPE={0}", targetType); | |
| 80 | + wrapper.and("TARGET_ID={0}", targetId); | |
| 80 | 81 | List<WomanHusband> list = baseMapper.selectList(wrapper); |
| 81 | 82 | if(list.size()>1){ |
| 82 | 83 | throw new SystemException("发现多条匹配记录"); |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java
View file @
17f7a5e
| 1 | +package com.lyms.hospital.controller.woman; | |
| 2 | + | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.HashMap; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import org.springframework.stereotype.Controller; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 12 | + | |
| 13 | +import com.lyms.hospital.util.trans.OldDictionary; | |
| 14 | +import com.lyms.hospital.util.trans.XjhMapUtil; | |
| 15 | +import com.lyms.web.bean.AjaxResult; | |
| 16 | +import com.lyms.web.controller.BaseController; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * <p> | |
| 20 | + * 公用接口-前端控制器 | |
| 21 | + * </p> | |
| 22 | + * | |
| 23 | + * @author xujiahong | |
| 24 | + * @since 2017-04-21 | |
| 25 | + */ | |
| 26 | +@Controller | |
| 27 | +@RequestMapping("/commonApi") | |
| 28 | +public class CommonApiController extends BaseController { | |
| 29 | + | |
| 30 | + @RequestMapping(value = "/queryDictionary", method = RequestMethod.GET) | |
| 31 | + @ResponseBody | |
| 32 | + public AjaxResult queryDictionary (){ | |
| 33 | + //TODO 模拟查询数据字典的数据 | |
| 34 | + Map<String,Object> dictionary = new HashMap<>(); | |
| 35 | + /*户口类型*/ | |
| 36 | + List<Map<String, Object>> censusType = new ArrayList<>(); | |
| 37 | + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("001", "非农业户口"))); | |
| 38 | + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("002", "农业户口"))); | |
| 39 | + /*证件类型*/ | |
| 40 | + List<Map<String, Object>> certeType = new ArrayList<>(); | |
| 41 | + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("003", "身份证"))); | |
| 42 | + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("004", "手机号"))); | |
| 43 | + /*国家*/ | |
| 44 | + List<Map<String, Object>> country = new ArrayList<>(); | |
| 45 | + country.add(XjhMapUtil.transBean2Map(new OldDictionary("005", "中国"))); | |
| 46 | + country.add(XjhMapUtil.transBean2Map(new OldDictionary("006", "美国"))); | |
| 47 | + /*vip体验类型*/ | |
| 48 | + List<Map<String, Object>> expYunEnums = new ArrayList<>(); | |
| 49 | + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("007", "vip体验类型1"))); | |
| 50 | + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("008", "vip体验类型2"))); | |
| 51 | + /*居住类型*/ | |
| 52 | + List<Map<String, Object>> liveType = new ArrayList<>(); | |
| 53 | + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("009", "本地"))); | |
| 54 | + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("010", "非本地"))); | |
| 55 | + /*民族*/ | |
| 56 | + List<Map<String, Object>> nation = new ArrayList<>(); | |
| 57 | + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("011", "汉族"))); | |
| 58 | + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("012", "白族"))); | |
| 59 | + /*职业类型*/ | |
| 60 | + List<Map<String, Object>> professionType = new ArrayList<>(); | |
| 61 | + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("013", "医生"))); | |
| 62 | + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("014", "教师"))); | |
| 63 | + /*服务状态*/ | |
| 64 | + List<Map<String, Object>> serviceStatus = new ArrayList<>(); | |
| 65 | + serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("015", "开通"))); | |
| 66 | + serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("016", "未开通"))); | |
| 67 | + /*服务类型*/ | |
| 68 | + List<Map<String, Object>> serviceType = new ArrayList<>(); | |
| 69 | + serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("017", "标准服务"))); | |
| 70 | + serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("018", "增值服务"))); | |
| 71 | + dictionary.put("censusType", censusType); | |
| 72 | + dictionary.put("certeType", certeType); | |
| 73 | + dictionary.put("country", country); | |
| 74 | + dictionary.put("expYunEnums", expYunEnums); | |
| 75 | + dictionary.put("liveType", liveType); | |
| 76 | + dictionary.put("nation", nation); | |
| 77 | + dictionary.put("professionType", professionType); | |
| 78 | + dictionary.put("serviceStatus", serviceStatus); | |
| 79 | + dictionary.put("serviceType", serviceType); | |
| 80 | + return AjaxResult.returnSuccess(dictionary); | |
| 81 | + } | |
| 82 | +} |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java
View file @
17f7a5e
| 1 | 1 | package com.lyms.hospital.controller.woman; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 4 | +import java.util.HashMap; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 3 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | 9 | import org.springframework.stereotype.Controller; |
| 5 | 10 | import org.springframework.web.bind.annotation.RequestBody; |
| 6 | 11 | |
| ... | ... | @@ -11,8 +16,12 @@ |
| 11 | 16 | import com.lyms.hospital.entity.woman.WomanHusband; |
| 12 | 17 | import com.lyms.hospital.request.woman.WomanFetationRequest; |
| 13 | 18 | import com.lyms.hospital.request.woman.WomanFetationRequestWrapper; |
| 19 | +import com.lyms.hospital.response.keymap.WomanFetationRecordKeymap; | |
| 20 | +import com.lyms.hospital.response.woman.WomanFetationResponse; | |
| 14 | 21 | import com.lyms.hospital.service.token.TokenService; |
| 15 | 22 | import com.lyms.hospital.service.woman.WomanFetationRecordService; |
| 23 | +import com.lyms.hospital.util.trans.XjhMapUtil; | |
| 24 | +import com.lyms.util.DateUtil; | |
| 16 | 25 | import com.lyms.web.bean.AjaxResult; |
| 17 | 26 | import com.lyms.web.controller.BaseController; |
| 18 | 27 | |
| ... | ... | @@ -21,8 +30,8 @@ |
| 21 | 30 | * 孕妇档案-前端控制器 |
| 22 | 31 | * </p> |
| 23 | 32 | * |
| 24 | - * 依据cardNo或vcCardNo查询孕妇档案 | |
| 25 | - * 孕妇建档(新增或修改) | |
| 33 | + * []依据cardNo或vcCardNo查询孕妇档案 | |
| 34 | + * []孕妇建档(新增或修改) | |
| 26 | 35 | * 依据id得到“孕妇建档”表单详情 |
| 27 | 36 | * |
| 28 | 37 | * @author xujiahong |
| ... | ... | @@ -38,6 +47,36 @@ |
| 38 | 47 | private TokenService tokenService; |
| 39 | 48 | |
| 40 | 49 | /** |
| 50 | + * <li>@Description:依据id得到“孕妇建档”表单详情 | |
| 51 | + * <li>@param id | |
| 52 | + * <li>@return | |
| 53 | + * <li>创建人:xujiahong | |
| 54 | + * <li>创建时间:2017年4月20日 | |
| 55 | + * <li>修改人: | |
| 56 | + * <li>修改时间: | |
| 57 | + */ | |
| 58 | + @RequestMapping(value = "/queryPregnantBuildById", method = RequestMethod.GET) | |
| 59 | + @ResponseBody | |
| 60 | + public AjaxResult queryPregnantBuildById(String id){ | |
| 61 | + //查询详情相关对象 | |
| 62 | + Map<String, Object> map = fetationService.selectWomanFetationMapById(id); | |
| 63 | + WomanFetationRecord fetationRecord = (WomanFetationRecord)map.get("fetationRecord"); | |
| 64 | + WomanHusband womanHusband = (WomanHusband)map.get("womanHusband"); | |
| 65 | + //转换为与前端对接的response对象 | |
| 66 | + Map<String, Object> fetationRecordMap = XjhMapUtil.transBean2FormatAliasMap(fetationRecord, | |
| 67 | + XjhMapUtil.getKeyMap(WomanFetationRecordKeymap.original, WomanFetationRecordKeymap.alias)); | |
| 68 | + Map<String, Object> womanHusbandMap = XjhMapUtil.transBean2FormatAliasMap(womanHusband, | |
| 69 | + XjhMapUtil.getKeyMap(WomanFetationRecordKeymap.original, WomanFetationRecordKeymap.alias)); | |
| 70 | + fetationRecordMap.putAll(womanHusbandMap); | |
| 71 | + | |
| 72 | + System.out.println(fetationRecordMap); | |
| 73 | + WomanFetationResponse response = (WomanFetationResponse)XjhMapUtil.transMap2Bean(fetationRecordMap, new WomanFetationResponse()); | |
| 74 | + response.setId(fetationRecord.getId()); | |
| 75 | + response.setPid(fetationRecord.getWomanPersonId()); | |
| 76 | + return AjaxResult.returnSuccess(response); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 41 | 80 | * <li>@Description:依据cardNo或vcCardNo查询孕妇档案 |
| 42 | 81 | * <li>@param cardNo |
| 43 | 82 | * <li>@param vcCardNo |
| ... | ... | @@ -49,9 +88,17 @@ |
| 49 | 88 | */ |
| 50 | 89 | @RequestMapping(value = "/queryPregnantBuildRecord", method = RequestMethod.GET) |
| 51 | 90 | @ResponseBody |
| 52 | - public AjaxResult queryPregnantBuildRecord(String cardNo,String vcCardNo){ | |
| 53 | - //TODO | |
| 54 | - return AjaxResult.returnFail(); | |
| 91 | + public AjaxResult queryPregnantBuildRecord(String cardType,String cardNo,String vcCardNo){ | |
| 92 | + | |
| 93 | +// System.out.println("cardType:"+cardType+"cardNo:"+cardNo+"vcCardNo:"+vcCardNo); | |
| 94 | + | |
| 95 | + //TODO 查询历史建档记录 | |
| 96 | + List<Map<String, Object>> history = fetationService.selectHistory(cardType, cardNo, vcCardNo); | |
| 97 | + | |
| 98 | + Map<String,Object> dataMap = new HashMap<>(); | |
| 99 | + dataMap.put("history", history); | |
| 100 | + dataMap.put("now", DateUtil.getyyyy_MM_dd(new Date())); | |
| 101 | + return AjaxResult.returnSuccess(dataMap); | |
| 55 | 102 | } |
| 56 | 103 | |
| 57 | 104 | /** |
| 58 | 105 | |
| 59 | 106 | |
| ... | ... | @@ -73,17 +120,24 @@ |
| 73 | 120 | WomanFetationRecord womanFetationRecord = wrapper.getWomanFetationRecord(); |
| 74 | 121 | WomanHusband womanHusband = wrapper.getWomanHusband(); |
| 75 | 122 | /* |
| 76 | - * 业务逻辑: | |
| 77 | - * (1)查询档案信息的存在性 | |
| 78 | - * (2)若不存在则新增,若存在则修改 | |
| 123 | + * 需求: | |
| 124 | + * (1)同一孕妇在不同医院(orgId)对应两份档案 | |
| 125 | + * (2)TODO 同一医院同一孕妇,多个产程对应多个档案 | |
| 79 | 126 | */ |
| 127 | + //查询档案信息的存在性 | |
| 80 | 128 | WomanFetationRecord dbObj = fetationService.findByCard( |
| 81 | 129 | request.getPregnantCertificateTypeId(), request.getPregnantCertificateNum(), |
| 82 | 130 | request.getVcCardNo(), request.getHospitalId()); |
| 83 | 131 | boolean flag = false; |
| 84 | - if(dbObj==null){//新增 | |
| 85 | - flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband); | |
| 86 | - }else{//修改 | |
| 132 | + if(request.getId()==null){//新增 | |
| 133 | + if(dbObj!=null){//本院已有档案,修改现有档案 | |
| 134 | + womanFetationRecord.setId(dbObj.getId()); | |
| 135 | + womanHusband.setTargetId(dbObj.getId()); | |
| 136 | + flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband); | |
| 137 | + }else{ | |
| 138 | + flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband); | |
| 139 | + } | |
| 140 | + }else{//修改 | |
| 87 | 141 | flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband); |
| 88 | 142 | } |
| 89 | 143 | if(flag){ |
parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java
View file @
17f7a5e
| ... | ... | @@ -14,14 +14,28 @@ |
| 14 | 14 | @Form |
| 15 | 15 | public class WomanFetationRequest { |
| 16 | 16 | |
| 17 | + | |
| 18 | + | |
| 19 | + /* | |
| 20 | + * 新字段 since 2017-04-21 10:33:43 | |
| 21 | + */ | |
| 22 | + | |
| 23 | + private String womanHusbandId;// 【新】配偶信息ID | |
| 24 | + private String baseFamilyIncome;//家庭收入 | |
| 25 | + private String husbandBirthStr;//【新字段】出生日期 | |
| 26 | + private String hospitalCorrectLastMenstruation;//【新字段】纠正末次月经 | |
| 27 | + private String hospitalBarcode;//【新字段】条码 | |
| 28 | + | |
| 29 | + /* | |
| 30 | + * 新字段 since 2017-04-21 10:33:43 | |
| 31 | + */ | |
| 32 | + | |
| 17 | 33 | |
| 18 | 34 | // 建档ID |
| 19 | 35 | private String id; |
| 20 | 36 | // 女性居民ID |
| 21 | 37 | @FormParam |
| 22 | 38 | private String pid; |
| 23 | - // 【新】配偶信息ID | |
| 24 | - private String womanHusbandId; | |
| 25 | 39 | |
| 26 | 40 | |
| 27 | 41 | /*********** 孕妇基本信息 ***********/ |
| ... | ... | @@ -622,6 +636,38 @@ |
| 622 | 636 | |
| 623 | 637 | public void setWomanHusbandId(String womanHusbandId) { |
| 624 | 638 | this.womanHusbandId = womanHusbandId; |
| 639 | + } | |
| 640 | + | |
| 641 | + public String getBaseFamilyIncome() { | |
| 642 | + return baseFamilyIncome; | |
| 643 | + } | |
| 644 | + | |
| 645 | + public void setBaseFamilyIncome(String baseFamilyIncome) { | |
| 646 | + this.baseFamilyIncome = baseFamilyIncome; | |
| 647 | + } | |
| 648 | + | |
| 649 | + public String getHusbandBirthStr() { | |
| 650 | + return husbandBirthStr; | |
| 651 | + } | |
| 652 | + | |
| 653 | + public void setHusbandBirthStr(String husbandBirthStr) { | |
| 654 | + this.husbandBirthStr = husbandBirthStr; | |
| 655 | + } | |
| 656 | + | |
| 657 | + public String getHospitalCorrectLastMenstruation() { | |
| 658 | + return hospitalCorrectLastMenstruation; | |
| 659 | + } | |
| 660 | + | |
| 661 | + public void setHospitalCorrectLastMenstruation(String hospitalCorrectLastMenstruation) { | |
| 662 | + this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; | |
| 663 | + } | |
| 664 | + | |
| 665 | + public String getHospitalBarcode() { | |
| 666 | + return hospitalBarcode; | |
| 667 | + } | |
| 668 | + | |
| 669 | + public void setHospitalBarcode(String hospitalBarcode) { | |
| 670 | + this.hospitalBarcode = hospitalBarcode; | |
| 625 | 671 | } |
| 626 | 672 | |
| 627 | 673 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java
View file @
17f7a5e
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | womanFetationRecord.setId(req.getId()); |
| 24 | 24 | womanHusband.setTargetId(req.getId()); |
| 25 | 25 | /* |
| 26 | - * 孕妇基本信息 | |
| 26 | + * 孕妇基本信息(10+1) | |
| 27 | 27 | */ |
| 28 | 28 | womanFetationRecord.setBaseWomanName(req.getPregnantName());//孕妇姓名 |
| 29 | 29 | womanFetationRecord.setBasePapersType(req.getPregnantCertificateTypeId());//孕妇证件类型 |
| 30 | 30 | |
| ... | ... | @@ -34,10 +34,10 @@ |
| 34 | 34 | womanFetationRecord.setBaseRegisterType(req.getPregnantCensusTypeId());//孕妇户籍类型 |
| 35 | 35 | womanFetationRecord.setBaseDwellType(req.getPregnantLiveTypeId());//孕妇居住类别 |
| 36 | 36 | womanFetationRecord.setBaseOccupationType(req.getPregnantProfessionTypeId());//孕妇职业类别 |
| 37 | - womanFetationRecord.setBaseWomanCulture("");//【新】文化程度========================== | |
| 38 | - womanFetationRecord.setBaseFamilyIncome("");//【新】家庭收入========================== | |
| 37 | + womanFetationRecord.setBaseWomanCulture(req.getPregnantLevelTypeId());//文化程度 | |
| 38 | + womanFetationRecord.setBaseFamilyIncome(req.getBaseFamilyIncome());//【新】家庭收入========================== | |
| 39 | 39 | /* |
| 40 | - * 孕妇联系方式 | |
| 40 | + * 孕妇联系方式(17) | |
| 41 | 41 | */ |
| 42 | 42 | womanFetationRecord.setContactWomanWay(req.getPregnantPhone());//孕妇电话 |
| 43 | 43 | womanFetationRecord.setContactWorkAddress(req.getPregnantWorkUnit());//孕妇工作单位 |
| 44 | 44 | |
| ... | ... | @@ -64,11 +64,11 @@ |
| 64 | 64 | */ |
| 65 | 65 | womanFetationRecord.setHospitalLastMenstruation(DateUtil.parseYMD(req.getLastMenstrualPeriod()));//末次月经 |
| 66 | 66 | //【新】纠正末次月经================ |
| 67 | - womanFetationRecord.setHospitalCorrectLastMenstruation(null); | |
| 67 | + womanFetationRecord.setHospitalCorrectLastMenstruation(DateUtil.parseYMD(req.getHospitalCorrectLastMenstruation())); | |
| 68 | 68 | womanFetationRecord.setHospitalExpectedDate(DateUtil.parseYMD(req.getDueDate()));//预产期 |
| 69 | 69 | womanFetationRecord.setHospitalPatientCard(req.getVcCardNo());//就诊卡号 |
| 70 | 70 | //【新】条码===================== |
| 71 | - womanFetationRecord.setHospitalBarcode(null); | |
| 71 | + womanFetationRecord.setHospitalBarcode(req.getHospitalBarcode()); | |
| 72 | 72 | womanFetationRecord.setHospitalServiceType(req.getServiceType()+"");//服务类型 |
| 73 | 73 | womanFetationRecord.setHospitalServiceStatus(req.getServiceStatus()+"");//服务状态 |
| 74 | 74 | womanFetationRecord.setHospitalRecordNumber(req.getFileCode());//档案编号 |
| ... | ... | @@ -86,7 +86,7 @@ |
| 86 | 86 | //【新】建档来源===================== |
| 87 | 87 | womanFetationRecord.setBuildType(null);//建档来源 |
| 88 | 88 | /* |
| 89 | - * 丈夫信息 | |
| 89 | + * 丈夫信息(14+1) | |
| 90 | 90 | */ |
| 91 | 91 | womanHusband.setHusbandName(req.getHusbandName());//丈夫姓名 |
| 92 | 92 | womanHusband.setHusbandPapersType(req.getHusbandCertificateTypeId());//丈夫证件类型 |
| ... | ... | @@ -94,9 +94,8 @@ |
| 94 | 94 | womanHusband.setHusbandCountry(req.getHusbandCountryId());//丈夫国籍 |
| 95 | 95 | womanHusband.setHusbandNation(req.getHusbandNationId());//丈夫民族 |
| 96 | 96 | //【新】丈夫出生日期===================== |
| 97 | - womanHusband.setHusbandBirth(null); | |
| 98 | - //【新】丈夫文化程度===================== | |
| 99 | - womanHusband.setHusbandCulture(null); | |
| 97 | + womanHusband.setHusbandBirth(DateUtil.parseYMD(req.getHusbandBirthStr())); | |
| 98 | + womanHusband.setHusbandCulture(req.getHusbandLevelTypeId());//丈夫文化程度 | |
| 100 | 99 | womanHusband.setHusbandWay(req.getHusbandPhone());//丈夫联系方式 |
| 101 | 100 | womanHusband.setHusbandOccupationType(req.getHusbandProfessionTypeId());//丈夫职业类别 |
| 102 | 101 | womanHusband.setHusbandWorkAddress(req.getHusbandWorkUnit());//丈夫工作单位 |
| ... | ... | @@ -105,6 +104,7 @@ |
| 105 | 104 | womanHusband.setHusbandRegisterArea(req.getHusbandAreaRegisterId());//丈夫居住地区县 |
| 106 | 105 | womanHusband.setHusbandRegisterStreet(req.getHusbandStreetRegisterId());//丈夫居住地乡镇街道 |
| 107 | 106 | womanHusband.setHusbandRegisterDetail(req.getHusbandAddressRegister());//丈夫居住地详细地址 |
| 107 | + | |
| 108 | 108 | womanHusband.setTargetType(WomanHusband.TARGET_TYPE_ARCHIVE);//配偶信息来源于孕妇建档 |
| 109 | 109 | } |
| 110 | 110 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java
View file @
17f7a5e
| 1 | +package com.lyms.hospital.response.keymap; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 孕妇建档-新老系统字段名映射 | |
| 5 | + * @author xujiahong | |
| 6 | + * | |
| 7 | + */ | |
| 8 | +public class WomanFetationRecordKeymap { | |
| 9 | + | |
| 10 | + /* | |
| 11 | + 【未映射字段(需要手动get,set)】 | |
| 12 | + WomanFetationRecord==================== | |
| 13 | + | |
| 14 | + "hospitalMember",//会员预约时间??? | |
| 15 | + "hospitalMemberDate",//体验到期时间 | |
| 16 | + | |
| 17 | + "buildDate",//建档时间 | |
| 18 | + "buildType",//建档来源 | |
| 19 | + "createId",// | |
| 20 | + "createTime",// | |
| 21 | + "enalble",// | |
| 22 | + "id",// | |
| 23 | + "ifdel",// | |
| 24 | + "modifyId",// | |
| 25 | + "modifyTime",// | |
| 26 | + "womanPersonId"//女性居民表ID | |
| 27 | + | |
| 28 | + WomanHusband=============================== | |
| 29 | + "bloodRelation",// | |
| 30 | + "bloodRelationText",// | |
| 31 | + "createTime",// | |
| 32 | + "id",// | |
| 33 | + "isProvide",// | |
| 34 | + "targetId",// | |
| 35 | + "targetType",// | |
| 36 | + | |
| 37 | + WomanFetationResponse===================== | |
| 38 | + "id",//建档Id | |
| 39 | + "pid", | |
| 40 | + | |
| 41 | + 【删除字段】 | |
| 42 | + "expType",//vip体验类型 | |
| 43 | + "expVip",//vip体验 | |
| 44 | + "vipEndTime",//vip体验结束日期 | |
| 45 | + "dueStatus"//分娩状态 0未终止妊娠 1终止妊娠 | |
| 46 | + 【新增字段】 | |
| 47 | + "baseFamilyIncome",//【新字段】家庭收入 | |
| 48 | + "husbandBirth",//【新字段】出生日期 | |
| 49 | + "hospitalCorrectLastMenstruation",//【新字段】纠正末次月经 | |
| 50 | + "hospitalBarcode",//【新字段】条码 | |
| 51 | + 【】 | |
| 52 | + | |
| 53 | + */ | |
| 54 | + | |
| 55 | + public static String[] original = { | |
| 56 | + /* | |
| 57 | + * 孕妇基本信息(10+1) | |
| 58 | + */ | |
| 59 | + "baseWomanName", | |
| 60 | + "basePapersType", | |
| 61 | + "basePapersNumber", | |
| 62 | + "baseWomanCountry", | |
| 63 | + "baseWomanNation", | |
| 64 | + "baseWomanBirthStr", | |
| 65 | + "baseRegisterType",//户籍类别 | |
| 66 | + "baseDwellType",//居住类别 | |
| 67 | + "baseOccupationType",//职业类别 | |
| 68 | + "baseWomanCulture",//文化程度 | |
| 69 | + "baseFamilyIncome",//【新字段】家庭收入 | |
| 70 | + /* | |
| 71 | + * 孕妇联系方式(17=) | |
| 72 | + */ | |
| 73 | + "contactWomanWay", | |
| 74 | + "contactWorkAddress", | |
| 75 | + //居住地:省、市、区、乡镇街道、详细地址 | |
| 76 | + "contactDwellProvince", | |
| 77 | + "contactDwellCity", | |
| 78 | + "contactDwellArea", | |
| 79 | + "contactDwellStreet", | |
| 80 | + "contactDwellDetail", | |
| 81 | + //户籍地址:省、市、区、乡镇街道、详细地址 | |
| 82 | + "contactRegisterProvince", | |
| 83 | + "contactRegisterCity", | |
| 84 | + "contactRegisterArea", | |
| 85 | + "contactRegisterStreet", | |
| 86 | + "contactRegisterDetail", | |
| 87 | + //产后修养地:省、市、区、乡镇街道、详细地址 | |
| 88 | + "contactPostpartumProvince", | |
| 89 | + "contactPostpartumCity", | |
| 90 | + "contactPostpartumArea", | |
| 91 | + "contactPostpartumStreet", | |
| 92 | + "contactPostpartumDetail", | |
| 93 | + /* | |
| 94 | + * 丈夫信息(=======14+1) | |
| 95 | + */ | |
| 96 | + "husbandName",// | |
| 97 | + "husbandPapersType",// | |
| 98 | + "husbandPapersNumber",// | |
| 99 | + "husbandCountry",// | |
| 100 | + "husbandNation",// | |
| 101 | + "husbandBirthStr",//【新字段】出生日期 | |
| 102 | + "husbandOccupationType",// | |
| 103 | + "husbandCulture",// | |
| 104 | + "husbandWay",// | |
| 105 | + "husbandWorkAddress",// | |
| 106 | + | |
| 107 | + "husbandRegisterProvince",// | |
| 108 | + "husbandRegisterCity",// | |
| 109 | + "husbandRegisterArea",// | |
| 110 | + "husbandRegisterStreet",// | |
| 111 | + "husbandRegisterDetail",// | |
| 112 | + | |
| 113 | + | |
| 114 | + /* | |
| 115 | + * 孕妇院内信息(========14+2-4) | |
| 116 | + */ | |
| 117 | + "hospitalLastMenstruationStr",//末次月经 | |
| 118 | + "hospitalCorrectLastMenstruationStr",//【新字段】纠正末次月经 | |
| 119 | + "hospitalExpectedDateStr",//预产期 | |
| 120 | + "hospitalPatientCard",//就诊卡 | |
| 121 | + "hospitalBarcode",//【新字段】条码 | |
| 122 | + "hospitalRecordNumber",//档案编号 | |
| 123 | + "hospitalServiceType",//服务类型 | |
| 124 | + "hospitalServiceStatus",//服务状态 | |
| 125 | + | |
| 126 | + "hospitalRecordDoctor",//建档医生 | |
| 127 | + "hostpitalId",//建档医院 | |
| 128 | + "hospitalRecordDateStr",//建档日期 | |
| 129 | + "hospitalRecordRemark",//档案备注 | |
| 130 | + | |
| 131 | + }; | |
| 132 | + | |
| 133 | + public static String[] alias = { | |
| 134 | + /* | |
| 135 | + * 孕妇基本信息(10+1) | |
| 136 | + */ | |
| 137 | + "pregnantName", | |
| 138 | + "pregnantCertificateTypeId", | |
| 139 | + "pregnantCertificateNum", | |
| 140 | + "pregnantCountryId", | |
| 141 | + "pregnantNationId", | |
| 142 | + "birthday", | |
| 143 | + "pregnantCensusTypeId",//户籍类别 | |
| 144 | + "pregnantLiveTypeId",//居住类别 | |
| 145 | + "pregnantProfessionTypeId",//职业类别 | |
| 146 | + "pregnantLevelTypeId",//文化程度 | |
| 147 | + "baseFamilyIncome",//【新字段】家庭收入 | |
| 148 | + /* | |
| 149 | + * 孕妇联系方式(17=) | |
| 150 | + */ | |
| 151 | + "pregnantPhone", | |
| 152 | + "pregnantWorkUnit", | |
| 153 | + //居住地:省、市、区、乡镇街道、详细地址 | |
| 154 | + "pregnantLiveProvinceId", | |
| 155 | + "pregnantLiveCityId", | |
| 156 | + "pregnantLiveAreaId", | |
| 157 | + "pregnantLiveStreetId", | |
| 158 | + "pregnantLiveAddr", | |
| 159 | + //户籍地址:省、市、区、乡镇街道、详细地址 | |
| 160 | + "pregnantCensusProvinceId", | |
| 161 | + "pregnantCensusCityId", | |
| 162 | + "pregnantCensusAreaId", | |
| 163 | + "pregnantCensusStreetId", | |
| 164 | + "pregnantCensusAddr", | |
| 165 | + //产后修养地:省、市、区、乡镇街道、详细地址 | |
| 166 | + "childbirthProvinceId", | |
| 167 | + "childbirthCityId", | |
| 168 | + "childbirthAreaId", | |
| 169 | + "childbirthStreetId", | |
| 170 | + "childbirthAddr", | |
| 171 | + /* | |
| 172 | + * 丈夫信息(14+1) | |
| 173 | + */ | |
| 174 | + "husbandName", | |
| 175 | + "husbandCertificateTypeId", | |
| 176 | + "husbandCertificateNum", | |
| 177 | + "husbandCountryId", | |
| 178 | + "husbandNationId", | |
| 179 | + "husbandBirthStr",//【新字段】出生日期 | |
| 180 | + "husbandProfessionTypeId",//职业类别 | |
| 181 | + "husbandLevelTypeId",//丈夫文化程度 | |
| 182 | + "husbandPhone", | |
| 183 | + "husbandWorkUnit", | |
| 184 | + //地址 | |
| 185 | + "husbandProvinceRegisterId", | |
| 186 | + "husbandCityRegisterId", | |
| 187 | + "husbandAreaRegisterId", | |
| 188 | + "husbandStreetRegisterId", | |
| 189 | + "husbandAddressRegister", | |
| 190 | + | |
| 191 | + /* | |
| 192 | + * 孕妇院内信息(14+2-4) | |
| 193 | + */ | |
| 194 | + "lastMenstrualPeriod",//末次月经 | |
| 195 | + "hospitalCorrectLastMenstruation",//【新字段】纠正末次月经 | |
| 196 | + "dueDate",//预产期 | |
| 197 | + "vcCardNo",//就诊卡号 | |
| 198 | + "hospitalBarcode",//【新字段】条码 | |
| 199 | + "fileCode",//档案编号 | |
| 200 | + "serviceType",//服务类型 | |
| 201 | + "serviceStatus",//服务状态 | |
| 202 | + | |
| 203 | + "bookbuildingDoctor",//建档医生ID | |
| 204 | + "hospitalId",//建档医院ID | |
| 205 | + "bookbuildingDate",//建档日期 | |
| 206 | + "mremark",//备注 | |
| 207 | + | |
| 208 | +// "expType",//vip体验类型 | |
| 209 | +// "expVip",//vip体验 | |
| 210 | +// "vipEndTime",//vip体验结束日期 | |
| 211 | +// "dueStatus"//分娩状态 0未终止妊娠 1终止妊娠 | |
| 212 | + | |
| 213 | + }; | |
| 214 | + | |
| 215 | +} |
parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java
View file @
17f7a5e
| 1 | +package com.lyms.hospital.util.trans; | |
| 2 | + | |
| 3 | +public class OldDictionary { | |
| 4 | + | |
| 5 | + private String id; | |
| 6 | + private String hildConfigs; | |
| 7 | + private String code; | |
| 8 | + private String desc; | |
| 9 | + private Integer enable; | |
| 10 | + private String name; | |
| 11 | + private String parentId; | |
| 12 | + | |
| 13 | + public OldDictionary(){} | |
| 14 | + | |
| 15 | + public OldDictionary(String id,String name){ | |
| 16 | + this.id = id; | |
| 17 | + this.name = name; | |
| 18 | + this.enable = 1; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public String getId() { | |
| 22 | + return id; | |
| 23 | + } | |
| 24 | + public void setId(String id) { | |
| 25 | + this.id = id; | |
| 26 | + } | |
| 27 | + public String getHildConfigs() { | |
| 28 | + return hildConfigs; | |
| 29 | + } | |
| 30 | + public void setHildConfigs(String hildConfigs) { | |
| 31 | + this.hildConfigs = hildConfigs; | |
| 32 | + } | |
| 33 | + public String getCode() { | |
| 34 | + return code; | |
| 35 | + } | |
| 36 | + public void setCode(String code) { | |
| 37 | + this.code = code; | |
| 38 | + } | |
| 39 | + public String getDesc() { | |
| 40 | + return desc; | |
| 41 | + } | |
| 42 | + public void setDesc(String desc) { | |
| 43 | + this.desc = desc; | |
| 44 | + } | |
| 45 | + public Integer getEnable() { | |
| 46 | + return enable; | |
| 47 | + } | |
| 48 | + public void setEnable(Integer enable) { | |
| 49 | + this.enable = enable; | |
| 50 | + } | |
| 51 | + public String getName() { | |
| 52 | + return name; | |
| 53 | + } | |
| 54 | + public void setName(String name) { | |
| 55 | + this.name = name; | |
| 56 | + } | |
| 57 | + public String getParentId() { | |
| 58 | + return parentId; | |
| 59 | + } | |
| 60 | + public void setParentId(String parentId) { | |
| 61 | + this.parentId = parentId; | |
| 62 | + } | |
| 63 | + | |
| 64 | + | |
| 65 | +} |
parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java
View file @
17f7a5e
| 1 | +package com.lyms.hospital.util.trans; | |
| 2 | + | |
| 3 | +import java.beans.BeanInfo; | |
| 4 | +import java.beans.Introspector; | |
| 5 | +import java.beans.PropertyDescriptor; | |
| 6 | +import java.lang.reflect.InvocationTargetException; | |
| 7 | +import java.lang.reflect.Method; | |
| 8 | +import java.util.Date; | |
| 9 | +import java.util.HashMap; | |
| 10 | +import java.util.HashSet; | |
| 11 | +import java.util.Map; | |
| 12 | +import java.util.Set; | |
| 13 | + | |
| 14 | +import com.lyms.hospital.response.keymap.WomanFetationRecordKeymap; | |
| 15 | +import com.lyms.util.DateUtil; | |
| 16 | + | |
| 17 | +public class XjhMapUtil { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 简单处理映射字段类型不匹配的情况 | |
| 21 | + * @param property 目标字段Bean相关信息 | |
| 22 | + * @param value 目标字段值 | |
| 23 | + * @param obj 对象 | |
| 24 | + * @author xujiahong | |
| 25 | + * @throws InvocationTargetException | |
| 26 | + * @throws IllegalArgumentException | |
| 27 | + * @throws IllegalAccessException | |
| 28 | + */ | |
| 29 | + private static void invokeIgnoreType(PropertyDescriptor property,Object value,Object obj) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{ | |
| 30 | + Class<?> keyType = property.getPropertyType(); | |
| 31 | + Class<?> valueType = value.getClass(); | |
| 32 | + // 得到property对应的setter方法 | |
| 33 | + Method setter = property.getWriteMethod(); | |
| 34 | + //简单处理映射字段类型不匹配的情况 | |
| 35 | + if (keyType.equals(valueType)) { | |
| 36 | + setter.invoke(obj, value); | |
| 37 | + } else { | |
| 38 | + if(keyType.equals(String.class)){ | |
| 39 | + setter.invoke(obj, value.toString()); | |
| 40 | + }else if(keyType.equals(Integer.class)){ | |
| 41 | + setter.invoke(obj, Integer.parseInt(value.toString())); | |
| 42 | + }else if(keyType.equals(Double.class)){ | |
| 43 | + setter.invoke(obj, Double.parseDouble(value.toString())); | |
| 44 | + }else{ | |
| 45 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 46 | + System.err.println("字段【"+property.getName()+"】没有可匹配的自动转换类型"); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + public static Object transMap2Bean(Map<String, Object> map, Object obj) { | |
| 52 | + try { | |
| 53 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 54 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 55 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 56 | + String key = property.getName(); | |
| 57 | + if (map.containsKey(key)) { | |
| 58 | + Object value = map.get(key); | |
| 59 | + invokeIgnoreType(property,value,obj); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + } catch (Exception e) { | |
| 63 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 64 | + System.err.println("transMap2Bean Error " + e); | |
| 65 | + } | |
| 66 | + return obj; | |
| 67 | + } | |
| 68 | + | |
| 69 | + // 自动处理时间字段和对应的字符串字段(Str结尾) | |
| 70 | + public static Object transMap2FormatBean(Map<String, Object> map, Object obj) { | |
| 71 | + try { | |
| 72 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 73 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 74 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 75 | + String key = property.getName(); | |
| 76 | + Class<?> keyType = property.getPropertyType(); | |
| 77 | + // set当前字段 | |
| 78 | + if (map.containsKey(key)) { | |
| 79 | + Object value = map.get(key); | |
| 80 | + invokeIgnoreType(property,value,obj); | |
| 81 | + | |
| 82 | + /* | |
| 83 | + * 自动处理时间字段和对应的字符串字段(Str结尾) | |
| 84 | + */ | |
| 85 | + if (keyType.equals(String.class) && key.length() > 3 | |
| 86 | + && "Str".equals(key.substring(key.length() - 3))) {// key可能是格式化字段 | |
| 87 | + String dateKey = key.substring(key.length() - 3); | |
| 88 | + for (PropertyDescriptor dateProperty : propertyDescriptors) { | |
| 89 | + if (dateKey.equals(dateProperty.getName())) {// 找到了对应的日期字段,set之 | |
| 90 | + String dateValue = value.toString(); | |
| 91 | + if (dateValue.length() == 10) {// yyyy-MM-dd | |
| 92 | + dateProperty.getWriteMethod().invoke(obj, DateUtil.parseYMD(dateValue)); | |
| 93 | + } else if (dateValue.length() == 19) {// yyyy-MM-dd | |
| 94 | + // HH:mm:ss | |
| 95 | + dateProperty.getWriteMethod().invoke(obj, DateUtil.parseYMDHMS(dateValue)); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + } | |
| 103 | + } catch (Exception e) { | |
| 104 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 105 | + System.err.println("transMap2FormatBean Error " + e); | |
| 106 | + } | |
| 107 | + return obj; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public static Map<String, Object> transBean2Map(Object obj) { | |
| 111 | + Map<String, Object> map = new HashMap<>(); | |
| 112 | + try { | |
| 113 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 114 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 115 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 116 | + String key = property.getName(); | |
| 117 | + // 过滤class属性 | |
| 118 | + if (!key.equals("class")) { | |
| 119 | + // 得到property对应的getter方法 | |
| 120 | + Method getter = property.getReadMethod(); | |
| 121 | + Object value = getter.invoke(obj); | |
| 122 | + map.put(key, value); | |
| 123 | + } | |
| 124 | + } | |
| 125 | + } catch (Exception e) { | |
| 126 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 127 | + System.err.println("transBean2Map Error " + e); | |
| 128 | + } | |
| 129 | + return map; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public static HashMap<String, String> getKeyMap(String[] original, String[] alias) { | |
| 133 | + int length = original.length; | |
| 134 | + if (length != alias.length) { | |
| 135 | + throw new RuntimeException("映射配置错误"); | |
| 136 | + } | |
| 137 | + HashMap<String, String> map = new HashMap<>(); | |
| 138 | + for (int i = 0; i < length; i++) { | |
| 139 | + map.put(original[i], alias[i]); | |
| 140 | + map.put(alias[i], original[i]); | |
| 141 | + } | |
| 142 | + /* | |
| 143 | + * 1--A(正常映射) 4--4(同名映射,允许) 2--C,C--3(错误映射) 错误的keyMap映射的value会有重复 | |
| 144 | + */ | |
| 145 | + Set<String> keySet = map.keySet(); | |
| 146 | + Set<String> valueSet = new HashSet<>(); | |
| 147 | + for (String key : keySet) { | |
| 148 | + valueSet.add(map.get(key)); | |
| 149 | + } | |
| 150 | + if (keySet.size() != valueSet.size()) { | |
| 151 | + throw new RuntimeException("映射配置错误"); | |
| 152 | + } | |
| 153 | + return map; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public static Map<String, Object> transBean2AliasMap(Object obj, HashMap<String, String> keyMap) { | |
| 157 | + Map<String, Object> map = new HashMap<>(); | |
| 158 | + try { | |
| 159 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 160 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 161 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 162 | + String field = property.getName(); | |
| 163 | + // 过滤class属性 | |
| 164 | + if (!field.equals("class")) { | |
| 165 | + // 得到property对应的getter方法 | |
| 166 | + Method getter = property.getReadMethod(); | |
| 167 | + Object value = getter.invoke(obj); | |
| 168 | + if (keyMap.get(field) != null) { | |
| 169 | + map.put(keyMap.get(field), value); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } catch (Exception e) { | |
| 174 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 175 | + System.err.println("transBean2AliasMap Error " + e); | |
| 176 | + } | |
| 177 | + return map; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public static Map<String, Object> transBean2FormatAliasMap(Object obj, HashMap<String, String> keyMap) { | |
| 181 | + Map<String, Object> map = new HashMap<>(); | |
| 182 | + try { | |
| 183 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 184 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 185 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 186 | + String field = property.getName(); | |
| 187 | + // Class<?> fieldType = property.getPropertyType(); | |
| 188 | + // 过滤class属性 | |
| 189 | + if (!field.equals("class")) { | |
| 190 | + // 得到property对应的getter方法 | |
| 191 | + Method getter = property.getReadMethod(); | |
| 192 | + Object value = getter.invoke(obj); | |
| 193 | + if (value instanceof Date) {// 自动格式化日期对象 | |
| 194 | + Date dateValue = (Date) value; | |
| 195 | + String str = DateUtil.getyyyy_MM_dd(dateValue);// getyyyy_MM_dd_hms | |
| 196 | + if (keyMap.get(field + "Str") != null) { | |
| 197 | + map.put(keyMap.get(field + "Str"), str); | |
| 198 | + } | |
| 199 | + } else {// 普通字段,别名存储 | |
| 200 | + if (keyMap.get(field) != null) { | |
| 201 | + if (map.get(keyMap.get(field)) == null) {// 如果被以上的格式化代码赋值过,则不再过问 | |
| 202 | + map.put(keyMap.get(field), value); | |
| 203 | + } | |
| 204 | + } | |
| 205 | + } | |
| 206 | + } | |
| 207 | + } | |
| 208 | + } catch (Exception e) { | |
| 209 | + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); | |
| 210 | + System.err.println("transBean2FormatAliasMap Error " + e); | |
| 211 | + } | |
| 212 | + return map; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public static void mappingAlias(Object original, Object alias, HashMap<String, String> keyMap) { | |
| 216 | + Map<String, Object> aliasMap = transBean2AliasMap(original, keyMap); | |
| 217 | + transMap2Bean(aliasMap, alias); | |
| 218 | + } | |
| 219 | + | |
| 220 | + public static void mappingFormatAlias(Object original, Object alias, HashMap<String, String> keyMap) { | |
| 221 | + Map<String, Object> aliasMap = transBean2FormatAliasMap(original, keyMap); | |
| 222 | + transMap2FormatBean(aliasMap, alias); | |
| 223 | + } | |
| 224 | + | |
| 225 | + /* | |
| 226 | + * 方便书写映射文件keyMap | |
| 227 | + */ | |
| 228 | + public static void printField(Object obj) { | |
| 229 | + try { | |
| 230 | + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); | |
| 231 | + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); | |
| 232 | + for (PropertyDescriptor property : propertyDescriptors) { | |
| 233 | + String key = property.getName(); | |
| 234 | + // 过滤class属性 | |
| 235 | + if (!key.equals("class")) { | |
| 236 | + System.out.println("\"" + key + "\",//");// "name", | |
| 237 | + } | |
| 238 | + } | |
| 239 | + } catch (Exception e) { | |
| 240 | + System.err.println("printField Error " + e); | |
| 241 | + } | |
| 242 | + } | |
| 243 | + | |
| 244 | + /* | |
| 245 | + * 方便书写 json | |
| 246 | + */ | |
| 247 | + public static void printJsonByArray(String[] args) { | |
| 248 | + System.out.println("{"); | |
| 249 | + for (int i = 0; i < args.length; i++) { | |
| 250 | + String str = "\"" + args[i] + "\":\"666\""; | |
| 251 | + if (i != args.length - 1) { | |
| 252 | + str += ","; | |
| 253 | + } | |
| 254 | + System.out.println(str); | |
| 255 | + } | |
| 256 | + System.out.println("}"); | |
| 257 | + } | |
| 258 | + | |
| 259 | + public static void main(String[] args) { | |
| 260 | + // printField(new WomanHusband()); | |
| 261 | + printJsonByArray(WomanFetationRecordKeymap.alias); | |
| 262 | + } | |
| 263 | + | |
| 264 | +} |