From 17f7a5e85f2234503b6ae22ad966a73cf3ac7ede Mon Sep 17 00:00:00 2001 From: xujiahong Date: Fri, 21 Apr 2017 16:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=8E=A5=E5=8F=A3=EF=BC=88?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E5=AF=B9=E6=8E=A5=E7=89=88=EF=BC=89=EF=BC=9A?= =?UTF-8?q?=E5=AD=95=E5=A6=87=E5=BB=BA=E6=A1=A3=EF=BC=8C=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AF=81=E6=9F=A5=E8=AF=A2=E5=8E=86=E5=8F=B2=E5=BB=BA=E6=A1=A3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8CID=E6=9F=A5=E8=AF=A2=E5=BB=BA?= =?UTF-8?q?=E6=A1=A3=E8=AF=A6=E6=83=85=EF=BC=9B=E5=B0=81=E8=A3=85=E6=96=B0?= =?UTF-8?q?=E6=97=A7=E7=B3=BB=E7=BB=9F=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/woman/WomanFetationRecordMapper.java | 21 +- .../dao/woman/WomanFetationRecordMapper.xml | 20 ++ .../hospital/entity/woman/WomanFetationRecord.java | 187 +++++++++------ .../lyms/hospital/entity/woman/WomanHusband.java | 14 ++ .../service/woman/WomanFetationRecordService.java | 128 +++++----- .../woman/impl/WomanFetationRecordServiceImpl.java | 23 +- .../woman/impl/WomanHusbandServiceImpl.java | 5 +- .../controller/woman/CommonApiController.java | 82 +++++++ .../controller/woman/WomanPregnantController.java | 76 +++++- .../request/woman/WomanFetationRequest.java | 50 +++- .../request/woman/WomanFetationRequestWrapper.java | 20 +- .../response/keymap/WomanFetationRecordKeymap.java | 215 +++++++++++++++++ .../lyms/hospital/util/trans/OldDictionary.java | 65 +++++ .../com/lyms/hospital/util/trans/XjhMapUtil.java | 264 +++++++++++++++++++++ 14 files changed, 1017 insertions(+), 153 deletions(-) create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java index 71012db..d053b78 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java @@ -2,8 +2,13 @@ package com.lyms.hospital.dao.woman; import com.lyms.hospital.entity.woman.WomanFetationRecord; import com.baomidou.mybatisplus.mapper.BaseMapper; + +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.io.Serializable; +import java.util.List; +import java.util.Map; + /** *

* Mapper接口 @@ -15,6 +20,20 @@ import java.io.Serializable; @Repository public interface WomanFetationRecordMapper extends BaseMapper { - public Integer deleteLogicById(Serializable id); + public Integer deleteLogicById(Serializable id); + + /** + *

  • @Description:查询-查询历史建档记录(by证件信息和就诊卡号) + *
  • @param cardType + *
  • @param cardNo + *
  • @param vcCardNo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月20日 + *
  • 修改人: + *
  • 修改时间: + */ + public List> selectHistory(@Param("cardType") String cardType, @Param("cardNo") String cardNo, + @Param("vcCardNo") String vcCardNo); } \ No newline at end of file diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml index f5abc68..9288398 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml @@ -62,4 +62,24 @@ 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 + + + diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java index 611ea70..cae90ac 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java @@ -50,11 +50,6 @@ public class WomanFetationRecord implements Serializable { @TableField(value="BASE_WOMAN_NATION") private String baseWomanNation; /** - * 孕妇出生 - */ - @TableField(value="BASE_WOMAN_BIRTH") - private Date baseWomanBirth; - /** * 户籍类型 */ @TableField(value="BASE_REGISTER_TYPE") @@ -164,21 +159,7 @@ public class WomanFetationRecord implements Serializable { */ @TableField(value="CONTACT_POSTPARTUM_DETAIL") private String contactPostpartumDetail; - /** - * 末次月经 - */ - @TableField(value="HOSPITAL_LAST_MENSTRUATION") - private Date hospitalLastMenstruation; - /** - * 纠正末次月经 - */ - @TableField(value="HOSPITAL_CORRECT_LAST_MENSTRUATION") - private Date hospitalCorrectLastMenstruation; - /** - * 预产期 - */ - @TableField(value="HOSPITAL_EXPECTED_DATE") - private Date hospitalExpectedDate; + /** * 就诊卡 */ @@ -214,11 +195,7 @@ public class WomanFetationRecord implements Serializable { */ @TableField(value="HOSPITAL_RECORD_DOCTOR") private String hospitalRecordDoctor; - /** - * 建档日期 - */ - @TableField(value="HOSPITAL_RECORD_DATE") - private Date hospitalRecordDate; + /** * 档案备注 */ @@ -279,8 +256,45 @@ public class WomanFetationRecord implements Serializable { */ @TableField(value="WOMAN_PERSON_ID") private String womanPersonId; - + + /** + * 孕妇出生============================================================================ + */ + @TableField(value="BASE_WOMAN_BIRTH") + private Date baseWomanBirth; + /** + * 末次月经 + */ + @TableField(value="HOSPITAL_LAST_MENSTRUATION") + private Date hospitalLastMenstruation; + /** + * 纠正末次月经 + */ + @TableField(value="HOSPITAL_CORRECT_LAST_MENSTRUATION") + private Date hospitalCorrectLastMenstruation; + /** + * 预产期 + */ + @TableField(value="HOSPITAL_EXPECTED_DATE") + private Date hospitalExpectedDate; + /** + * 建档日期 + */ + @TableField(value="HOSPITAL_RECORD_DATE") + private Date hospitalRecordDate; + + //格式化字段 + @TableField(exist=false) + private String baseWomanBirthStr;//孕妇生日Str + @TableField(exist=false) + private String hospitalLastMenstruationStr;//末次月经Str + @TableField(exist=false) + private String hospitalCorrectLastMenstruationStr;//纠正末次月经Str + @TableField(exist=false) + private String hospitalExpectedDateStr;//预产期Str + @TableField(exist=false) + private String hospitalRecordDateStr;//建档日期Str public String getId() { return id; @@ -330,14 +344,6 @@ public class WomanFetationRecord implements Serializable { this.baseWomanNation = baseWomanNation; } - public Date getBaseWomanBirth() { - return baseWomanBirth; - } - - public void setBaseWomanBirth(Date baseWomanBirth) { - this.baseWomanBirth = baseWomanBirth; - } - public String getBaseRegisterType() { return baseRegisterType; } @@ -514,30 +520,6 @@ public class WomanFetationRecord implements Serializable { this.contactPostpartumDetail = contactPostpartumDetail; } - public Date getHospitalLastMenstruation() { - return hospitalLastMenstruation; - } - - public void setHospitalLastMenstruation(Date hospitalLastMenstruation) { - this.hospitalLastMenstruation = hospitalLastMenstruation; - } - - public Date getHospitalCorrectLastMenstruation() { - return hospitalCorrectLastMenstruation; - } - - public void setHospitalCorrectLastMenstruation(Date hospitalCorrectLastMenstruation) { - this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; - } - - public Date getHospitalExpectedDate() { - return hospitalExpectedDate; - } - - public void setHospitalExpectedDate(Date hospitalExpectedDate) { - this.hospitalExpectedDate = hospitalExpectedDate; - } - public String getHospitalPatientCard() { return hospitalPatientCard; } @@ -594,14 +576,6 @@ public class WomanFetationRecord implements Serializable { this.hospitalRecordDoctor = hospitalRecordDoctor; } - public Date getHospitalRecordDate() { - return hospitalRecordDate; - } - - public void setHospitalRecordDate(Date hospitalRecordDate) { - this.hospitalRecordDate = hospitalRecordDate; - } - public String getHospitalRecordRemark() { return hospitalRecordRemark; } @@ -697,5 +671,86 @@ public class WomanFetationRecord implements Serializable { public void setWomanPersonId(String womanPersonId) { this.womanPersonId = womanPersonId; } + + //==========================带格式化的字段================================ + + + public Date getBaseWomanBirth() { + return baseWomanBirth; + } + + public void setBaseWomanBirth(Date baseWomanBirth) { + this.baseWomanBirth = baseWomanBirth; + } + public Date getHospitalLastMenstruation() { + return hospitalLastMenstruation; + } + + public void setHospitalLastMenstruation(Date hospitalLastMenstruation) { + this.hospitalLastMenstruation = hospitalLastMenstruation; + } + + public Date getHospitalCorrectLastMenstruation() { + return hospitalCorrectLastMenstruation; + } + + public void setHospitalCorrectLastMenstruation(Date hospitalCorrectLastMenstruation) { + this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; + } + + public Date getHospitalExpectedDate() { + return hospitalExpectedDate; + } + + public void setHospitalExpectedDate(Date hospitalExpectedDate) { + this.hospitalExpectedDate = hospitalExpectedDate; + } + public Date getHospitalRecordDate() { + return hospitalRecordDate; + } + public void setHospitalRecordDate(Date hospitalRecordDate) { + this.hospitalRecordDate = hospitalRecordDate; + } + + public String getBaseWomanBirthStr() { + return baseWomanBirthStr; + } + + public void setBaseWomanBirthStr(String baseWomanBirthStr) { + this.baseWomanBirthStr = baseWomanBirthStr; + } + + public String getHospitalLastMenstruationStr() { + return hospitalLastMenstruationStr; + } + + public void setHospitalLastMenstruationStr(String hospitalLastMenstruationStr) { + this.hospitalLastMenstruationStr = hospitalLastMenstruationStr; + } + + public String getHospitalCorrectLastMenstruationStr() { + return hospitalCorrectLastMenstruationStr; + } + + public void setHospitalCorrectLastMenstruationStr(String hospitalCorrectLastMenstruationStr) { + this.hospitalCorrectLastMenstruationStr = hospitalCorrectLastMenstruationStr; + } + + public String getHospitalExpectedDateStr() { + return hospitalExpectedDateStr; + } + + public void setHospitalExpectedDateStr(String hospitalExpectedDateStr) { + this.hospitalExpectedDateStr = hospitalExpectedDateStr; + } + + public String getHospitalRecordDateStr() { + return hospitalRecordDateStr; + } + + public void setHospitalRecordDateStr(String hospitalRecordDateStr) { + this.hospitalRecordDateStr = hospitalRecordDateStr; + } + } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java index f9062ce..4f26f44 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanHusband.java @@ -134,6 +134,11 @@ public class WomanHusband implements Serializable { */ @TableField(value="CREATE_TIME") private Date createTime; + + //格式化字段 + @TableField(exist=false) + private String husbandBirthStr; + public String getId() { @@ -312,6 +317,15 @@ public class WomanHusband implements Serializable { this.createTime = createTime; } + public String getHusbandBirthStr() { + return husbandBirthStr; + } + + public void setHusbandBirthStr(String husbandBirthStr) { + this.husbandBirthStr = husbandBirthStr; + } + + } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java index ba93b43..450a78a 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java @@ -1,6 +1,7 @@ package com.lyms.hospital.service.woman; import java.io.Serializable; +import java.util.List; import java.util.Map; import com.lyms.hospital.entity.woman.WomanFetationRecord; @@ -10,16 +11,29 @@ import com.lyms.web.service.BaseService; /** *

    * 服务类 - *

    * (单表)新增-孕妇档案表记录 - * 查询-根据孕妇建档ID查询表单详情 + * 查询-根据孕妇建档ID查询表单详情 + * 查询-查询历史建档记录(by证件信息和就诊卡号) + *

    * * @author fangcheng,xujiahong * @since 2017-03-31 */ public interface WomanFetationRecordService extends BaseService { - - + + /** + *
  • @Description:查询-查询历史建档记录(by证件信息和就诊卡号) + *
  • @param cardType + *
  • @param cardNo + *
  • @param vcCardNo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月20日 + *
  • 修改人: + *
  • 修改时间: + */ + public List> selectHistory(String cardType, String cardNo, String vcCardNo); + /** *
  • @Description:查询-根据孕妇建档ID查询表单详情 *
  • @return @@ -28,62 +42,62 @@ public interface WomanFetationRecordService extends BaseService修改人: *
  • 修改时间: */ - public Map selectWomanFetationMapById(String id); + public Map selectWomanFetationMapById(String id); + + /** + *
  • @Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 + *
  • @param id 删除主键id + *
  • @return 大于0修改成功,否则为失败 + */ + public Integer deleteLogicById(Serializable id); - /** - *
  • @Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 - *
  • @param id 删除主键id - *
  • @return 大于0修改成功,否则为失败 - */ - public Integer deleteLogicById(Serializable id); - - /** - *
  • @Description:(单表)新增-孕妇档案表记录 - *
  • @param womanFetationRecord - *
  • @return - *
  • 创建人:xujiahong - *
  • 创建时间:2017年4月18日 - *
  • 修改人: - *
  • 修改时间: - */ - public String create(WomanFetationRecord womanFetationRecord); + /** + *
  • @Description:(单表)新增-孕妇档案表记录 + *
  • @param womanFetationRecord + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月18日 + *
  • 修改人: + *
  • 修改时间: + */ + public String create(WomanFetationRecord womanFetationRecord); - /** - *
  • @Description:添加孕妇建档 - *
  • @param womanRecord - *
  • @param womanHusband - *
  • @return - *
  • 创建人:方承 - *
  • 创建时间:2017年3月31日 - *
  • 修改人: - *
  • 修改时间: - */ - public boolean insertbuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); + /** + *
  • @Description:添加孕妇建档 + *
  • @param womanRecord + *
  • @param womanHusband + *
  • @return + *
  • 创建人:方承 + *
  • 创建时间:2017年3月31日 + *
  • 修改人: + *
  • 修改时间: + */ + public boolean insertbuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); - /** - *
  • @Description:修改孕妇建档 - *
  • @param womanRecord - *
  • @param womanHusband - *
  • @return - *
  • 创建人:方承 - *
  • 创建时间:2017年3月31日 - *
  • 修改人: - *
  • 修改时间: - */ - public boolean updatebuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); + /** + *
  • @Description:修改孕妇建档 + *
  • @param womanRecord + *
  • @param womanHusband + *
  • @return + *
  • 创建人:方承 + *
  • 创建时间:2017年3月31日 + *
  • 修改人: + *
  • 修改时间: + */ + public boolean updatebuildRecord(WomanFetationRecord womanFetationRecord, WomanHusband womanHusband); - /** - *
  • @Description:根据【证件类型和号码】【就诊卡和机构id】获取孕妇档案信息 - *
  • @param cardType 证件类型 - *
  • @param cardNum 证件编号 - *
  • @param patientNum 就诊卡号 - *
  • @param orgid 机构id - *
  • @return - *
  • 创建人:方承 - *
  • 创建时间:2017年3月31日 - *
  • 修改人: - *
  • 修改时间: - */ - public WomanFetationRecord findByCard(String cardType, String cardNum,String patientNum,String orgid); + /** + *
  • @Description:根据【证件类型和号码】【就诊卡和机构id】获取孕妇档案信息 + *
  • @param cardType 证件类型 + *
  • @param cardNum 证件编号 + *
  • @param patientNum 就诊卡号 + *
  • @param orgid 机构id + *
  • @return + *
  • 创建人:方承 + *
  • 创建时间:2017年3月31日 + *
  • 修改人: + *
  • 修改时间: + */ + public WomanFetationRecord findByCard(String cardType, String cardNum, String patientNum, String orgid); } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java index c8f5146..9dbb81a 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java @@ -2,6 +2,7 @@ package com.lyms.hospital.service.woman.impl; import java.io.Serializable; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -15,6 +16,8 @@ import com.lyms.exception.SystemException; import com.lyms.hospital.dao.woman.WomanFetationRecordMapper; import com.lyms.hospital.entity.woman.WomanFetationRecord; import com.lyms.hospital.entity.woman.WomanHusband; +import com.lyms.hospital.enums.IfdelEnum; +import com.lyms.hospital.enums.StatusEnum; import com.lyms.hospital.service.woman.WomanFetationRecordService; import com.lyms.hospital.service.woman.WomanHusbandService; import com.lyms.hospital.service.woman.WomanPersonService; @@ -36,6 +39,8 @@ public class WomanFetationRecordServiceImpl extends ServiceImpl dataList = baseMapper.selectList(ew); return CollectionUtils.isNotEmpty(dataList) ? dataList.get(0) : null; @@ -96,6 +101,8 @@ public class WomanFetationRecordServiceImpl extends ServiceImpl map = new HashMap<>(); WomanFetationRecord fetationRecord = this.selectById(id); if(fetationRecord!=null){ - WomanHusband wh = womanHusbandService.selectByTarget(WomanHusband.TARGET_TYPE_ARCHIVE, fetationRecord.getId()); + WomanHusband womanHusband = womanHusbandService.selectByTarget(WomanHusband.TARGET_TYPE_ARCHIVE, fetationRecord.getId()); + map.put("fetationRecord", fetationRecord); + map.put("womanHusband", womanHusband); } - return null; + return map; + } + + @Override + public List> selectHistory(String cardType, String cardNo, String vcCardNo) { + return fetationMapper.selectHistory(cardType, cardNo, vcCardNo); } } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java index 1bdb915..b38fe24 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanHusbandServiceImpl.java @@ -55,6 +55,7 @@ public class WomanHusbandServiceImpl extends ServiceImpl ew = new EntityWrapper(); ew.where("TARGET_ID={0}", obj.getTargetId()); delete(ew); + //插入 String id = StrUtils.uuid(); obj.setId(id); obj.setCreateTime(new java.util.Date()); @@ -75,8 +76,8 @@ public class WomanHusbandServiceImpl extends ServiceImpl wrapper = new EntityWrapper<>(); - wrapper.where("TARGET_TYPE", targetType); - wrapper.and("TARGET_ID", targetId); + wrapper.where("TARGET_TYPE={0}", targetType); + wrapper.and("TARGET_ID={0}", targetId); List list = baseMapper.selectList(wrapper); if(list.size()>1){ throw new SystemException("发现多条匹配记录"); diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java new file mode 100644 index 0000000..6588895 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java @@ -0,0 +1,82 @@ +package com.lyms.hospital.controller.woman; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.lyms.hospital.util.trans.OldDictionary; +import com.lyms.hospital.util.trans.XjhMapUtil; +import com.lyms.web.bean.AjaxResult; +import com.lyms.web.controller.BaseController; + +/** + *

    + * 公用接口-前端控制器 + *

    + * + * @author xujiahong + * @since 2017-04-21 + */ +@Controller +@RequestMapping("/commonApi") +public class CommonApiController extends BaseController { + + @RequestMapping(value = "/queryDictionary", method = RequestMethod.GET) + @ResponseBody + public AjaxResult queryDictionary (){ + //TODO 模拟查询数据字典的数据 + Map dictionary = new HashMap<>(); + /*户口类型*/ + List> censusType = new ArrayList<>(); + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("001", "非农业户口"))); + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("002", "农业户口"))); + /*证件类型*/ + List> certeType = new ArrayList<>(); + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("003", "身份证"))); + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("004", "手机号"))); + /*国家*/ + List> country = new ArrayList<>(); + country.add(XjhMapUtil.transBean2Map(new OldDictionary("005", "中国"))); + country.add(XjhMapUtil.transBean2Map(new OldDictionary("006", "美国"))); + /*vip体验类型*/ + List> expYunEnums = new ArrayList<>(); + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("007", "vip体验类型1"))); + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("008", "vip体验类型2"))); + /*居住类型*/ + List> liveType = new ArrayList<>(); + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("009", "本地"))); + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("010", "非本地"))); + /*民族*/ + List> nation = new ArrayList<>(); + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("011", "汉族"))); + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("012", "白族"))); + /*职业类型*/ + List> professionType = new ArrayList<>(); + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("013", "医生"))); + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("014", "教师"))); + /*服务状态*/ + List> serviceStatus = new ArrayList<>(); + serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("015", "开通"))); + serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("016", "未开通"))); + /*服务类型*/ + List> serviceType = new ArrayList<>(); + serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("017", "标准服务"))); + serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("018", "增值服务"))); + dictionary.put("censusType", censusType); + dictionary.put("certeType", certeType); + dictionary.put("country", country); + dictionary.put("expYunEnums", expYunEnums); + dictionary.put("liveType", liveType); + dictionary.put("nation", nation); + dictionary.put("professionType", professionType); + dictionary.put("serviceStatus", serviceStatus); + dictionary.put("serviceType", serviceType); + return AjaxResult.returnSuccess(dictionary); + } +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java index ffc7d78..7c271be 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java @@ -1,5 +1,10 @@ package com.lyms.hospital.controller.woman; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; @@ -11,8 +16,12 @@ import com.lyms.hospital.entity.woman.WomanFetationRecord; import com.lyms.hospital.entity.woman.WomanHusband; import com.lyms.hospital.request.woman.WomanFetationRequest; import com.lyms.hospital.request.woman.WomanFetationRequestWrapper; +import com.lyms.hospital.response.keymap.WomanFetationRecordKeymap; +import com.lyms.hospital.response.woman.WomanFetationResponse; import com.lyms.hospital.service.token.TokenService; import com.lyms.hospital.service.woman.WomanFetationRecordService; +import com.lyms.hospital.util.trans.XjhMapUtil; +import com.lyms.util.DateUtil; import com.lyms.web.bean.AjaxResult; import com.lyms.web.controller.BaseController; @@ -21,8 +30,8 @@ import com.lyms.web.controller.BaseController; * 孕妇档案-前端控制器 *

    * - * 依据cardNo或vcCardNo查询孕妇档案 - * 孕妇建档(新增或修改) + * []依据cardNo或vcCardNo查询孕妇档案 + * []孕妇建档(新增或修改) * 依据id得到“孕妇建档”表单详情 * * @author xujiahong @@ -38,6 +47,36 @@ public class WomanPregnantController extends BaseController { private TokenService tokenService; /** + *
  • @Description:依据id得到“孕妇建档”表单详情 + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月20日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/queryPregnantBuildById", method = RequestMethod.GET) + @ResponseBody + public AjaxResult queryPregnantBuildById(String id){ + //查询详情相关对象 + Map map = fetationService.selectWomanFetationMapById(id); + WomanFetationRecord fetationRecord = (WomanFetationRecord)map.get("fetationRecord"); + WomanHusband womanHusband = (WomanHusband)map.get("womanHusband"); + //转换为与前端对接的response对象 + Map fetationRecordMap = XjhMapUtil.transBean2FormatAliasMap(fetationRecord, + XjhMapUtil.getKeyMap(WomanFetationRecordKeymap.original, WomanFetationRecordKeymap.alias)); + Map womanHusbandMap = XjhMapUtil.transBean2FormatAliasMap(womanHusband, + XjhMapUtil.getKeyMap(WomanFetationRecordKeymap.original, WomanFetationRecordKeymap.alias)); + fetationRecordMap.putAll(womanHusbandMap); + + System.out.println(fetationRecordMap); + WomanFetationResponse response = (WomanFetationResponse)XjhMapUtil.transMap2Bean(fetationRecordMap, new WomanFetationResponse()); + response.setId(fetationRecord.getId()); + response.setPid(fetationRecord.getWomanPersonId()); + return AjaxResult.returnSuccess(response); + } + + /** *
  • @Description:依据cardNo或vcCardNo查询孕妇档案 *
  • @param cardNo *
  • @param vcCardNo @@ -49,9 +88,17 @@ public class WomanPregnantController extends BaseController { */ @RequestMapping(value = "/queryPregnantBuildRecord", method = RequestMethod.GET) @ResponseBody - public AjaxResult queryPregnantBuildRecord(String cardNo,String vcCardNo){ - //TODO - return AjaxResult.returnFail(); + public AjaxResult queryPregnantBuildRecord(String cardType,String cardNo,String vcCardNo){ + +// System.out.println("cardType:"+cardType+"cardNo:"+cardNo+"vcCardNo:"+vcCardNo); + + //TODO 查询历史建档记录 + List> history = fetationService.selectHistory(cardType, cardNo, vcCardNo); + + Map dataMap = new HashMap<>(); + dataMap.put("history", history); + dataMap.put("now", DateUtil.getyyyy_MM_dd(new Date())); + return AjaxResult.returnSuccess(dataMap); } /** @@ -73,17 +120,24 @@ public class WomanPregnantController extends BaseController { WomanFetationRecord womanFetationRecord = wrapper.getWomanFetationRecord(); WomanHusband womanHusband = wrapper.getWomanHusband(); /* - * 业务逻辑: - * (1)查询档案信息的存在性 - * (2)若不存在则新增,若存在则修改 + * 需求: + * (1)同一孕妇在不同医院(orgId)对应两份档案 + * (2)TODO 同一医院同一孕妇,多个产程对应多个档案 */ + //查询档案信息的存在性 WomanFetationRecord dbObj = fetationService.findByCard( request.getPregnantCertificateTypeId(), request.getPregnantCertificateNum(), request.getVcCardNo(), request.getHospitalId()); boolean flag = false; - if(dbObj==null){//新增 - flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband); - }else{//修改 + if(request.getId()==null){//新增 + if(dbObj!=null){//本院已有档案,修改现有档案 + womanFetationRecord.setId(dbObj.getId()); + womanHusband.setTargetId(dbObj.getId()); + flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband); + }else{ + flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband); + } + }else{//修改 flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband); } if(flag){ diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java b/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java index 6f98306..304789c 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequest.java @@ -14,14 +14,28 @@ import com.lyms.hospital.util.FormParam; @Form public class WomanFetationRequest { + + + /* + * 新字段 since 2017-04-21 10:33:43 + */ + + private String womanHusbandId;// 【新】配偶信息ID + private String baseFamilyIncome;//家庭收入 + private String husbandBirthStr;//【新字段】出生日期 + private String hospitalCorrectLastMenstruation;//【新字段】纠正末次月经 + private String hospitalBarcode;//【新字段】条码 + + /* + * 新字段 since 2017-04-21 10:33:43 + */ + // 建档ID private String id; // 女性居民ID @FormParam private String pid; - // 【新】配偶信息ID - private String womanHusbandId; /*********** 孕妇基本信息 ***********/ @@ -623,5 +637,37 @@ public class WomanFetationRequest { public void setWomanHusbandId(String womanHusbandId) { this.womanHusbandId = womanHusbandId; } + + public String getBaseFamilyIncome() { + return baseFamilyIncome; + } + + public void setBaseFamilyIncome(String baseFamilyIncome) { + this.baseFamilyIncome = baseFamilyIncome; + } + + public String getHusbandBirthStr() { + return husbandBirthStr; + } + + public void setHusbandBirthStr(String husbandBirthStr) { + this.husbandBirthStr = husbandBirthStr; + } + + public String getHospitalCorrectLastMenstruation() { + return hospitalCorrectLastMenstruation; + } + + public void setHospitalCorrectLastMenstruation(String hospitalCorrectLastMenstruation) { + this.hospitalCorrectLastMenstruation = hospitalCorrectLastMenstruation; + } + + public String getHospitalBarcode() { + return hospitalBarcode; + } + + public void setHospitalBarcode(String hospitalBarcode) { + this.hospitalBarcode = hospitalBarcode; + } } diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java b/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java index baaa222..3f4b5dd 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/request/woman/WomanFetationRequestWrapper.java @@ -23,7 +23,7 @@ public class WomanFetationRequestWrapper { womanFetationRecord.setId(req.getId()); womanHusband.setTargetId(req.getId()); /* - * 孕妇基本信息 + * 孕妇基本信息(10+1) */ womanFetationRecord.setBaseWomanName(req.getPregnantName());//孕妇姓名 womanFetationRecord.setBasePapersType(req.getPregnantCertificateTypeId());//孕妇证件类型 @@ -34,10 +34,10 @@ public class WomanFetationRequestWrapper { womanFetationRecord.setBaseRegisterType(req.getPregnantCensusTypeId());//孕妇户籍类型 womanFetationRecord.setBaseDwellType(req.getPregnantLiveTypeId());//孕妇居住类别 womanFetationRecord.setBaseOccupationType(req.getPregnantProfessionTypeId());//孕妇职业类别 - womanFetationRecord.setBaseWomanCulture("");//【新】文化程度========================== - womanFetationRecord.setBaseFamilyIncome("");//【新】家庭收入========================== + womanFetationRecord.setBaseWomanCulture(req.getPregnantLevelTypeId());//文化程度 + womanFetationRecord.setBaseFamilyIncome(req.getBaseFamilyIncome());//【新】家庭收入========================== /* - * 孕妇联系方式 + * 孕妇联系方式(17) */ womanFetationRecord.setContactWomanWay(req.getPregnantPhone());//孕妇电话 womanFetationRecord.setContactWorkAddress(req.getPregnantWorkUnit());//孕妇工作单位 @@ -64,11 +64,11 @@ public class WomanFetationRequestWrapper { */ womanFetationRecord.setHospitalLastMenstruation(DateUtil.parseYMD(req.getLastMenstrualPeriod()));//末次月经 //【新】纠正末次月经================ - womanFetationRecord.setHospitalCorrectLastMenstruation(null); + womanFetationRecord.setHospitalCorrectLastMenstruation(DateUtil.parseYMD(req.getHospitalCorrectLastMenstruation())); womanFetationRecord.setHospitalExpectedDate(DateUtil.parseYMD(req.getDueDate()));//预产期 womanFetationRecord.setHospitalPatientCard(req.getVcCardNo());//就诊卡号 //【新】条码===================== - womanFetationRecord.setHospitalBarcode(null); + womanFetationRecord.setHospitalBarcode(req.getHospitalBarcode()); womanFetationRecord.setHospitalServiceType(req.getServiceType()+"");//服务类型 womanFetationRecord.setHospitalServiceStatus(req.getServiceStatus()+"");//服务状态 womanFetationRecord.setHospitalRecordNumber(req.getFileCode());//档案编号 @@ -86,7 +86,7 @@ public class WomanFetationRequestWrapper { //【新】建档来源===================== womanFetationRecord.setBuildType(null);//建档来源 /* - * 丈夫信息 + * 丈夫信息(14+1) */ womanHusband.setHusbandName(req.getHusbandName());//丈夫姓名 womanHusband.setHusbandPapersType(req.getHusbandCertificateTypeId());//丈夫证件类型 @@ -94,9 +94,8 @@ public class WomanFetationRequestWrapper { womanHusband.setHusbandCountry(req.getHusbandCountryId());//丈夫国籍 womanHusband.setHusbandNation(req.getHusbandNationId());//丈夫民族 //【新】丈夫出生日期===================== - womanHusband.setHusbandBirth(null); - //【新】丈夫文化程度===================== - womanHusband.setHusbandCulture(null); + womanHusband.setHusbandBirth(DateUtil.parseYMD(req.getHusbandBirthStr())); + womanHusband.setHusbandCulture(req.getHusbandLevelTypeId());//丈夫文化程度 womanHusband.setHusbandWay(req.getHusbandPhone());//丈夫联系方式 womanHusband.setHusbandOccupationType(req.getHusbandProfessionTypeId());//丈夫职业类别 womanHusband.setHusbandWorkAddress(req.getHusbandWorkUnit());//丈夫工作单位 @@ -105,6 +104,7 @@ public class WomanFetationRequestWrapper { womanHusband.setHusbandRegisterArea(req.getHusbandAreaRegisterId());//丈夫居住地区县 womanHusband.setHusbandRegisterStreet(req.getHusbandStreetRegisterId());//丈夫居住地乡镇街道 womanHusband.setHusbandRegisterDetail(req.getHusbandAddressRegister());//丈夫居住地详细地址 + womanHusband.setTargetType(WomanHusband.TARGET_TYPE_ARCHIVE);//配偶信息来源于孕妇建档 } } diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java b/parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java new file mode 100644 index 0000000..c67dcd4 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/response/keymap/WomanFetationRecordKeymap.java @@ -0,0 +1,215 @@ +package com.lyms.hospital.response.keymap; + +/** + * 孕妇建档-新老系统字段名映射 + * @author xujiahong + * + */ +public class WomanFetationRecordKeymap { + + /* + 【未映射字段(需要手动get,set)】 + WomanFetationRecord==================== + + "hospitalMember",//会员预约时间??? + "hospitalMemberDate",//体验到期时间 + + "buildDate",//建档时间 + "buildType",//建档来源 + "createId",// + "createTime",// + "enalble",// + "id",// + "ifdel",// + "modifyId",// + "modifyTime",// + "womanPersonId"//女性居民表ID + + WomanHusband=============================== + "bloodRelation",// + "bloodRelationText",// + "createTime",// + "id",// + "isProvide",// + "targetId",// + "targetType",// + + WomanFetationResponse===================== + "id",//建档Id + "pid", + + 【删除字段】 + "expType",//vip体验类型 + "expVip",//vip体验 + "vipEndTime",//vip体验结束日期 + "dueStatus"//分娩状态 0未终止妊娠 1终止妊娠 + 【新增字段】 + "baseFamilyIncome",//【新字段】家庭收入 + "husbandBirth",//【新字段】出生日期 + "hospitalCorrectLastMenstruation",//【新字段】纠正末次月经 + "hospitalBarcode",//【新字段】条码 + 【】 + + */ + + public static String[] original = { + /* + * 孕妇基本信息(10+1) + */ + "baseWomanName", + "basePapersType", + "basePapersNumber", + "baseWomanCountry", + "baseWomanNation", + "baseWomanBirthStr", + "baseRegisterType",//户籍类别 + "baseDwellType",//居住类别 + "baseOccupationType",//职业类别 + "baseWomanCulture",//文化程度 + "baseFamilyIncome",//【新字段】家庭收入 + /* + * 孕妇联系方式(17=) + */ + "contactWomanWay", + "contactWorkAddress", + //居住地:省、市、区、乡镇街道、详细地址 + "contactDwellProvince", + "contactDwellCity", + "contactDwellArea", + "contactDwellStreet", + "contactDwellDetail", + //户籍地址:省、市、区、乡镇街道、详细地址 + "contactRegisterProvince", + "contactRegisterCity", + "contactRegisterArea", + "contactRegisterStreet", + "contactRegisterDetail", + //产后修养地:省、市、区、乡镇街道、详细地址 + "contactPostpartumProvince", + "contactPostpartumCity", + "contactPostpartumArea", + "contactPostpartumStreet", + "contactPostpartumDetail", + /* + * 丈夫信息(=======14+1) + */ + "husbandName",// + "husbandPapersType",// + "husbandPapersNumber",// + "husbandCountry",// + "husbandNation",// + "husbandBirthStr",//【新字段】出生日期 + "husbandOccupationType",// + "husbandCulture",// + "husbandWay",// + "husbandWorkAddress",// + + "husbandRegisterProvince",// + "husbandRegisterCity",// + "husbandRegisterArea",// + "husbandRegisterStreet",// + "husbandRegisterDetail",// + + + /* + * 孕妇院内信息(========14+2-4) + */ + "hospitalLastMenstruationStr",//末次月经 + "hospitalCorrectLastMenstruationStr",//【新字段】纠正末次月经 + "hospitalExpectedDateStr",//预产期 + "hospitalPatientCard",//就诊卡 + "hospitalBarcode",//【新字段】条码 + "hospitalRecordNumber",//档案编号 + "hospitalServiceType",//服务类型 + "hospitalServiceStatus",//服务状态 + + "hospitalRecordDoctor",//建档医生 + "hostpitalId",//建档医院 + "hospitalRecordDateStr",//建档日期 + "hospitalRecordRemark",//档案备注 + + }; + + public static String[] alias = { + /* + * 孕妇基本信息(10+1) + */ + "pregnantName", + "pregnantCertificateTypeId", + "pregnantCertificateNum", + "pregnantCountryId", + "pregnantNationId", + "birthday", + "pregnantCensusTypeId",//户籍类别 + "pregnantLiveTypeId",//居住类别 + "pregnantProfessionTypeId",//职业类别 + "pregnantLevelTypeId",//文化程度 + "baseFamilyIncome",//【新字段】家庭收入 + /* + * 孕妇联系方式(17=) + */ + "pregnantPhone", + "pregnantWorkUnit", + //居住地:省、市、区、乡镇街道、详细地址 + "pregnantLiveProvinceId", + "pregnantLiveCityId", + "pregnantLiveAreaId", + "pregnantLiveStreetId", + "pregnantLiveAddr", + //户籍地址:省、市、区、乡镇街道、详细地址 + "pregnantCensusProvinceId", + "pregnantCensusCityId", + "pregnantCensusAreaId", + "pregnantCensusStreetId", + "pregnantCensusAddr", + //产后修养地:省、市、区、乡镇街道、详细地址 + "childbirthProvinceId", + "childbirthCityId", + "childbirthAreaId", + "childbirthStreetId", + "childbirthAddr", + /* + * 丈夫信息(14+1) + */ + "husbandName", + "husbandCertificateTypeId", + "husbandCertificateNum", + "husbandCountryId", + "husbandNationId", + "husbandBirthStr",//【新字段】出生日期 + "husbandProfessionTypeId",//职业类别 + "husbandLevelTypeId",//丈夫文化程度 + "husbandPhone", + "husbandWorkUnit", + //地址 + "husbandProvinceRegisterId", + "husbandCityRegisterId", + "husbandAreaRegisterId", + "husbandStreetRegisterId", + "husbandAddressRegister", + + /* + * 孕妇院内信息(14+2-4) + */ + "lastMenstrualPeriod",//末次月经 + "hospitalCorrectLastMenstruation",//【新字段】纠正末次月经 + "dueDate",//预产期 + "vcCardNo",//就诊卡号 + "hospitalBarcode",//【新字段】条码 + "fileCode",//档案编号 + "serviceType",//服务类型 + "serviceStatus",//服务状态 + + "bookbuildingDoctor",//建档医生ID + "hospitalId",//建档医院ID + "bookbuildingDate",//建档日期 + "mremark",//备注 + +// "expType",//vip体验类型 +// "expVip",//vip体验 +// "vipEndTime",//vip体验结束日期 +// "dueStatus"//分娩状态 0未终止妊娠 1终止妊娠 + + }; + +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java b/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java new file mode 100644 index 0000000..1d99f04 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java @@ -0,0 +1,65 @@ +package com.lyms.hospital.util.trans; + +public class OldDictionary { + + private String id; + private String hildConfigs; + private String code; + private String desc; + private Integer enable; + private String name; + private String parentId; + + public OldDictionary(){} + + public OldDictionary(String id,String name){ + this.id = id; + this.name = name; + this.enable = 1; + } + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getHildConfigs() { + return hildConfigs; + } + public void setHildConfigs(String hildConfigs) { + this.hildConfigs = hildConfigs; + } + public String getCode() { + return code; + } + public void setCode(String code) { + this.code = code; + } + public String getDesc() { + return desc; + } + public void setDesc(String desc) { + this.desc = desc; + } + public Integer getEnable() { + return enable; + } + public void setEnable(Integer enable) { + this.enable = enable; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getParentId() { + return parentId; + } + public void setParentId(String parentId) { + this.parentId = parentId; + } + + +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java b/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java new file mode 100644 index 0000000..c71de01 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java @@ -0,0 +1,264 @@ +package com.lyms.hospital.util.trans; + +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import com.lyms.hospital.response.keymap.WomanFetationRecordKeymap; +import com.lyms.util.DateUtil; + +public class XjhMapUtil { + + /** + * 简单处理映射字段类型不匹配的情况 + * @param property 目标字段Bean相关信息 + * @param value 目标字段值 + * @param obj 对象 + * @author xujiahong + * @throws InvocationTargetException + * @throws IllegalArgumentException + * @throws IllegalAccessException + */ + private static void invokeIgnoreType(PropertyDescriptor property,Object value,Object obj) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{ + Class keyType = property.getPropertyType(); + Class valueType = value.getClass(); + // 得到property对应的setter方法 + Method setter = property.getWriteMethod(); + //简单处理映射字段类型不匹配的情况 + if (keyType.equals(valueType)) { + setter.invoke(obj, value); + } else { + if(keyType.equals(String.class)){ + setter.invoke(obj, value.toString()); + }else if(keyType.equals(Integer.class)){ + setter.invoke(obj, Integer.parseInt(value.toString())); + }else if(keyType.equals(Double.class)){ + setter.invoke(obj, Double.parseDouble(value.toString())); + }else{ + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("字段【"+property.getName()+"】没有可匹配的自动转换类型"); + } + } + } + + public static Object transMap2Bean(Map map, Object obj) { + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + if (map.containsKey(key)) { + Object value = map.get(key); + invokeIgnoreType(property,value,obj); + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transMap2Bean Error " + e); + } + return obj; + } + + // 自动处理时间字段和对应的字符串字段(Str结尾) + public static Object transMap2FormatBean(Map map, Object obj) { + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + Class keyType = property.getPropertyType(); + // set当前字段 + if (map.containsKey(key)) { + Object value = map.get(key); + invokeIgnoreType(property,value,obj); + + /* + * 自动处理时间字段和对应的字符串字段(Str结尾) + */ + if (keyType.equals(String.class) && key.length() > 3 + && "Str".equals(key.substring(key.length() - 3))) {// key可能是格式化字段 + String dateKey = key.substring(key.length() - 3); + for (PropertyDescriptor dateProperty : propertyDescriptors) { + if (dateKey.equals(dateProperty.getName())) {// 找到了对应的日期字段,set之 + String dateValue = value.toString(); + if (dateValue.length() == 10) {// yyyy-MM-dd + dateProperty.getWriteMethod().invoke(obj, DateUtil.parseYMD(dateValue)); + } else if (dateValue.length() == 19) {// yyyy-MM-dd + // HH:mm:ss + dateProperty.getWriteMethod().invoke(obj, DateUtil.parseYMDHMS(dateValue)); + } + } + } + } + } + + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transMap2FormatBean Error " + e); + } + return obj; + } + + public static Map transBean2Map(Object obj) { + Map map = new HashMap<>(); + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + // 过滤class属性 + if (!key.equals("class")) { + // 得到property对应的getter方法 + Method getter = property.getReadMethod(); + Object value = getter.invoke(obj); + map.put(key, value); + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transBean2Map Error " + e); + } + return map; + } + + public static HashMap getKeyMap(String[] original, String[] alias) { + int length = original.length; + if (length != alias.length) { + throw new RuntimeException("映射配置错误"); + } + HashMap map = new HashMap<>(); + for (int i = 0; i < length; i++) { + map.put(original[i], alias[i]); + map.put(alias[i], original[i]); + } + /* + * 1--A(正常映射) 4--4(同名映射,允许) 2--C,C--3(错误映射) 错误的keyMap映射的value会有重复 + */ + Set keySet = map.keySet(); + Set valueSet = new HashSet<>(); + for (String key : keySet) { + valueSet.add(map.get(key)); + } + if (keySet.size() != valueSet.size()) { + throw new RuntimeException("映射配置错误"); + } + return map; + } + + public static Map transBean2AliasMap(Object obj, HashMap keyMap) { + Map map = new HashMap<>(); + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String field = property.getName(); + // 过滤class属性 + if (!field.equals("class")) { + // 得到property对应的getter方法 + Method getter = property.getReadMethod(); + Object value = getter.invoke(obj); + if (keyMap.get(field) != null) { + map.put(keyMap.get(field), value); + } + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transBean2AliasMap Error " + e); + } + return map; + } + + public static Map transBean2FormatAliasMap(Object obj, HashMap keyMap) { + Map map = new HashMap<>(); + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String field = property.getName(); + // Class fieldType = property.getPropertyType(); + // 过滤class属性 + if (!field.equals("class")) { + // 得到property对应的getter方法 + Method getter = property.getReadMethod(); + Object value = getter.invoke(obj); + if (value instanceof Date) {// 自动格式化日期对象 + Date dateValue = (Date) value; + String str = DateUtil.getyyyy_MM_dd(dateValue);// getyyyy_MM_dd_hms + if (keyMap.get(field + "Str") != null) { + map.put(keyMap.get(field + "Str"), str); + } + } else {// 普通字段,别名存储 + if (keyMap.get(field) != null) { + if (map.get(keyMap.get(field)) == null) {// 如果被以上的格式化代码赋值过,则不再过问 + map.put(keyMap.get(field), value); + } + } + } + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transBean2FormatAliasMap Error " + e); + } + return map; + } + + public static void mappingAlias(Object original, Object alias, HashMap keyMap) { + Map aliasMap = transBean2AliasMap(original, keyMap); + transMap2Bean(aliasMap, alias); + } + + public static void mappingFormatAlias(Object original, Object alias, HashMap keyMap) { + Map aliasMap = transBean2FormatAliasMap(original, keyMap); + transMap2FormatBean(aliasMap, alias); + } + + /* + * 方便书写映射文件keyMap + */ + public static void printField(Object obj) { + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + // 过滤class属性 + if (!key.equals("class")) { + System.out.println("\"" + key + "\",//");// "name", + } + } + } catch (Exception e) { + System.err.println("printField Error " + e); + } + } + + /* + * 方便书写 json + */ + public static void printJsonByArray(String[] args) { + System.out.println("{"); + for (int i = 0; i < args.length; i++) { + String str = "\"" + args[i] + "\":\"666\""; + if (i != args.length - 1) { + str += ","; + } + System.out.println(str); + } + System.out.println("}"); + } + + public static void main(String[] args) { + // printField(new WomanHusband()); + printJsonByArray(WomanFetationRecordKeymap.alias); + } + +} -- 1.8.3.1