From 91a052c9667cfb9f82b615da0e84d1a9f07e90b3 Mon Sep 17 00:00:00 2001 From: xujiahong Date: Mon, 8 May 2017 13:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4-=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/organ/OrganizationsService.java | 11 + .../organ/impl/OrganizationsServiceImpl.java | 6 + .../hospital/entity/diagnose/DiagnoseInfo.java | 8 +- .../service/childbirth/ChildbirthInfoService.java | 12 + .../childbirth/impl/ChildbirthInfoServiceImpl.java | 11 +- .../service/diagnose/DiagnoseInfoService.java | 77 ++- .../diagnose/impl/DiagnoseInfoServiceImpl.java | 45 +- .../service/woman/WomanFetationRecordService.java | 12 + .../woman/impl/WomanFetationRecordServiceImpl.java | 66 ++- .../service/woman/impl/WomanPersonServiceImpl.java | 7 + .../java/com/lyms/hospital/util/HospitalUtil.java | 46 ++ .../java/com/lyms/hospital/util/UnitConstants.java | 49 ++ .../lyms/hospital/util/trans/OldDictionary.java | 65 +++ .../com/lyms/hospital/util/trans/XjhMapUtil.java | 316 +++++++++++ .../hospital/controller/CommonApiController.java | 16 + .../childbirth/ChildbirthController.java | 119 ++++ .../childbirth/ChildbirthInfoController.java | 19 - .../childbirth/ChildbirthNewbornController.java | 19 - .../childbirth/ChildbirthTaiController.java | 19 - .../childbirth/ChildbirthTaipanController.java | 19 - .../controller/woman/WomanExamController.java | 476 ++++++++++------ .../request/exam/ChildbirthAddRequest.java | 608 +++++++++++++++++++++ .../request/exam/ChildbirthAddRequestWrapper.java | 83 +++ .../request/exam/ExamAddRequestWrapper.java | 72 ++- .../java/com/lyms/hospital/util/HospitalUtil.java | 39 -- .../java/com/lyms/hospital/util/UnitConstants.java | 36 -- .../lyms/hospital/util/trans/OldDictionary.java | 65 --- .../com/lyms/hospital/util/trans/XjhMapUtil.java | 314 ----------- .../src/main/resources/xml/app-shiro.xml | 1 + 29 files changed, 1912 insertions(+), 724 deletions(-) create mode 100644 parent/hospital.mac/src/main/java/com/lyms/hospital/util/HospitalUtil.java create mode 100644 parent/hospital.mac/src/main/java/com/lyms/hospital/util/UnitConstants.java create mode 100644 parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java create mode 100644 parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthController.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthInfoController.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthNewbornController.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaiController.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaipanController.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequest.java create mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequestWrapper.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/HospitalUtil.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/UnitConstants.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java delete mode 100644 parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java diff --git a/parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java b/parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java index 1bb4e91..695d39f 100644 --- a/parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java +++ b/parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java @@ -72,5 +72,16 @@ public interface OrganizationsService extends BaseService { *
  • 修改时间: */ public Page listOrgs(Page page,Serializable orgids); + + /** + *
  • @Description:通过机构ID获取机构名称 + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + public String getNameById(String id); } diff --git a/parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java b/parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java index 353497c..f809f31 100644 --- a/parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java +++ b/parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java @@ -78,4 +78,10 @@ public class OrganizationsServiceImpl extends ServiceImpl { *
  • 修改时间: */ public Page listOfChildbirth(Page page,ChildbirthListVo vo); + + /** + *
  • @Description:通过孕妇ID查询所有分娩记录 + *
  • @param womanId + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + public List selectListByWomanId(String womanId); } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthInfoServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthInfoServiceImpl.java index 7f69eff..4f84d2d 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthInfoServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthInfoServiceImpl.java @@ -121,7 +121,6 @@ public class ChildbirthInfoServiceImpl extends ServiceImpl selectListByWomanId(String womanId) { + if(StringUtils.isEmpty(womanId)){ + return null; + } + EntityWrapper ew = new EntityWrapper(); + ew.where("WOMAN_ID = {0}", womanId); + return this.selectList(ew); + } } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/DiagnoseInfoService.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/DiagnoseInfoService.java index c262c25..75d09fb 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/DiagnoseInfoService.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/DiagnoseInfoService.java @@ -3,6 +3,7 @@ package com.lyms.hospital.service.diagnose; import java.io.Serializable; import java.util.List; +import com.lyms.base.common.entity.conf.DiagnoseConf; import com.lyms.base.common.entity.conf.HighriskConf; import com.lyms.hospital.entity.assist.DiagnoseAssit; import com.lyms.hospital.entity.diagnose.DiagnoseInfo; @@ -14,8 +15,9 @@ import com.lyms.web.service.BaseService; *

    * 服务类 * - * 保存初诊数据 - * 保存复诊数据 + * 保存初诊数据
    + * 保存复诊数据
    + * 根据孕妇建档ID查询产检基本信息列表
    *

    * * @author jiangjiazhi @@ -23,24 +25,48 @@ import com.lyms.web.service.BaseService; */ public interface DiagnoseInfoService extends BaseService { - /** - *
  • @Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 - *
  • @param id 删除主键id - *
  • @return 大于0修改成功,否则为失败 - */ - public Integer deleteLogicById(Serializable id); - - /** - *
  • @Description:保存初诊数据 - *
  • @return - *
  • 创建人:xujiahong - *
  • 创建时间:2017年4月26日 - *
  • 修改人: - *
  • 修改时间: - */ - public String saveFirstExam(DiagnoseInfo info,DiagnoseAssit assist,List historyList,List taiList); - - /** + /** + *
  • @Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 + *
  • @param id 删除主键id + *
  • @return 大于0修改成功,否则为失败 + */ + public Integer deleteLogicById(Serializable id); + + /** + *
  • @Description:根据孕妇建档ID查询产检基本信息列表 + *
  • @param womanId + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月5日 + *
  • 修改人: + *
  • 修改时间: + */ + public List getInfoListByWomanId(String womanId); + + /** + *
  • @Description:保存初诊数据 + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月26日 + *
  • 修改人: + *
  • 修改时间: + */ + public String saveFirstExam(DiagnoseInfo info, DiagnoseAssit assist, List historyList, + List taiList); + + /** + *
  • @Description:保存复诊数据 + *
  • @param info + *
  • @param taiList + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月5日 + *
  • 修改人: + *
  • 修改时间: + */ + public String saveLaterExam(DiagnoseInfo info, List taiList); + + /** *
  • @Description:根据居民ID获取末次高危 *
  • @param personId 居民ID *
  • @return @@ -50,5 +76,16 @@ public interface DiagnoseInfoService extends BaseService { *
  • 修改时间: */ public List getLastHighrisk(Serializable personId); + + /** + *
  • @Description:根据居民ID获取末次诊断 + *
  • @param personId + *
  • @return + *
  • 创建人:方承 + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + public List getLastDiagnose(Serializable personId); } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java index 4b021d7..5465c35 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/diagnose/impl/DiagnoseInfoServiceImpl.java @@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.lyms.base.common.entity.conf.DiagnoseConf; import com.lyms.base.common.entity.conf.HighriskConf; import com.lyms.hospital.dao.diagnose.DiagnoseInfoMapper; import com.lyms.hospital.entity.assist.DiagnoseAssit; @@ -129,7 +130,7 @@ public class DiagnoseInfoServiceImpl extends ServiceImpl taiList) { + /* + * 基础验证 + */ + if (info == null || taiList == null) { + return "参数缺失"; + } + + /* + * (1)保存产检基本信息 (2)批量保存产检胎儿信息 + * (3)保存诊断信息 TODO + */ + if (StringUtils.isEmpty(info.getId())) {// 新增 + info.setId(StrUtils.uuid()); + info.setType(DiagnoseInfo.TYPE_SECOND);// 诊断类型,2为初诊,3为复诊 + this.insert(info);// 新增产检基本信息 + } else {// 修改 + this.updateById(info); + } + //批量保存产检胎儿信息 + diagnoseTaiService.deleteAndInsert(info.getId(), taiList); + return "success"; + } + @Override public List getLastHighrisk(Serializable personId) { return baseMapper.getLastHighrisk(personId); } + + @Override + public List getInfoListByWomanId(String womanId) { + if(StringUtils.isEmpty(womanId)){ + return null; + } + EntityWrapper ew = new EntityWrapper(); + ew.where("WOMAN_ID={0}", womanId); + return selectList(ew); + } + + + @Override + public List getLastDiagnose(Serializable personId) { + return baseMapper.getLastDiagnose(personId); + } } \ No newline at end of file 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 4c2e06b..80b18eb 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 @@ -16,12 +16,24 @@ import com.lyms.web.service.BaseService; * 查询-根据孕妇建档ID查询表单详情 * 查询-查询历史建档记录(by证件信息和就诊卡号) *

    + * 依据cardNo或vcCardNo查询孕妇信息
    * * @author fangcheng,xujiahong * @since 2017-03-31 */ public interface WomanFetationRecordService extends BaseService { + /** + *
  • @Description:依据cardNo或vcCardNo查询孕妇信息(顶部top) + *
  • @param cardNo + *
  • @param vcCardNo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月6日 + *
  • 修改人: + *
  • 修改时间: + */ + public Map selectTopFetationInfo(String cardNo, String vcCardNo, String orgId); /** *
  • @Description:条件查询有效的(未被删除的,启用的,未终止妊娠的,未分娩的&其他指定条件)孕妇建档 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 8072fa0..73bed43 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 @@ -1,6 +1,7 @@ package com.lyms.hospital.service.woman.impl; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -24,7 +25,9 @@ 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; +import com.lyms.hospital.util.HospitalUtil; import com.lyms.util.CollectionUtils; +import com.lyms.util.DateUtil; import com.lyms.util.InstanceUtils; import com.lyms.util.StrUtils; @@ -46,6 +49,7 @@ public class WomanFetationRecordServiceImpl extends ServiceImpl selectTopFetationInfo(String cardNo, String vcCardNo, String orgId) { + + // 孕妇档案信息(通过证件号或就诊卡号查询) + WomanFetationRecord query = new WomanFetationRecord(); + query.setHostpitalId(orgId);// 医院ID + WomanFetationRecord dbFetationRecord = null; + + // 证件号不为空,则通过证件号查询 + if (!StringUtils.isEmpty(cardNo)) { + query.setBasePapersNumber(cardNo); + dbFetationRecord = this.queryEffectiveOne(query); + } + // 上述查询未执行或没结果,且就诊卡号不为空,则通过就诊卡号查询 + if (dbFetationRecord == null && !StringUtils.isEmpty(vcCardNo)) { + query.setBasePapersNumber(null); + query.setContactWomanWay(vcCardNo); + dbFetationRecord = this.queryEffectiveOne(query); + } + // 未查询到孕妇建档信息 + if (dbFetationRecord == null) { + return null; + } + + // 组装返回对象 + Map dataMap = new HashMap<>(); + dataMap.put("id", dbFetationRecord.getId()); + dataMap.put("pid", dbFetationRecord.getWomanPersonId()); + dataMap.put("name", dbFetationRecord.getBaseWomanName()); + dataMap.put("age", DateUtil.getAge(dbFetationRecord.getBaseWomanBirth())); + // 根据“纠正末次月经”计算孕周 + dataMap.put("dueWeek", HospitalUtil.getPregnantWeek(dbFetationRecord.getHospitalCorrectLastMenstruation())); + dataMap.put("yChanQi", dbFetationRecord.getHospitalExpectedDateStr()); + dataMap.put("phone", dbFetationRecord.getContactWomanWay()); + dataMap.put("riskScore", "15");// TODO 高危评分 + dataMap.put("remarks", dbFetationRecord.getHospitalRecordRemark()); + dataMap.put("lastMenses", dbFetationRecord.getHospitalLastMenstruationStr()); + dataMap.put("buildTime", dbFetationRecord.getHospitalRecordDateStr());// 建档日期 + dataMap.put("lastBuildTime", dbFetationRecord.getHospitalRecordDateStr());// TODO + + dataMap.put("birth", dbFetationRecord.getBaseWomanBirthStr()); + dataMap.put("tireNumber1", "1");// TODO ? + dataMap.put("cardNo", dbFetationRecord.getBasePapersNumber()); + dataMap.put("vcCardNo", dbFetationRecord.getHospitalPatientCard()); + dataMap.put("isSieve", "0");// TODO? + dataMap.put("isH", "0");// TODO? + + // 高危因素列表 TODO + List> riskFactor = new ArrayList<>(); + dataMap.put("riskFactor", riskFactor);//高危因素列表 + + dataMap.put("now", DateUtil.getyyyy_MM_dd(new Date())); + dataMap.put("dbFetationRecord", dbFetationRecord);//调用者可以直接访问详情对象,之后可以remove掉,不传递给前端显示 + return dataMap; + } } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanPersonServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanPersonServiceImpl.java index e9a6d33..cf1095d 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanPersonServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanPersonServiceImpl.java @@ -43,6 +43,13 @@ public class WomanPersonServiceImpl extends ServiceImpl + * a
    + * + * @author xujiahong + * + */ +public class HospitalUtil { + + /** + *
  • @Description: + *
  • @param date 末次月经日期 + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月24日 + *
  • 修改人: + *
  • 修改时间: + */ + public static String getPregnantWeek(Date date) { + Date now = new Date(); + return getPregnantWeek(date, now); + } + + public static String getPregnantWeek(Date date,Date now) { + if(date==null || now==null){ + return ""; + } + int days = DateUtil.daysBetween(date, now);//返回两个日期的间隔天数 + if (days < 0) { + return ""; + } + if (days >= 294) { + return "已分娩"; + } + int week = (days / 7); + int day = (days % 7); + return "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); + } + +} diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/util/UnitConstants.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/util/UnitConstants.java new file mode 100644 index 0000000..ae707be --- /dev/null +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/util/UnitConstants.java @@ -0,0 +1,49 @@ +package com.lyms.hospital.util; + +/** + * + * 单位常量,用以返回值拼接 + * + * Created by Administrator on 2017/1/11 0011. + */ +public class UnitConstants { + + public static final String CM = " cm"; + public static final String KG = " kg"; + public static final String MMHG = " mmHg"; + public static final String CIFEN = " 次/分"; + public static final String GL = " g/L"; + public static final String MMOLL = " mmol/L"; + public static final String CI = " 次"; + public static final String UL = " U/L"; + public static final String TEN_LKG = "×109/L"; +// public static final String TEN_LKG = " 10^9/L"; + public static final String UMOLL = " umol/L"; + public static final String ZHEN = " 针"; + public static final String ML = " ml"; + public static final String G = " g"; + public static final String FEN = " 分"; + public static final String FZ = " 分钟"; + public static final String GE = " 个"; + public static final String SUI = " 岁"; + public static final String REN = " 人"; + public static final String HD = " 时/日"; + public static final String WENDU = " ℃"; + public static final String WSSD = " IU/日"; + public static final String DAY = " 天"; + + /** + * 拼接单位 + * @param data + * @param unit + * @return + */ + public static String splice(Object data,String unit){ + if (data==null || "/".equals(data)){ + return null; + } + return data.toString() + unit; + } + + +} diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java new file mode 100644 index 0000000..1d99f04 --- /dev/null +++ b/parent/hospital.mac/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.mac/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java new file mode 100644 index 0000000..ddd264a --- /dev/null +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java @@ -0,0 +1,316 @@ +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.entity.assist.DiagnoseAssit; +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{ + if(obj==null || property==null){ + return; + } + // 得到property对应的setter方法 + Method setter = property.getWriteMethod(); + if(value==null){//null值可匹配任何类型的对象 + setter.invoke(obj, value); + return; + } + Class keyType = property.getPropertyType(); + Class valueType = value.getClass(); + //简单处理映射字段类型不匹配的情况 + 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) { + if(map==null || obj==null){ + return null; + } + 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); + e.printStackTrace(); + } + return obj; + } + + public static Object transMap2AliasBean(Map map, Object obj, HashMap keyMap) { + if(map==null || obj==null || keyMap==null){ + return null; + } + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String field = property.getName(); + if (keyMap.containsKey(field)) { + Object value = map.get(keyMap.get(field)); + invokeIgnoreType(property,value,obj); + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transMap2Bean Error " + e); + e.printStackTrace(); + } + return obj; + } + + // 自动处理时间字段和对应的字符串字段(Str结尾) + public static Object transMap2FormatBean(Map map, Object obj) { + if(map==null || obj==null){ + return null; + } + 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); + if(value==null){ + continue; + } + 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(0,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); + e.printStackTrace(); + } + return obj; + } + + public static Map transBean2Map(Object obj) { + if(obj==null){ + return null; + } + 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); + e.printStackTrace(); + } + 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) { + if(keyMap==null || obj==null){ + return null; + } + 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.containsKey(field)) { + map.put(keyMap.get(field), value); + } + } + } + } catch (Exception e) { + System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); + System.err.println("transBean2AliasMap Error " + e); + e.printStackTrace(); + } + return map; + } + + public static Map transBean2FormatAliasMap(Object obj, HashMap keyMap) { + if(keyMap==null || obj==null){ + return null; + } + 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); + e.printStackTrace(); + } + 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 + */ + private 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) { + e.printStackTrace(); + } + } + + /* + * 方便书写 json + */ + private 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 DiagnoseAssit()); +// printJsonByArray(WomanFetationRecordKeymap.alias); + } + +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/CommonApiController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/CommonApiController.java index 6db5808..6f8562a 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/CommonApiController.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/CommonApiController.java @@ -1,6 +1,7 @@ package com.lyms.hospital.controller; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,6 +30,7 @@ import com.lyms.web.controller.BaseController; * []查询病史配置
    * 查询省市区数据
    * 查询字典数据
    + * []获取当前服务器时间
    * * @author xujiahong * @since 2017-04-21 @@ -41,6 +43,20 @@ public class CommonApiController extends BaseController { private RegionsService regionService; @Autowired private HistorySourceService historySourceService; + + /** + *
  • @Description:获取当前服务器时间 + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/cTime", method = RequestMethod.GET) + @ResponseBody + public AjaxResult queryCurrentTime() { + return AjaxResult.returnSuccess(new Date().getTime()); + } /** *
  • @Description:查询病史配置 diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthController.java new file mode 100644 index 0000000..fc26b13 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthController.java @@ -0,0 +1,119 @@ +package com.lyms.hospital.controller.childbirth; + +import java.util.ArrayList; +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.util.StringUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.lyms.base.common.entity.user.Users; +import com.lyms.base.common.service.organ.OrganizationsService; +import com.lyms.hospital.entity.childbirth.ChildbirthInfo; +import com.lyms.hospital.entity.woman.WomanFetationRecord; +import com.lyms.hospital.request.exam.ChildbirthAddRequest; +import com.lyms.hospital.service.childbirth.ChildbirthInfoService; +import com.lyms.hospital.service.woman.WomanFetationRecordService; +import com.lyms.shiro.ShiroWebUtils; +import com.lyms.util.DateUtil; +import com.lyms.web.bean.AjaxResult; +import com.lyms.web.controller.BaseController; + +/** + *

    + * 分娩-前端控制器 + *

    + * 保存分娩记录
    + * []依据cardNo或vcCardNo查询孕妇分娩记录
    + * + * @author xujiahong + * @since 2017-03-31 + */ +@Controller +@RequestMapping("/childbirth") +public class ChildbirthController extends BaseController { + + @Autowired + private WomanFetationRecordService fetationService; + @Autowired + private ChildbirthInfoService birthService; + @Autowired + private OrganizationsService orgService; + + /** + *
  • @Description:保存分娩记录 + *
  • @param cardNo + *
  • @param vcCardNo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/matdel", method = RequestMethod.POST) + @ResponseBody + public AjaxResult saveChildbirthVo(ChildbirthAddRequest request) { + return AjaxResult.returnFail(); + } + + /** + *
  • @Description:依据cardNo或vcCardNo查询孕妇分娩记录 + *
  • @param cardNo + *
  • @param vcCardNo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月8日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/matmanger", method = RequestMethod.GET) + @ResponseBody + public AjaxResult selectChildbirthHistory(String cardNo, String vcCardNo) { + // 基本验证 + Users users = ShiroWebUtils.getCurrentUser(); + String orgId = users.getOrgId(); + if (StringUtils.isEmpty(orgId)) { + return AjaxResult.returnFail("入参错误:医院ID为空"); + } + if (StringUtils.isEmpty(cardNo) && StringUtils.isEmpty(vcCardNo)) { + return AjaxResult.returnFail("入参错误:查询条件为空"); + } + // 组装返回对象-查询孕妇建档信息 + Map dataMap = fetationService.selectTopFetationInfo(cardNo, vcCardNo, orgId); + // 未查询到孕妇建档信息 + if (dataMap == null) { + return AjaxResult.returnSuccess(null);// 将基本的对象返回空 + } + WomanFetationRecord dbFetationRecord = (WomanFetationRecord)dataMap.get("dbFetationRecord"); + + //TODO 满固定孕周才可以分娩 + + // 分娩记录列表 + List> data = new ArrayList<>(); // data 系前端指定名称 + List birthList = birthService.selectListByWomanId(dbFetationRecord.getId()); + if(birthList!=null && !birthList.isEmpty()){ + for(ChildbirthInfo info : birthList){ + Map map = new HashMap<>(); + map.put("hospitalName", orgService.getNameById(info.getOrgId())); + map.put("hospitalId", info.getOrgId()); + map.put("id", info.getId()); + map.put("checkTime", DateUtil.getyyyy_MM_dd(info.getChildbirthTime())); + map.put("enableEdit", 1); + data.add(map); + } + } + + dataMap.put("data", data);//分娩记录列表 + dataMap.remove("dbFetationRecord"); + return AjaxResult.returnSuccess(dataMap); + } + + + + +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthInfoController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthInfoController.java deleted file mode 100644 index 99c0578..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthInfoController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lyms.hospital.controller.childbirth; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import com.lyms.web.controller.BaseController; - -/** - *

    - * 前端控制器 - *

    - * - * @author xujiahong - * @since 2017-03-31 - */ -@Controller -@RequestMapping("/childbirthInfo") -public class ChildbirthInfoController extends BaseController { - -} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthNewbornController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthNewbornController.java deleted file mode 100644 index 00724f3..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthNewbornController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lyms.hospital.controller.childbirth; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import com.lyms.web.controller.BaseController; - -/** - *

    - * 前端控制器 - *

    - * - * @author xujiahong - * @since 2017-03-31 - */ -@Controller -@RequestMapping("/childbirthNewborn") -public class ChildbirthNewbornController extends BaseController { - -} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaiController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaiController.java deleted file mode 100644 index 52178d1..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaiController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lyms.hospital.controller.childbirth; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import com.lyms.web.controller.BaseController; - -/** - *

    - * 前端控制器 - *

    - * - * @author xujiahong - * @since 2017-03-31 - */ -@Controller -@RequestMapping("/childbirthTai") -public class ChildbirthTaiController extends BaseController { - -} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaipanController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaipanController.java deleted file mode 100644 index 41781d7..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/childbirth/ChildbirthTaipanController.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lyms.hospital.controller.childbirth; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import com.lyms.web.controller.BaseController; - -/** - *

    - * 前端控制器 - *

    - * - * @author xujiahong - * @since 2017-03-31 - */ -@Controller -@RequestMapping("/childbirthTaipan") -public class ChildbirthTaipanController extends BaseController { - -} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanExamController.java b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanExamController.java index 66267ce..a6e1e97 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanExamController.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanExamController.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; @@ -14,6 +15,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import com.lyms.base.common.entity.organ.Organizations; +import com.lyms.base.common.entity.user.Users; +import com.lyms.base.common.service.organ.OrganizationsService; +import com.lyms.base.common.service.user.UsersService; import com.lyms.hospital.entity.assist.DiagnoseAssit; import com.lyms.hospital.entity.diagnose.DiagnoseInfo; import com.lyms.hospital.entity.diagnose.DiagnoseTai; @@ -30,9 +35,11 @@ import com.lyms.hospital.service.assist.DiagnoseAssitService; import com.lyms.hospital.service.diagnose.DiagnoseInfoService; import com.lyms.hospital.service.diagnose.DiagnoseTaiService; import com.lyms.hospital.service.history.HistoryMapsService; -import com.lyms.hospital.service.token.TokenService; import com.lyms.hospital.service.woman.WomanFetationRecordService; import com.lyms.hospital.util.HospitalUtil; +import com.lyms.hospital.util.UnitConstants; +import com.lyms.hospital.util.trans.XjhMapUtil; +import com.lyms.shiro.ShiroWebUtils; import com.lyms.util.DateUtil; import com.lyms.web.bean.AjaxResult; import com.lyms.web.controller.BaseController; @@ -42,9 +49,10 @@ import com.lyms.web.controller.BaseController; * * [--]依据cardNo或vcCardNo查询孕妇产检记录
    * [--]保存初诊数据
    - * 保存复诊数据
    - * 查询某条记录的详细信息,用于表单填写
    + * [--]保存复诊数据
    + * [--]查询某条记录的详细信息,用于表单填写
    * [--]产检获取字典数据
    + * [--]初诊查看页面数据
    * * @author xujiahong * @@ -64,8 +72,147 @@ public class WomanExamController extends BaseController { @Autowired private HistoryMapsService historyMapsService; @Autowired - private TokenService tokenService; - + private UsersService usersService; + @Autowired + private OrganizationsService orgService; + + /** + *
  • @Description:初诊查看页面数据 + *
  • @param id + *
  • @param type + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月6日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/findAntExChuData", method = RequestMethod.GET) + @ResponseBody + public AjaxResult selectFirstExamData(String id) { + /* + * 产检基础信息、产检辅助信息、病史列表、胎儿列表、诊断列表 TODO + */ + DiagnoseInfo info = infoService.selectById(id);// 产检基础信息 + if (info == null) { + return AjaxResult.returnSuccess(); + } + DiagnoseAssit assist = assistService.getDetailByDiagnoseInfo(info.getId(), DiagnoseAssit.DIAGNOSE_TYPE_BIRTH);// 诊断类型:1婚前检查,【2产检】,3儿保检查 + List historyMapsList = historyMapsService.getListByTarget(info.getId(), + HistoryMaps.TARGET_TYPE_EXAM);// 关联目标类型:1产检、2妇女建档 + List diagnoseTaiList = diagnoseTaiService.getListByExamId(info.getId()); + ExamAddRequestWrapper wrapper = new ExamAddRequestWrapper(info, assist, historyMapsList, diagnoseTaiList); + // 查询孕妇基本信息 + WomanFetationRecord womanFetation = fetationService.selectById(info.getWomanId()); + + ExamAddRequest result = wrapper.getExamAddRequest(); + Map map = XjhMapUtil.transBean2Map(result);// 返回数据 + + // 孕妇基本信息 + map.put("id", womanFetation.getId()); + map.put("username", womanFetation.getBaseWomanName()); + map.put("birth", DateUtil.getyyyy_MM_dd(womanFetation.getBaseWomanBirth())); + map.put("age", UnitConstants.splice(DateUtil.getAge(womanFetation.getBaseWomanBirth()), UnitConstants.SUI)); + map.put("phone", womanFetation.getContactWomanWay()); + + // 基本信息孕周 + // map.put("fmWeek", patients.getPhone());之前老接口返回的电话号码。。。看字段是 分娩孕周 + map.put("dueDate", DateUtil.getyyyy_MM_dd(womanFetation.getHospitalExpectedDate()));// 预产期 + map.put("mremark", womanFetation.getHospitalRecordRemark()); + + // 产检孕周 + map.put("cDueWeek", HospitalUtil.getPregnantWeek(womanFetation.getHospitalCorrectLastMenstruation(), + info.getDiagnoseTime())); + // 产检医生 + Users users = usersService.selectById(info.getDoctorId()); + if (users != null) { + map.put("checkDoctor", users.getName()); + } + // 产检医院 + Organizations org = orgService.selectById(info.getOrgId()); + if (org != null) { + map.put("hospital", org.getName()); + } + + // 下次检查时间 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(info.getNextinspectTime())); + // 下次检查孕周 + map.put("nextCheckWeek", HospitalUtil.getPregnantWeek(womanFetation.getHospitalCorrectLastMenstruation(), + info.getNextinspectTime())); + // 孕产史 + map.put("pregnancyTimes", UnitConstants.splice(result.getPregnancyTimes(), UnitConstants.CI)); + map.put("prodTime", UnitConstants.splice(result.getProdTime(), UnitConstants.CI)); + map.put("delivery", UnitConstants.splice(result.getDelivery(), UnitConstants.CI)); + map.put("planedProd", UnitConstants.splice(result.getPlanedProd(), UnitConstants.CI)); + // 流产 + String abortion = ""; + abortion = UnitConstants.splice(result.getAbortion(), UnitConstants.CI) == null ? "" + : UnitConstants.splice(result.getAbortion(), UnitConstants.CI); + if (result.getAbortionZR() != null && result.getAbortionRG() != null) { + abortion += "(自然:" + result.getAbortionZR() + UnitConstants.CI + " 人工:" + result.getAbortionRG() + + UnitConstants.CI + ")"; + } + map.put("abortion", abortion); + map.put("stillbirth", UnitConstants.splice(result.getStillbirth(), UnitConstants.CI)); + map.put("stillChan", UnitConstants.splice(result.getStillChan(), UnitConstants.CI)); + map.put("neoDeath", UnitConstants.splice(result.getNeoDeath(), UnitConstants.CI)); + map.put("birthDefect", UnitConstants.splice(result.getBirthDefect(), UnitConstants.CI)); + + map.put("height", UnitConstants.splice(result.getHeight(), UnitConstants.CM)); + map.put("weight", UnitConstants.splice(result.getWeight(), UnitConstants.KG)); + map.put("yqWeight", UnitConstants.splice(result.getYqWeight(), UnitConstants.KG)); + // 血压 + String ssy = info.getBloodShrink() == null ? "" : info.getBloodShrink() + ""; + String szy = info.getBloodDiastole() == null ? "" : info.getBloodDiastole() + ""; + map.put("bp", UnitConstants.splice(ssy + "/" + szy, UnitConstants.MMHG)); + + map.put("gonggao", UnitConstants.splice(result.getGonggao(), UnitConstants.CM)); + map.put("fuwei", UnitConstants.splice(result.getFuwei(), UnitConstants.CM)); + + // 胎儿情况 + + + /* 辅助检查 */ + map.put("xhdb",UnitConstants.splice(result.getXhdb(),UnitConstants.GL)); + map.put("bxbjs",UnitConstants.splice(result.getBxbjs(),UnitConstants.TEN_LKG)); + map.put("platelet",UnitConstants.splice(result.getPlatelet(),UnitConstants.TEN_LKG)); + + map.put("bloodSugar",UnitConstants.splice(result.getBloodSugar(),UnitConstants.MMOLL)); + map.put("xqgbzam",UnitConstants.splice(result.getXqgbzam(), UnitConstants.UL)); + map.put("xqgczam",UnitConstants.splice(result.getXqgczam(), UnitConstants.UL)); + map.put("albumin",UnitConstants.splice(result.getAlbumin(), UnitConstants.GL)); + map.put("totalBilirubin",UnitConstants.splice(result.getTotalBilirubin(), UnitConstants.UMOLL)); + map.put("jhBilirubin",UnitConstants.splice(result.getJhBilirubin(), UnitConstants.UMOLL)); + + map.put("xqjq",UnitConstants.splice(result.getXqjq(), UnitConstants.UL)); + map.put("xnsd",UnitConstants.splice(result.getXnsd(), UnitConstants.UL)); + + return AjaxResult.returnSuccess(map); + } + + /** + *
  • @Description:保存复诊数据 + *
  • @param request + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年5月5日 + *
  • 修改人: + *
  • 修改时间: + */ + @RequestMapping(value = "/antexmanage", method = RequestMethod.POST) + @ResponseBody + public AjaxResult saveLaterExam(@RequestBody ExamAddRequest request) { + /* + * (1)保存产检基本信息 (2)多个胎儿信息(3) 多个诊断信息 TODO + */ + // 对象转换 + ExamAddRequestWrapper wrapper = new ExamAddRequestWrapper(request); + DiagnoseInfo info = wrapper.getDiagnoseInfo(); + List taiList = wrapper.getDiagnoseTaiList(); // 胎儿信息 + // 保存初诊信息 + String result = infoService.saveLaterExam(info, taiList); + return "success".equals(result) ? AjaxResult.returnSuccess() : AjaxResult.returnFail(result); + } + /** *
  • @Description:产检获取字典数据 *
  • @return @@ -78,130 +225,153 @@ public class WomanExamController extends BaseController { @RequestMapping(value = "/antex/getenums", method = RequestMethod.GET) @ResponseBody public AjaxResult getDictionary() { - Map data = new HashMap<>(); - //枚举常量======================================= - //getFetal 胎先露 + Map data = new HashMap<>(); + // 枚举常量======================================= + // getFetal 胎先露 data.put("getFetal", FetalEnums.getList()); - //getJoin 衔接 + // getJoin 衔接 data.put("getJoin", JoinEnums.getList()); - //fuzhong ? + // fuzhong ? data.put("fuzhong", FuZhongEnums.getList()); - //getTaiPan 胎盘个数 + // getTaiPan 胎盘个数 data.put("getTaiPan", TaiShuEnums.TaiPanEnums.getList()); - //getTaiShu 胎数 + // getTaiShu 胎数 data.put("getTaiShu", TaiShuEnums.getList()); - //getFetPosition + // getFetPosition data.put("getFetPosition", FetalPositionEnums.getList()); - //字典常量======================================= - //xx 血型-模拟数据 TODO - List> xx = new ArrayList<>(); - Map xx_map1 = new HashMap(){{ - put("id", "xxa"); - put("parentId", "5769eef90cf22c315757741f"); - put("name", "A"); - }}; + // 字典常量======================================= + // xx 血型-模拟数据 TODO + List> xx = new ArrayList<>(); + Map xx_map1 = new HashMap() { + { + put("id", "xxa"); + put("parentId", "5769eef90cf22c315757741f"); + put("name", "A"); + } + }; xx.add(xx_map1); - Map xx_map2 = new HashMap(){{ - put("id", "xxb"); - put("parentId", "5769eef90cf22c315757741f"); - put("name", "B"); - }}; + Map xx_map2 = new HashMap() { + { + put("id", "xxb"); + put("parentId", "5769eef90cf22c315757741f"); + put("name", "B"); + } + }; xx.add(xx_map2); data.put("xx", xx); - - //getHighRisk 高危标签-模拟数据 TODO - List> getHighRisk = new ArrayList<>(); - Map getHighRisk_map1 = new HashMap(){{ - put("id", "meidu"); - put("parentId", "224b2329-cb82-4da3-a071-8527f8283aab"); - put("code", "10"); - put("name", "梅毒"); - put("typeId","fb43fd5a-b153-4cb9-9180-c46f5612ba43"); - put("color","risk_purple"); - put("yn","1"); - }}; + + // getHighRisk 高危标签-模拟数据 TODO + List> getHighRisk = new ArrayList<>(); + Map getHighRisk_map1 = new HashMap() { + { + put("id", "meidu"); + put("parentId", "224b2329-cb82-4da3-a071-8527f8283aab"); + put("code", "10"); + put("name", "梅毒"); + put("typeId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); + put("color", "risk_purple"); + put("yn", "1"); + } + }; getHighRisk.add(getHighRisk_map1); - Map getHighRisk_map2 = new HashMap(){{ - put("id", "hiv"); - put("parentId", "224b2329-cb82-4da3-a071-8527f8283aab"); - put("code", "10"); - put("name", "HIV"); - put("typeId","fb43fd5a-b153-4cb9-9180-c46f5612ba43"); - put("color","risk_purple"); - put("yn","1"); - }}; + Map getHighRisk_map2 = new HashMap() { + { + put("id", "hiv"); + put("parentId", "224b2329-cb82-4da3-a071-8527f8283aab"); + put("code", "10"); + put("name", "HIV"); + put("typeId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); + put("color", "risk_purple"); + put("yn", "1"); + } + }; getHighRisk.add(getHighRisk_map2); data.put("getHighRisk", getHighRisk); - - //gwfz 高危分值(高危等级-->评分)-模拟数据 TODO - List> gwfz = new ArrayList<>(); - Map gwfz_map1 = new HashMap(){{ - put("id", "5769f0640cf2d37f034793a2"); - put("parentId", "5769eef90cf22c3157577422"); - put("name", "5"); - }}; + + // gwfz 高危分值(高危等级-->评分)-模拟数据 TODO + List> gwfz = new ArrayList<>(); + Map gwfz_map1 = new HashMap() { + { + put("id", "5769f0640cf2d37f034793a2"); + put("parentId", "5769eef90cf22c3157577422"); + put("name", "5"); + } + }; gwfz.add(gwfz_map1); - Map gwfz_map2 = new HashMap(){{ - put("id", "5769f0640cf2d37f034793a3"); - put("parentId", "5769eef90cf22c3157577422"); - put("name", "10"); - }}; + Map gwfz_map2 = new HashMap() { + { + put("id", "5769f0640cf2d37f034793a3"); + put("parentId", "5769eef90cf22c3157577422"); + put("name", "10"); + } + }; gwfz.add(gwfz_map2); data.put("gwfz", gwfz); - - //ydqjd 阴道清洁度-模拟数据 TODO - List> ydqjd = new ArrayList<>(); - Map ydqjd_map1 = new HashMap(){{ - put("id", "5769ef930cf2d37f03479387"); - put("parentId", "5769eef90cf22c3157577420"); - put("name", "Ⅰ度"); - }}; + + // ydqjd 阴道清洁度-模拟数据 TODO + List> ydqjd = new ArrayList<>(); + Map ydqjd_map1 = new HashMap() { + { + put("id", "5769ef930cf2d37f03479387"); + put("parentId", "5769eef90cf22c3157577420"); + put("name", "Ⅰ度"); + } + }; ydqjd.add(ydqjd_map1); - Map ydqjd_map2 = new HashMap(){{ - put("id", "5769ef930cf2d37f03479390"); - put("parentId", "5769eef90cf22c3157577420"); - put("name", "Ⅱ度"); - }}; + Map ydqjd_map2 = new HashMap() { + { + put("id", "5769ef930cf2d37f03479390"); + put("parentId", "5769eef90cf22c3157577420"); + put("name", "Ⅱ度"); + } + }; ydqjd.add(ydqjd_map2); data.put("ydqjd", ydqjd); - - //organizations 组织机构-模拟数据 TODO - List> organizations = new ArrayList<>(); - Map organizations_map1 = new HashMap(){{ - put("id", "193"); - put("name", "青龙妇幼保健院"); - }}; + + // organizations 组织机构-模拟数据 TODO + List> organizations = new ArrayList<>(); + Map organizations_map1 = new HashMap() { + { + put("id", "193"); + put("name", "青龙妇幼保健院"); + } + }; organizations.add(organizations_map1); - Map organizations_map2 = new HashMap(){{ - put("id", "195"); - put("name", "昌黎妇幼保健院"); - }}; + Map organizations_map2 = new HashMap() { + { + put("id", "195"); + put("name", "昌黎妇幼保健院"); + } + }; organizations.add(organizations_map2); data.put("organizations", organizations); - - //fxys 风险颜色-模拟数据 TODO - List> fxys = new ArrayList<>(); - Map fxys_map1 = new HashMap(){{ - put("id", "zsyj"); - put("parentId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); - put("name", "紫色预警"); - }}; + + // fxys 风险颜色-模拟数据 TODO + List> fxys = new ArrayList<>(); + Map fxys_map1 = new HashMap() { + { + put("id", "zsyj"); + put("parentId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); + put("name", "紫色预警"); + } + }; fxys.add(fxys_map1); - Map fxys_map2 = new HashMap(){{ - put("id", "csyj"); - put("parentId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); - put("name", "橙色预警"); - }}; + Map fxys_map2 = new HashMap() { + { + put("id", "csyj"); + put("parentId", "fb43fd5a-b153-4cb9-9180-c46f5612ba43"); + put("name", "橙色预警"); + } + }; fxys.add(fxys_map2); data.put("fxys", fxys); - - //cTime + + // cTime data.put("cTime", DateUtil.getyyyy_MM_dd(new Date())); - //now + // now data.put("now", DateUtil.getyyyy_MM_dd(new Date())); return AjaxResult.returnSuccess(data); } - /** *
  • @Description:查询某条记录的详细信息,用于表单填写 @@ -224,11 +394,11 @@ public class WomanExamController extends BaseController { return AjaxResult.returnSuccess(); } DiagnoseAssit assist = assistService.getDetailByDiagnoseInfo(info.getId(), DiagnoseAssit.DIAGNOSE_TYPE_BIRTH);// 诊断类型:1婚前检查,【2产检】,3儿保检查 - List historyList = historyMapsService.getListByTarget(info.getId(), HistoryMaps.TARGET_TYPE_EXAM);// 关联目标类型:1产检、2妇女建档 - List taiList = diagnoseTaiService.getListByExamId(info.getId()); - - - return AjaxResult.returnFail(); + List historyMapsList = historyMapsService.getListByTarget(info.getId(), + HistoryMaps.TARGET_TYPE_EXAM);// 关联目标类型:1产检、2妇女建档 + List diagnoseTaiList = diagnoseTaiService.getListByExamId(info.getId()); + ExamAddRequestWrapper wrapper = new ExamAddRequestWrapper(info, assist, historyMapsList, diagnoseTaiList); + return AjaxResult.returnSuccess(wrapper.getExamAddRequest()); } /** @@ -246,7 +416,7 @@ public class WomanExamController extends BaseController { /* * 同一产程不能新增两次初诊:(如果条件是新增,根据孕妇档案ID WOMAN_ID 查询产检记录列表) TODO */ - // + /* * (1)保存产检基本信息 (2)保存辅助检查信息 (3)批量保存病史信息(4)多个胎儿信息(5) 多个诊断信息 TODO */ @@ -279,63 +449,53 @@ public class WomanExamController extends BaseController { * */ // 基本验证 - String orgId = "1";// orgId或来自token -// if (StringUtils.isEmpty(orgId)) { -// return AjaxResult.returnFail("入参错误:医院ID为空"); -// } + Users users = ShiroWebUtils.getCurrentUser(); + String orgId = users.getOrgId(); + if (StringUtils.isEmpty(orgId)) { + return AjaxResult.returnFail("入参错误:医院ID为空"); + } if (StringUtils.isEmpty(cardNo) && StringUtils.isEmpty(vcCardNo)) { return AjaxResult.returnFail("入参错误:查询条件为空"); } - // (1)孕妇档案信息(通过证件号或就诊卡号查询) - WomanFetationRecord query = new WomanFetationRecord(); - query.setHostpitalId(orgId);// 医院ID - WomanFetationRecord dbFetationRecord = null; - - // 证件号不为空,则通过证件号查询 - if (!StringUtils.isEmpty(cardNo)) { - query.setBasePapersNumber(cardNo); - dbFetationRecord = fetationService.queryEffectiveOne(query); - } - // 上述查询未执行或没结果,且就诊卡号不为空,则通过就诊卡号查询 - if (dbFetationRecord == null && !StringUtils.isEmpty(vcCardNo)) { - query.setBasePapersNumber(null); - query.setContactWomanWay(vcCardNo); - dbFetationRecord = fetationService.queryEffectiveOne(query); - } + // 组装返回对象-查询孕妇建档信息 + Map dataMap = fetationService.selectTopFetationInfo(cardNo, vcCardNo, orgId); // 未查询到孕妇建档信息 - if (dbFetationRecord == null) { - return AjaxResult.returnSuccess(null);//将基本的对象返回空 + if (dataMap == null) { + return AjaxResult.returnSuccess(null);// 将基本的对象返回空 } - // (2)高危因素列表 TODO - List> riskFactor = new ArrayList<>(); - // (3)产检记录列表 TODO (此处需要查询当前产程中本院和外院的所有产检记录(包括分布建档的),之后对接方承) - List> data = new ArrayList<>(); // data 系前端指定名称 - // (4)组装返回对象 - Map dataMap = new HashMap<>(); - dataMap.put("id", dbFetationRecord.getId()); - dataMap.put("pid", dbFetationRecord.getWomanPersonId()); - dataMap.put("name", dbFetationRecord.getBaseWomanName()); - dataMap.put("age", DateUtil.getAge(dbFetationRecord.getBaseWomanBirth())); - // 根据“纠正末次月经”计算孕周 - dataMap.put("dueWeek", HospitalUtil.getPregnantWeek(dbFetationRecord.getHospitalCorrectLastMenstruation())); - dataMap.put("yChanQi", dbFetationRecord.getHospitalExpectedDateStr()); - dataMap.put("phone", dbFetationRecord.getContactWomanWay()); - dataMap.put("riskScore", "15");// TODO 高危评分 - dataMap.put("remarks", dbFetationRecord.getHospitalRecordRemark()); - dataMap.put("lastMenses", dbFetationRecord.getHospitalLastMenstruationStr()); - dataMap.put("buildTime", dbFetationRecord.getHospitalRecordDateStr());// 建档日期 - dataMap.put("lastBuildTime", dbFetationRecord.getHospitalRecordDateStr());// TODO - // ? - dataMap.put("birth", dbFetationRecord.getBaseWomanBirthStr()); - dataMap.put("tireNumber1", "1");// TODO ? - dataMap.put("cardNo", dbFetationRecord.getBasePapersNumber()); - dataMap.put("vcCardNo", dbFetationRecord.getHospitalPatientCard()); - dataMap.put("isSieve", "0");// TODO? - dataMap.put("isH", "0");// TODO? + WomanFetationRecord dbFetationRecord = (WomanFetationRecord)dataMap.get("dbFetationRecord"); - dataMap.put("riskFactor", riskFactor); - dataMap.put("data", data); - dataMap.put("now", DateUtil.getyyyy_MM_dd_hms(new Date())); + // 产检记录列表 TODO (此处需要查询当前产程中本院和外院的所有产检记录(包括分布建档的),之后对接方承) + List> data = new ArrayList<>(); // data 系前端指定名称 + List diagnoseInfoList = infoService.getInfoListByWomanId(dbFetationRecord.getId()); + if (!CollectionUtils.isEmpty(diagnoseInfoList)) { + for (DiagnoseInfo d : diagnoseInfoList) { + Map diagnoseInfoMap = new HashMap<>(); + // 末次月经到产检时间的孕周数 + diagnoseInfoMap.put("dueWeek", HospitalUtil + .getPregnantWeek(dbFetationRecord.getHospitalCorrectLastMenstruation(), d.getDiagnoseTime())); + diagnoseInfoMap.put("dueDate", DateUtil.getyyyy_MM_dd(dbFetationRecord.getHospitalExpectedDate()));// 预产期 + diagnoseInfoMap.put("id", d.getId()); + diagnoseInfoMap.put("checkTime", DateUtil.getyyyy_MM_dd(d.getDiagnoseTime())); + if (d.getType() != null) { + if (d.getType() == DiagnoseInfo.TYPE_FIRST) { + diagnoseInfoMap.put("title", "初诊");// 诊断类型,2为初诊,3为复诊 + } else if (d.getType() == DiagnoseInfo.TYPE_SECOND) { + diagnoseInfoMap.put("title", "复诊");// 诊断类型,2为初诊,3为复诊 + } + } else { + diagnoseInfoMap.put("title", null); + } + diagnoseInfoMap.put("type", d.getType());// 诊断类型,2为初诊,3为复诊 + diagnoseInfoMap.put("hospitalName", orgService.getNameById(d.getOrgId())); + diagnoseInfoMap.put("hospitalId", d.getOrgId()); + diagnoseInfoMap.put("enableEdit", "1");// 是否允许编辑 + data.add(diagnoseInfoMap); + } + } + + dataMap.put("data", data);//产检记录列表 + dataMap.remove("dbFetationRecord"); return AjaxResult.returnSuccess(dataMap); } diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequest.java b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequest.java new file mode 100644 index 0000000..57807a8 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequest.java @@ -0,0 +1,608 @@ +package com.lyms.hospital.request.exam; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.lyms.hospital.util.Form; + +/** + * Created by Administrator on 2016/6/17 0017. + */ +@Form +public class ChildbirthAddRequest{ + private String id; + // + private String pid; + //产妇id + private String parentId; + //分娩时间 + private String dueDate; + //分娩孕周 + private String dueWeek; + //胎数 + private Integer tireNumber; + //胎盘 + private String placenta; + //胎盘信息 + private List placentas; + //胎盘及新生儿 + private List> extPlacentas; + //分娩方式 + private Map deliveryMode; + //手术原因 + private String operationCause; + //产程 h 小时 m 分 + private Map prodprocess; + //总产程 + private Map totalprocess; + //会阴情况 + private String perinealCondition; + //撕裂等级 + private Integer siLielevel; + //锋线针数 + private Integer needleNum; + //产妇情况 + private String maternalInfo; + //死亡原因 + private String deathCause; + //死亡原因其他 + private String deathCauseText; + //产后血压 + private Map chBp; + //产后2小时血压 + private Map ch2Bp; + //呼吸 + private String breath; + // 脉搏 + private String pulse; + // 一小时失血量 + private Double oHloseBloodL; + //二小时失血量 + private Double tHloseBloodL; + //二十四小时失血量 + private Double rHloseBloodL; + //第3产层+产后失血量 + private Double sHloseBloodL; + //失血原因 + private java.util.Map loseBloodCause; + //产科并发症 + private java.util.Map ocs; + + + private List babies; + //分娩医院 + private String fmHospital; + //接生医生 + private String deliverDoctor; + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getDeathCauseText() { + return deathCauseText; + } + + public void setDeathCauseText(String deathCauseText) { + this.deathCauseText = deathCauseText; + } + + public List> getExtPlacentas() { + return extPlacentas; + } + + public void setExtPlacentas(List> extPlacentas) { + this.extPlacentas = extPlacentas; + } + + public Double getoHloseBloodL() { + return oHloseBloodL; + } + + public void setoHloseBloodL(Double oHloseBloodL) { + this.oHloseBloodL = oHloseBloodL; + } + + public Double getrHloseBloodL() { + return rHloseBloodL; + } + + public void setrHloseBloodL(Double rHloseBloodL) { + this.rHloseBloodL = rHloseBloodL; + } + + public Double getsHloseBloodL() { + return sHloseBloodL; + } + + public void setsHloseBloodL(Double sHloseBloodL) { + this.sHloseBloodL = sHloseBloodL; + } + + public Double gettHloseBloodL() { + return tHloseBloodL; + } + + public void settHloseBloodL(Double tHloseBloodL) { + this.tHloseBloodL = tHloseBloodL; + } + + public List getBabies() { + return babies; + } + + public void setBabies(List babies) { + this.babies = babies; + } + + public String getBreath() { + return breath; + } + + public void setBreath(String breath) { + this.breath = breath; + } + + + public String getDueDate() { + return dueDate; + } + + public void setDueDate(String dueDate) { + this.dueDate = dueDate; + } + + public Integer getSiLielevel() { + return siLielevel; + } + + public void setSiLielevel(Integer siLielevel) { + this.siLielevel = siLielevel; + } + + public String getDueWeek() { + return dueWeek; + } + + public void setDueWeek(String dueWeek) { + this.dueWeek = dueWeek; + } + + public String getFmHospital() { + return fmHospital; + } + + public void setFmHospital(String fmHospital) { + this.fmHospital = fmHospital; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Map getLoseBloodCause() { + return loseBloodCause; + } + + public void setLoseBloodCause(Map loseBloodCause) { + this.loseBloodCause = loseBloodCause; + } + + + public Integer getTireNumber() { + return tireNumber; + } + + public void setTireNumber(Integer tireNumber) { + this.tireNumber = tireNumber; + } + + public String getMaternalInfo() { + return maternalInfo; + } + + public void setMaternalInfo(String maternalInfo) { + this.maternalInfo = maternalInfo; + } + + + + public Integer getNeedleNum() { + return needleNum; + } + + public void setNeedleNum(Integer needleNum) { + this.needleNum = needleNum; + } + + + + public String getOperationCause() { + return operationCause; + } + + public void setOperationCause(String operationCause) { + this.operationCause = operationCause; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getPerinealCondition() { + return perinealCondition; + } + + public void setPerinealCondition(String perinealCondition) { + this.perinealCondition = perinealCondition; + } + + public String getPlacenta() { + return placenta; + } + + public void setPlacenta(String placenta) { + this.placenta = placenta; + } + + public List getPlacentas() { + return placentas; + } + + public void setPlacentas(List placentas) { + this.placentas = placentas; + } + + + + public String getPulse() { + return pulse; + } + + public void setPulse(String pulse) { + this.pulse = pulse; + } + + + + + public Map getCh2Bp() { + return ch2Bp; + } + + public void setCh2Bp(Map ch2Bp) { + this.ch2Bp = ch2Bp; + } + + public Map getChBp() { + return chBp; + } + + public void setChBp(Map chBp) { + this.chBp = chBp; + } + + public String getDeathCause() { + return deathCause; + } + + public void setDeathCause(String deathCause) { + this.deathCause = deathCause; + } + + public String getDeliverDoctor() { + return deliverDoctor; + } + + public void setDeliverDoctor(String deliverDoctor) { + this.deliverDoctor = deliverDoctor; + } + + public Map getDeliveryMode() { + return deliveryMode; + } + + public void setDeliveryMode(Map deliveryMode) { + this.deliveryMode = deliveryMode; + } + + public Map getOcs() { + return ocs; + } + + public void setOcs(Map ocs) { + this.ocs = ocs; + } + + public Map getProdprocess() { + return prodprocess; + } + + public void setProdprocess(Map prodprocess) { + this.prodprocess = prodprocess; + } + + public Map getTotalprocess() { + return totalprocess; + } + + public void setTotalprocess(Map totalprocess) { + this.totalprocess = totalprocess; + } + + public static class Placenta implements Serializable{ + private static final long serialVersionUID = 1L; + //心率 + private Double heartRate; + //胎方位 + private String fetalPosition; + //胎先露 + private String fetalPresentation; + // 衔接 + private String join; + + public String getFetalPosition() { + return fetalPosition; + } + + public void setFetalPosition(String fetalPosition) { + this.fetalPosition = fetalPosition; + } + + public String getFetalPresentation() { + return fetalPresentation; + } + + public void setFetalPresentation(String fetalPresentation) { + this.fetalPresentation = fetalPresentation; + } + + public Double getHeartRate() { + return heartRate; + } + + public void setHeartRate(Double heartRate) { + this.heartRate = heartRate; + } + + public String getJoin() { + return join; + } + + public void setJoin(String join) { + this.join = join; + } + } + + public static class Baby{ + + private String id; + //新生儿性别; + private String babyGender; + //新生儿重量 + private String babyWeight; + //新生儿生长 + private String babyHeight; + //畸形 0非畸形 1畸形 + private Integer deformity; + //apgar评分 + private Map apgarScore; + //窒息分钟 + private String asphyxiaM; + // 妊娠结局 + private String pregnancyOut; + //新生儿疾病 + private String babyHealthy; + //母婴接触开始 + private String contactStartM; + //母婴接触时间 + private String contactM; + //早吮吸 + private String earlySuck; + //分娩时间 + private String dueTime; + + //儿童诊断 + private String babyDiagnosis; + + //病历号(住院号) + private String blNo; + + public String getBabyDiagnosis() { + return babyDiagnosis; + } + + public void setBabyDiagnosis(String babyDiagnosis) { + this.babyDiagnosis = babyDiagnosis; + } + + public String getBlNo() { + return blNo; + } + + public void setBlNo(String blNo) { + this.blNo = blNo; + } + + public String getDueTime() { + return dueTime; + } + + public void setDueTime(String dueTime) { + this.dueTime = dueTime; + } + + public Map getApgarScore() { + return apgarScore; + } + + public void setApgarScore(Map apgarScore) { + this.apgarScore = apgarScore; + } + + public String getAsphyxiaM() { + return asphyxiaM; + } + + public void setAsphyxiaM(String asphyxiaM) { + this.asphyxiaM = asphyxiaM; + } + + public String getBabyGender() { + return babyGender; + } + + public void setBabyGender(String babyGender) { + this.babyGender = babyGender; + } + + public String getBabyHealthy() { + return babyHealthy; + } + + public void setBabyHealthy(String babyHealthy) { + this.babyHealthy = babyHealthy; + } + + public String getBabyHeight() { + return babyHeight; + } + + public void setBabyHeight(String babyHeight) { + this.babyHeight = babyHeight; + } + + public String getBabyWeight() { + return babyWeight; + } + + public void setBabyWeight(String babyWeight) { + this.babyWeight = babyWeight; + } + + public String getContactM() { + return contactM; + } + + public void setContactM(String contactM) { + this.contactM = contactM; + } + + public String getContactStartM() { + return contactStartM; + } + + public void setContactStartM(String contactStartM) { + this.contactStartM = contactStartM; + } + + public Integer getDeformity() { + return deformity; + } + + public void setDeformity(Integer deformity) { + this.deformity = deformity; + } + + public String getEarlySuck() { + return earlySuck; + } + + public void setEarlySuck(String earlySuck) { + this.earlySuck = earlySuck; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPregnancyOut() { + return pregnancyOut; + } + + public void setPregnancyOut(String pregnancyOut) { + this.pregnancyOut = pregnancyOut; + } + + @Override + public String toString() { + return "Baby{" + + "id='" + id + '\'' + + ", babyGender='" + babyGender + '\'' + + ", babyWeight='" + babyWeight + '\'' + + ", babyHeight='" + babyHeight + '\'' + + ", deformity=" + deformity + + ", apgarScore=" + apgarScore + + ", asphyxiaM='" + asphyxiaM + '\'' + + ", pregnancyOut='" + pregnancyOut + '\'' + + ", babyHealthy='" + babyHealthy + '\'' + + ", contactStartM='" + contactStartM + '\'' + + ", contactM='" + contactM + '\'' + + ", earlySuck='" + earlySuck + '\'' + + ", dueTime='" + dueTime + '\'' + + '}'; + } + } +/* public static void main(String[] args){ + MatDeliverAddRequest matDeliverAddRequest = new MatDeliverAddRequest(); + List babies = new ArrayList<>(); + babies.add(matDeliverAddRequest .new Baby()); + matDeliverAddRequest.setBabies(babies); + System.out.print(JsonUtil.obj2JsonString(matDeliverAddRequest)); + }*/ + + @Override + public String toString() { + return "MatDeliverAddRequest{" + + "id='" + id + '\'' + + ", pid='" + pid + '\'' + + ", parentId='" + parentId + '\'' + + ", dueDate='" + dueDate + '\'' + + ", dueWeek='" + dueWeek + '\'' + + ", tireNumber=" + tireNumber + + ", placenta='" + placenta + '\'' + + ", placentas=" + placentas + + ", extPlacentas=" + extPlacentas + + ", deliveryMode=" + deliveryMode + + ", operationCause='" + operationCause + '\'' + + ", prodprocess=" + prodprocess + + ", totalprocess=" + totalprocess + + ", perinealCondition='" + perinealCondition + '\'' + + ", siLielevel=" + siLielevel + + ", needleNum=" + needleNum + + ", maternalInfo='" + maternalInfo + '\'' + + ", deathCause='" + deathCause + '\'' + + ", deathCauseText='" + deathCauseText + '\'' + + ", chBp=" + chBp + + ", ch2Bp=" + ch2Bp + + ", breath='" + breath + '\'' + + ", pulse='" + pulse + '\'' + + ", oHloseBloodL=" + oHloseBloodL + + ", tHloseBloodL=" + tHloseBloodL + + ", rHloseBloodL=" + rHloseBloodL + + ", sHloseBloodL=" + sHloseBloodL + + ", loseBloodCause=" + loseBloodCause + + ", ocs=" + ocs + + ", babies=" + babies.toString() + + ", fmHospital='" + fmHospital + '\'' + + ", deliverDoctor='" + deliverDoctor + '\'' + + '}'; + } +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequestWrapper.java b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequestWrapper.java new file mode 100644 index 0000000..eacf663 --- /dev/null +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ChildbirthAddRequestWrapper.java @@ -0,0 +1,83 @@ +package com.lyms.hospital.request.exam; + +import java.util.List; + +import com.lyms.hospital.entity.childbirth.ChildbirthInfo; +import com.lyms.hospital.entity.childbirth.ChildbirthInfoVo; +import com.lyms.hospital.entity.childbirth.ChildbirthNewborn; +import com.lyms.hospital.entity.childbirth.ChildbirthTai; +import com.lyms.hospital.entity.childbirth.ChildbirthTaipan; + +public class ChildbirthAddRequestWrapper { + + private ChildbirthAddRequest request; + private ChildbirthInfoVo vo; + private ChildbirthInfo info; + private List newbornList; + private List taipanList; + private List taiList; + + public ChildbirthAddRequestWrapper() { + } + + public ChildbirthAddRequestWrapper(ChildbirthAddRequest req) { + this.request = req; + if(req!=null){ + String[] req_map = {"id","pid","parentId"}; + String[] info_map = {"id","personId","womanId"}; + info = new ChildbirthInfo(); +// info.setId(req.getId()); +// info.setPersonId(req.getPid()); + } + + } + + public ChildbirthAddRequest getRequest() { + return request; + } + + public void setRequest(ChildbirthAddRequest request) { + this.request = request; + } + + public ChildbirthInfoVo getVo() { + return vo; + } + + public void setVo(ChildbirthInfoVo vo) { + this.vo = vo; + } + + public ChildbirthInfo getInfo() { + return info; + } + + public void setInfo(ChildbirthInfo info) { + this.info = info; + } + + public List getNewbornList() { + return newbornList; + } + + public void setNewbornList(List newbornList) { + this.newbornList = newbornList; + } + + public List getTaipanList() { + return taipanList; + } + + public void setTaipanList(List taipanList) { + this.taipanList = taipanList; + } + + public List getTaiList() { + return taiList; + } + + public void setTaiList(List taiList) { + this.taiList = taiList; + } + +} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ExamAddRequestWrapper.java b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ExamAddRequestWrapper.java index d44c0ba..5ec0385 100644 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ExamAddRequestWrapper.java +++ b/parent/hospital.web/src/main/java/com/lyms/hospital/request/exam/ExamAddRequestWrapper.java @@ -1,6 +1,7 @@ package com.lyms.hospital.request.exam; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,9 +35,12 @@ public class ExamAddRequestWrapper { * 胎儿列表信息 */ private List diagnoseTaiList = new ArrayList<>(); + + public ExamAddRequestWrapper(){} public ExamAddRequestWrapper(DiagnoseInfo info,DiagnoseAssit assist, List historyMapsList,List diagnoseTaiList) { + //List historySourceList this.diagnoseInfo = info; this.diagnoseAssit = assist; this.historyMapsList = historyMapsList; @@ -47,12 +51,65 @@ public class ExamAddRequestWrapper { Map assistMap = XjhMapUtil.transBean2FormatAliasMap(assist, XjhMapUtil.getKeyMap(WomanExamKeymap.original, WomanExamKeymap.alias)); infoMap.putAll(assistMap); - this.examAddRequest = (ExamAddRequest) XjhMapUtil.transMap2AliasBean(infoMap, new ExamAddRequest(), + examAddRequest = (ExamAddRequest) XjhMapUtil.transMap2AliasBean(infoMap, new ExamAddRequest(), XjhMapUtil.getKeyMap(WomanExamKeymap.original, WomanExamKeymap.alias)); - } - - public ExamAddRequestWrapper(){ - + examAddRequest.setParentId(info.getWomanId());// 孕妇档案ID + examAddRequest.setPid(info.getPersonId());// 女性居民 + // 血压 + Map bp = new HashMap<>(); + bp.put("ssy", info.getBloodShrink()); + bp.put("szy", info.getBloodDiastole()); + examAddRequest.setBp(bp); + // 处理辅助检查,"yin","ruoyang","yang"字段 + Map keyMap = new HashMap<>(); + keyMap.put(DiagnoseAssit.YIN,"yin"); + keyMap.put(DiagnoseAssit.YANG,"yang"); + keyMap.put(DiagnoseAssit.RUOYANG,"ruoyang"); + keyMap.put(null,null); + examAddRequest.setBg(keyMap.get(assist.getLiverBg()));//丙肝 + examAddRequest.setRh(keyMap.get(assist.getBloodtypeRh()));//RH血型 + examAddRequest.setYgbmky(keyMap.get(assist.getHepatitisbYgbmky()));//乙肝表面抗原 + examAddRequest.setYgbmkt(keyMap.get(assist.getHepatitisbYgbmkt()));//乙肝表面抗体 + examAddRequest.setYgeky(keyMap.get(assist.getHepatitisbYgeky()));//乙肝e抗原 + examAddRequest.setYgekt(keyMap.get(assist.getHepatitisbYgekt()));//乙肝e抗体 + examAddRequest.setYghxkt(keyMap.get(assist.getHepatitisbYghxkt()));//乙肝核心抗体 + examAddRequest.setHivkt(keyMap.get(assist.getSyphilisHiv()));//HIV抗体检测 + examAddRequest.setSyjg(keyMap.get(assist.getSyphilisSyjg()));//梅毒血清实验结果 + // 阴道分泌物 + Map ydfmw = new HashMap<>(); + ydfmw.put("ydqjd", assist.getVaginaYdqjd()); + ydfmw.put("qtText", assist.getVaginaOtherTxt()); + ydfmw.put("qt", new Integer(1).equals(assist.getVaginaOther())); + ydfmw.put("jsjmj", new Integer(1).equals(assist.getVaginaJsjmj())); + ydfmw.put("dc", new Integer(1).equals(assist.getVaginaDc())); + examAddRequest.setYdfmw(ydfmw); + // 病史信息 + examAddRequest.setHistoryList(historyMapsList); + // hHealthInfo 丈夫健康情况(特殊处理) + Map hHealthInfo = new HashMap<>(); + if(historyMapsList!=null && !historyMapsList.isEmpty()){ + for(HistoryMaps hm : historyMapsList){ + if(HistoryMaps.ZFJKQK.equals(hm.getId())){//丈夫健康情况 + hHealthInfo.put("qt", hm.getOtherTxt()); + hHealthInfo.put("yesOrNo", "yes"); + break; + } + } + } + examAddRequest.sethHealthInfo(hHealthInfo); + // 胎儿信息 + List> placentas = new ArrayList<>(); + if(diagnoseTaiList!=null && !diagnoseTaiList.isEmpty()){ + for(DiagnoseTai tai : diagnoseTaiList){ + Map taiMap = new HashMap<>(); + taiMap.put("heartRate", tai.getHeartRate()); + taiMap.put("fetalPosition", tai.getPosition()); + taiMap.put("fetalPresentation", tai.getFirstExpose()); + taiMap.put("join", tai.getIsLink()); + placentas.add(taiMap); + } + } + examAddRequest.setPlacentas(placentas); } @SuppressWarnings("unchecked") @@ -95,7 +152,6 @@ public class ExamAddRequestWrapper { } } diagnoseAssit = (DiagnoseAssit) XjhMapUtil.transMap2FormatBean(assistMap, new DiagnoseAssit()); - // 其他老版本结构数据补录 // 阴道分泌物 Map ydfmw = request.getYdfmw(); if (ydfmw != null) { @@ -155,8 +211,8 @@ public class ExamAddRequestWrapper { } } } - } // 病史信息 end - // hHealthInfo 丈夫健康情况(特殊处理) + } + Map hHealthInfo = request.gethHealthInfo(); if (hHealthInfo != null) { if ("yes".equals(this.obj2Str(hHealthInfo.get("yesOrNo")))) { diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/util/HospitalUtil.java b/parent/hospital.web/src/main/java/com/lyms/hospital/util/HospitalUtil.java deleted file mode 100644 index f4579f6..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/util/HospitalUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.lyms.hospital.util; - -import java.util.Date; - -import com.lyms.util.DateUtil; - -/** - * 计算孕周
    - * a
    - * - * @author xujiahong - * - */ -public class HospitalUtil { - - /** - *
  • @Description: - *
  • @param date 末次月经日期 - *
  • @return - *
  • 创建人:xujiahong - *
  • 创建时间:2017年4月24日 - *
  • 修改人: - *
  • 修改时间: - */ - public static String getPregnantWeek(Date date) { - Date now = new Date(); - int days = DateUtil.daysBetween(date, now);//返回两个日期的间隔天数 - if (days < 0) { - return ""; - } - if (days >= 294) { - return "已分娩"; - } - int week = (days / 7); - int day = (days % 7); - return "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); - } - -} diff --git a/parent/hospital.web/src/main/java/com/lyms/hospital/util/UnitConstants.java b/parent/hospital.web/src/main/java/com/lyms/hospital/util/UnitConstants.java deleted file mode 100644 index 3dfbaaf..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/util/UnitConstants.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.lyms.hospital.util; - -/** - * - * 单位常量,用以返回值拼接 - * - * Created by Administrator on 2017/1/11 0011. - */ -public class UnitConstants { - - public static final String CM = " cm"; - public static final String KG = " kg"; - public static final String MMHG = " mmHg"; - public static final String CIFEN = " 次/分"; - public static final String GL = " g/L"; - public static final String MMOLL = " mmol/L"; - public static final String CI = " 次"; - public static final String UL = " U/L"; - public static final String TEN_LKG = "×109/L"; -// public static final String TEN_LKG = " 10^9/L"; - public static final String UMOLL = " umol/L"; - public static final String ZHEN = " 针"; - public static final String ML = " ml"; - public static final String G = " g"; - public static final String FEN = " 分"; - public static final String FZ = " 分钟"; - public static final String GE = " 个"; - public static final String SUI = " 岁"; - public static final String REN = " 人"; - public static final String HD = " 时/日"; - public static final String WENDU = " ℃"; - public static final String WSSD = " IU/日"; - public static final String DAY = " 天"; - - -} 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 deleted file mode 100644 index 1d99f04..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/OldDictionary.java +++ /dev/null @@ -1,65 +0,0 @@ -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 deleted file mode 100644 index 63ec275..0000000 --- a/parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java +++ /dev/null @@ -1,314 +0,0 @@ -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.entity.assist.DiagnoseAssit; -import com.lyms.hospital.request.exam.ExamAddRequest; -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{ - if(obj==null || property==null){ - return; - } - // 得到property对应的setter方法 - Method setter = property.getWriteMethod(); - if(value==null){//null值可匹配任何类型的对象 - setter.invoke(obj, value); - return; - } - Class keyType = property.getPropertyType(); - Class valueType = value.getClass(); - //简单处理映射字段类型不匹配的情况 - 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) { - if(map==null || obj==null){ - return null; - } - 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); - e.printStackTrace(); - } - return obj; - } - - public static Object transMap2AliasBean(Map map, Object obj, HashMap keyMap) { - if(map==null || obj==null || keyMap==null){ - return null; - } - try { - BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (PropertyDescriptor property : propertyDescriptors) { - String field = property.getName(); - if (keyMap.containsKey(field)) { - Object value = map.get(keyMap.get(field)); - invokeIgnoreType(property,value,obj); - } - } - } catch (Exception e) { - System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); - System.err.println("transMap2Bean Error " + e); - e.printStackTrace(); - } - return obj; - } - - // 自动处理时间字段和对应的字符串字段(Str结尾) - public static Object transMap2FormatBean(Map map, Object obj) { - if(map==null || obj==null){ - return null; - } - 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(0,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); - e.printStackTrace(); - } - return obj; - } - - public static Map transBean2Map(Object obj) { - if(obj==null){ - return null; - } - 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); - e.printStackTrace(); - } - 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) { - if(keyMap==null || obj==null){ - return null; - } - 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.containsKey(field)) { - map.put(keyMap.get(field), value); - } - } - } - } catch (Exception e) { - System.err.println("映射"+obj.getClass().getName()+"对象时发生错误"); - System.err.println("transBean2AliasMap Error " + e); - e.printStackTrace(); - } - return map; - } - - public static Map transBean2FormatAliasMap(Object obj, HashMap keyMap) { - if(keyMap==null || obj==null){ - return null; - } - 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); - e.printStackTrace(); - } - 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 - */ - private 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) { - e.printStackTrace(); - } - } - - /* - * 方便书写 json - */ - private 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 DiagnoseAssit()); -// printJsonByArray(WomanFetationRecordKeymap.alias); - } - -} diff --git a/parent/hospital.web/src/main/resources/xml/app-shiro.xml b/parent/hospital.web/src/main/resources/xml/app-shiro.xml index c6edf1c..66aaaaa 100644 --- a/parent/hospital.web/src/main/resources/xml/app-shiro.xml +++ b/parent/hospital.web/src/main/resources/xml/app-shiro.xml @@ -47,6 +47,7 @@ /login/tokens = anon /** = user,forceLogout + /commonApi/* = anon