Commit 3d1cb89e065675f84be74572094ba15feeb44dcf

Authored by xujiahong
1 parent a2758e4e67
Exists in master

完成接口:查看孕妇建档页面信息,删除孕妇建档

Showing 16 changed files with 756 additions and 131 deletions

parent/base.common/src/main/java/com/lyms/base/common/service/sys/SysDictService.java View file @ 3d1cb89
... ... @@ -32,6 +32,17 @@
32 32 * <li>修改时间:
33 33 */
34 34 public List<SysDict> getDictListByTypeCode(Serializable typeCode);
  35 +
  36 + /**
  37 + * <li>@Description:根据ID获取字典中对应的记录名称
  38 + * <li>@param id
  39 + * <li>@return
  40 + * <li>创建人:xujiahong
  41 + * <li>创建时间:2017年4月21日
  42 + * <li>修改人:
  43 + * <li>修改时间:
  44 + */
  45 + public String getDictNameById(String id);
35 46  
36 47 }
parent/base.common/src/main/java/com/lyms/base/common/service/sys/impl/SysDictServiceImpl.java View file @ 3d1cb89
... ... @@ -27,5 +27,11 @@
27 27 public List<SysDict> getDictListByTypeCode(Serializable typeCode) {
28 28 return baseMapper.getDictListByTypeCode(typeCode);
29 29 }
  30 +
  31 + @Override
  32 + public String getDictNameById(String id) {
  33 + SysDict dic = baseMapper.selectById(id);
  34 + return dic==null?null:dic.getTxt();
  35 + }
30 36 }
parent/core.sdk/src/main/java/com/lyms/util/DateUtil.java View file @ 3d1cb89
... ... @@ -531,7 +531,10 @@
531 531 long time1 = cal.getTimeInMillis();
532 532 cal.setTime(bdate);
533 533 long time2 = cal.getTimeInMillis();
534   - long between_days = (time2 - time1) / (1000 * 3600 * 24);
  534 + long between_days = (time2 - time1) / (1000L * 3600 * 24);
  535 + if(between_days<0){//add by xujiahong : we don't need to know the date sequence
  536 + between_days = 0-between_days;
  537 + }
535 538 return Integer.parseInt(String.valueOf(between_days));
536 539 } catch (ParseException e) {
537 540 e.printStackTrace();
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.java View file @ 3d1cb89
... ... @@ -35,6 +35,17 @@
35 35 */
36 36 public List<Map<String, Object>> selectHistory(@Param("cardType") String cardType, @Param("cardNo") String cardNo,
37 37 @Param("vcCardNo") String vcCardNo);
  38 +
  39 + /**
  40 + * <li>@Description:关联&合并省市区信息,避免接口多次建立SQL链接
  41 + * <li>@param id
  42 + * <li>@return
  43 + * <li>创建人:xujiahong
  44 + * <li>创建时间:2017年4月24日
  45 + * <li>修改人:
  46 + * <li>修改时间:
  47 + */
  48 + public WomanFetationRecord selectDetailById(String id);
38 49  
39 50 }
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/woman/WomanFetationRecordMapper.xml View file @ 3d1cb89
... ... @@ -56,16 +56,25 @@
56 56 <result column="IFDEL" property="ifdel" />
57 57 <result column="ENALBLE" property="enalble" />
58 58 <result column="WOMAN_PERSON_ID" property="womanPersonId" />
  59 + <result column="WOMAN_TYPE" property="womanType" />
  60 + <result column="DUE_STATUS" property="dueStatus" />
  61 + <result column="SOURCE_ID" property="sourceId" />
  62 +
  63 + <result column="liveAddress" property="liveAddress" />
  64 + <result column="registerAddress" property="registerAddress" />
  65 + <result column="postpartumAddress" property="postpartumAddress" />
59 66 </resultMap>
60 67  
61 68 <!-- 通用查询结果列 -->
62 69 <sql id="Base_Column_List">
63   - ID AS id, BASE_WOMAN_NAME AS baseWomanName, BASE_PAPERS_TYPE AS basePapersType, BASE_PAPERS_NUMBER AS basePapersNumber, BASE_WOMAN_COUNTRY AS baseWomanCountry, BASE_WOMAN_NATION AS baseWomanNation, BASE_WOMAN_BIRTH AS baseWomanBirth, BASE_REGISTER_TYPE AS baseRegisterType, BASE_DWELL_TYPE AS baseDwellType, BASE_OCCUPATION_TYPE AS baseOccupationType, BASE_WOMAN_CULTURE AS baseWomanCulture, BASE_FAMILY_INCOME AS baseFamilyIncome, CONTACT_WOMAN_WAY AS contactWomanWay, CONTACT_WORK_ADDRESS AS contactWorkAddress, CONTACT_DWELL_PROVINCE AS contactDwellProvince, CONTACT_DWELL_CITY AS contactDwellCity, CONTACT_DWELL_AREA AS contactDwellArea, CONTACT_DWELL_STREET AS contactDwellStreet, CONTACT_DWELL_DETAIL AS contactDwellDetail, CONTACT_REGISTER_PROVINCE AS contactRegisterProvince, CONTACT_REGISTER_CITY AS contactRegisterCity, CONTACT_REGISTER_AREA AS contactRegisterArea, CONTACT_REGISTER_STREET AS contactRegisterStreet, CONTACT_REGISTER_DETAIL AS contactRegisterDetail, CONTACT_POSTPARTUM_PROVINCE AS contactPostpartumProvince, CONTACT_POSTPARTUM_CITY AS contactPostpartumCity, CONTACT_POSTPARTUM_AREA AS contactPostpartumArea, CONTACT_POSTPARTUM_STREET AS contactPostpartumStreet, CONTACT_POSTPARTUM_DETAIL AS contactPostpartumDetail, HOSPITAL_LAST_MENSTRUATION AS hospitalLastMenstruation, HOSPITAL_CORRECT_LAST_MENSTRUATION AS hospitalCorrectLastMenstruation, HOSPITAL_EXPECTED_DATE AS hospitalExpectedDate, HOSPITAL_PATIENT_CARD AS hospitalPatientCard, HOSPITAL_BARCODE AS hospitalBarcode, HOSPITAL_RECORD_NUMBER AS hospitalRecordNumber, HOSPITAL_SERVICE_TYPE AS hospitalServiceType, HOSPITAL_SERVICE_STATUS AS hospitalServiceStatus, HOSPITAL_MEMBER AS hospitalMember, HOSPITAL_RECORD_DOCTOR AS hospitalRecordDoctor, HOSPITAL_RECORD_DATE AS hospitalRecordDate, HOSPITAL_RECORD_REMARK AS hospitalRecordRemark, HOSPITAL_MEMBER_DATE AS hospitalMemberDate, BUILD_DATE AS buildDate, HOSTPITAL_ID AS hostpitalId, BUILD_TYPE AS buildType, CREATE_ID AS createId, CREATE_TIME AS createTime, MODIFY_ID AS modifyId, MODIFY_TIME AS modifyTime, IFDEL AS ifdel, ENALBLE AS enalble, WOMAN_PERSON_ID AS womanPersonId
  70 + 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,
  71 + WOMAN_TYPE AS womanType,DUE_STATUS AS dueStatus,SOURCE_ID AS sourceId
64 72 </sql>
65 73  
66 74 <select id="selectHistory" resultType="map">
67 75 SELECT wf.HOSPITAL_RECORD_DATE AS bookbuildDate,org.`NAME` AS bookbuildHospital,
68   - wf.`HOSTPITAL_ID` AS hospitalId,wf.`ID` AS id
  76 + wf.`HOSTPITAL_ID` AS hospitalId,wf.`ID` AS id,
  77 + 0 AS dueStatus,null AS fmTime,1 AS type <!-- TODO 部分未涉及字段 -->
69 78 FROM WOMAN_FETATION_RECORD wf
70 79 INNER JOIN SYS_ORGANIZATIONS org ON wf.`HOSTPITAL_ID`=org.`ID`
71 80 <where>
... ... @@ -80,6 +89,14 @@
80 89 </if>
81 90 </where>
82 91 ORDER BY wf.HOSPITAL_RECORD_DATE DESC
  92 + </select>
  93 +
  94 + <select id="selectDetailById" resultMap="BaseResultMap">
  95 + SELECT *,
  96 +CONCAT(CONTACT_DWELL_PROVINCE,CONTACT_DWELL_CITY,CONTACT_DWELL_AREA,CONTACT_DWELL_STREET,CONTACT_DWELL_DETAIL) AS liveAddress,
  97 +CONCAT(CONTACT_REGISTER_PROVINCE,CONTACT_REGISTER_CITY,CONTACT_REGISTER_AREA,CONTACT_REGISTER_STREET,CONTACT_REGISTER_DETAIL) AS registerAddress,
  98 +CONCAT(CONTACT_POSTPARTUM_PROVINCE,CONTACT_POSTPARTUM_CITY,CONTACT_POSTPARTUM_AREA,CONTACT_POSTPARTUM_STREET,CONTACT_POSTPARTUM_DETAIL) AS postpartumAddress
  99 + FROM WOMAN_FETATION_RECORD WHERE ID = #{id}
83 100 </select>
84 101  
85 102 </mapper>
parent/hospital.mac/src/main/java/com/lyms/hospital/entity/woman/WomanFetationRecord.java View file @ 3d1cb89
... ... @@ -256,10 +256,8 @@
256 256 */
257 257 @TableField(value="WOMAN_PERSON_ID")
258 258 private String womanPersonId;
259   -
260   -
261 259 /**
262   - * 孕妇出生============================================================================
  260 + * 孕妇出生
263 261 */
264 262 @TableField(value="BASE_WOMAN_BIRTH")
265 263 private Date baseWomanBirth;
... ... @@ -283,6 +281,16 @@
283 281 */
284 282 @TableField(value="HOSPITAL_RECORD_DATE")
285 283 private Date hospitalRecordDate;
  284 +
  285 + //妇女类别:1孕妇,3产妇
  286 + @TableField(value="WOMAN_TYPE")
  287 + private Integer womanType;
  288 + //分娩状态 0未终止妊娠 1终止妊娠
  289 + @TableField(value="DUE_STATUS")
  290 + private Integer dueStatus;
  291 + //隐藏建档源ID
  292 + @TableField(value="SOURCE_ID")
  293 + private String sourceId;
286 294  
287 295 //格式化字段
288 296 @TableField(exist=false)
... ... @@ -295,6 +303,14 @@
295 303 private String hospitalExpectedDateStr;//预产期Str
296 304 @TableField(exist=false)
297 305 private String hospitalRecordDateStr;//建档日期Str
  306 +
  307 + //地址拼接字段
  308 + @TableField(exist=false)
  309 + private String liveAddress;//居住地
  310 + @TableField(exist=false)
  311 + private String registerAddress;//户籍地
  312 + @TableField(exist=false)
  313 + private String postpartumAddress;//产后休养地
298 314  
299 315 public String getId() {
300 316 return id;
... ... @@ -750,6 +766,54 @@
750 766  
751 767 public void setHospitalRecordDateStr(String hospitalRecordDateStr) {
752 768 this.hospitalRecordDateStr = hospitalRecordDateStr;
  769 + }
  770 +
  771 + public String getLiveAddress() {
  772 + return liveAddress;
  773 + }
  774 +
  775 + public void setLiveAddress(String liveAddress) {
  776 + this.liveAddress = liveAddress;
  777 + }
  778 +
  779 + public String getRegisterAddress() {
  780 + return registerAddress;
  781 + }
  782 +
  783 + public void setRegisterAddress(String registerAddress) {
  784 + this.registerAddress = registerAddress;
  785 + }
  786 +
  787 + public String getPostpartumAddress() {
  788 + return postpartumAddress;
  789 + }
  790 +
  791 + public void setPostpartumAddress(String postpartumAddress) {
  792 + this.postpartumAddress = postpartumAddress;
  793 + }
  794 +
  795 + public Integer getWomanType() {
  796 + return womanType;
  797 + }
  798 +
  799 + public void setWomanType(Integer womanType) {
  800 + this.womanType = womanType;
  801 + }
  802 +
  803 + public Integer getDueStatus() {
  804 + return dueStatus;
  805 + }
  806 +
  807 + public void setDueStatus(Integer dueStatus) {
  808 + this.dueStatus = dueStatus;
  809 + }
  810 +
  811 + public String getSourceId() {
  812 + return sourceId;
  813 + }
  814 +
  815 + public void setSourceId(String sourceId) {
  816 + this.sourceId = sourceId;
753 817 }
754 818  
755 819  
parent/hospital.mac/src/main/java/com/lyms/hospital/enums/ServiceStatusEnums.java View file @ 3d1cb89
  1 +package com.lyms.hospital.enums;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * Created by Administrator on 2016/6/21.
  10 + */
  11 +public enum ServiceStatusEnums {
  12 +
  13 + //标准服务
  14 + STANDARD_ALL(101,"全部",0),
  15 + STANDARD_OPEN(0,"开通",0),
  16 + NO_OPEN(1,"不开通",0),
  17 + STANDARD_OVERDUE(2,"过期",0),
  18 +
  19 + //增值服务
  20 + ADD_ALL(102,"全部",1),
  21 + ADD_OPEN(3,"开通",1),
  22 + UNSUBSCRIBE(4,"退订",1),
  23 + ADD_OVERDUE(5,"过期",1),
  24 + SUSPEND(6,"暂停",1),
  25 +
  26 + //全部
  27 + ALL(103,"全部",100),
  28 + ALL_OPEN(7,"开通",100),
  29 + ALL_NO_OPEN(8,"不开通",100),
  30 + ALL_OVERDUE(9,"过期",100);
  31 +
  32 + private ServiceStatusEnums(int id, String name,int pid){
  33 + this.name=name;
  34 + this.id =id;
  35 + this.pid =pid;
  36 + }
  37 + private String name;
  38 + private int id;
  39 + private int pid;
  40 +
  41 +
  42 + public static List<Map<String,String>> getServiceStatusList()
  43 + {
  44 + List<Map<String,String>> list = new ArrayList<>();
  45 + for(ServiceStatusEnums s : ServiceStatusEnums.values()) {
  46 + if (s.getId() < 100)
  47 + {
  48 + Map<String,String> map = new HashMap<>();
  49 + map.put("id", String.valueOf(s.getId()));
  50 + map.put("name", s.getName());
  51 + map.put("pid", String.valueOf(s.getPid()));
  52 + list.add(map);
  53 + }
  54 +
  55 + }
  56 + return list;
  57 + }
  58 +
  59 + public static List<Map<String,String>> getServiceTypeList()
  60 + {
  61 + List<Map<String,String>> list = new ArrayList<>();
  62 + Map<String, String> stMap1 = new HashMap<>();
  63 + stMap1.put("id", "0");
  64 + stMap1.put("name", "标准服务");
  65 + Map<String, String> stMap2 = new HashMap<>();
  66 + stMap2.put("id", "1");
  67 + stMap2.put("name", "增值服务");
  68 + list.add(stMap1);
  69 + list.add(stMap2);
  70 + return list;
  71 + }
  72 +
  73 +
  74 + public static List<Map<String,String>> getServiceStatusByPid(int pid)
  75 + {
  76 + List<Map<String,String>> list = new ArrayList<>();
  77 + for(ServiceStatusEnums s : ServiceStatusEnums.values()) {
  78 + if (s.getPid() == pid)
  79 + {
  80 + Map<String,String> map = new HashMap<>();
  81 + map.put("id", String.valueOf(s.getId()));
  82 + map.put("name", s.getName());
  83 + map.put("pid", String.valueOf(s.getPid()));
  84 + list.add(map);
  85 + }
  86 +
  87 + }
  88 + return list;
  89 + }
  90 +
  91 + public static String getNameById(Integer id)
  92 + {
  93 + for(ServiceStatusEnums s : ServiceStatusEnums.values()) {
  94 + if (id != null && s.getId() == id)
  95 + {
  96 + return s.getName();
  97 + }
  98 +
  99 + }
  100 + return "";
  101 + }
  102 +
  103 + public String getName() {
  104 + return name;
  105 + }
  106 +
  107 + public void setName(String name) {
  108 + this.name = name;
  109 + }
  110 +
  111 + public int getId() {
  112 + return id;
  113 + }
  114 +
  115 + public void setId(int id) {
  116 + this.id = id;
  117 + }
  118 +
  119 + public int getPid() {
  120 + return pid;
  121 + }
  122 +
  123 + public void setPid(int pid) {
  124 + this.pid = pid;
  125 + }
  126 +}
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/WomanFetationRecordService.java View file @ 3d1cb89
... ... @@ -20,6 +20,17 @@
20 20 * @since 2017-03-31
21 21 */
22 22 public interface WomanFetationRecordService extends BaseService<WomanFetationRecord> {
  23 +
  24 + /**
  25 + * <li>@Description:条件查询对象(未删除的)(主要用于验证条件下的存在性)
  26 + * <li>@param obj
  27 + * <li>@return
  28 + * <li>创建人:xujiahong
  29 + * <li>创建时间:2017年4月24日
  30 + * <li>修改人:
  31 + * <li>修改时间:
  32 + */
  33 + public WomanFetationRecord queryOne(WomanFetationRecord obj);
23 34  
24 35 /**
25 36 * <li>@Description:查询-查询历史建档记录(by证件信息和就诊卡号)
... ... @@ -100,5 +111,15 @@
100 111 */
101 112 public WomanFetationRecord findByCard(String cardType, String cardNum, String patientNum, String orgid);
102 113  
  114 + /**
  115 + * <li>@Description:关联&合并省市区信息,避免接口多次建立SQL链接
  116 + * <li>@param id
  117 + * <li>@return
  118 + * <li>创建人:xujiahong
  119 + * <li>创建时间:2017年4月24日
  120 + * <li>修改人:
  121 + * <li>修改时间:
  122 + */
  123 + public WomanFetationRecord selectDetailById(String id);
103 124 }
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java View file @ 3d1cb89
... ... @@ -9,6 +9,7 @@
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.stereotype.Service;
11 11 import org.springframework.transaction.annotation.Transactional;
  12 +import org.springframework.util.StringUtils;
12 13  
13 14 import com.baomidou.mybatisplus.mapper.EntityWrapper;
14 15 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
15 16  
... ... @@ -43,8 +44,18 @@
43 44 private WomanFetationRecordMapper fetationMapper;
44 45  
45 46 public Integer deleteLogicById(Serializable id){
46   - return baseMapper.deleteLogicById(id);
  47 + WomanFetationRecord w = selectById(id);
  48 + if(w==null){
  49 + return 0;
  50 + }
  51 + w.setIfdel(IfdelEnum.YES.getStatus());
  52 + return baseMapper.updateById(w);
47 53 }
  54 +
  55 + @Override
  56 + public WomanFetationRecord selectDetailById(String id){
  57 + return fetationMapper.selectDetailById(id);
  58 + }
48 59  
49 60 @Override
50 61 @Transactional
... ... @@ -100,6 +111,9 @@
100 111 }
101 112 String id = StrUtils.uuid();
102 113 obj.setId(id);
  114 + if(StringUtils.isEmpty(obj.getSourceId())){
  115 + obj.setSourceId(id);
  116 + }
103 117 obj.setCreateTime(new Date());
104 118 obj.setIfdel(IfdelEnum.NO.getStatus());
105 119 obj.setEnalble(StatusEnum.ENABLED.getStatus());
... ... @@ -116,7 +130,7 @@
116 130 * (2)查询相关的配偶信息详情
117 131 */
118 132 Map<String, Object> map = new HashMap<>();
119   - WomanFetationRecord fetationRecord = this.selectById(id);
  133 + WomanFetationRecord fetationRecord = this.selectDetailById(id);
120 134 if(fetationRecord!=null){
121 135 WomanHusband womanHusband = womanHusbandService.selectByTarget(WomanHusband.TARGET_TYPE_ARCHIVE, fetationRecord.getId());
122 136 map.put("fetationRecord", fetationRecord);
... ... @@ -128,6 +142,38 @@
128 142 @Override
129 143 public List<Map<String, Object>> selectHistory(String cardType, String cardNo, String vcCardNo) {
130 144 return fetationMapper.selectHistory(cardType, cardNo, vcCardNo);
  145 + }
  146 +
  147 + @Override
  148 + public WomanFetationRecord queryOne(WomanFetationRecord obj) {
  149 + EntityWrapper<WomanFetationRecord> ew = new EntityWrapper<>();
  150 + ew.where("IFDEL={0}", IfdelEnum.NO.getStatus());//未被删除的
  151 + if(obj.getEnalble()!=null){
  152 + ew.and("ENALBLE={0}",obj.getEnalble());
  153 + }
  154 + if(obj.getWomanType()!=null){
  155 + ew.and("WOMAN_TYPE={0}",obj.getWomanType());
  156 + }
  157 + if(obj.getDueStatus()!=null){
  158 + ew.and("DUE_STATUS={0}",obj.getDueStatus());
  159 + }
  160 + if(obj.getHostpitalId()!=null){
  161 + ew.and("HOSTPITAL_ID={0}",obj.getHostpitalId());
  162 + }
  163 + if(obj.getBuildType()!=null){
  164 + ew.and("BUILD_TYPE={0}",obj.getBuildType());
  165 + }
  166 + //证件号,联系方式,就诊卡
  167 + if(obj.getBasePapersNumber()!=null){
  168 + ew.and("BASE_PAPERS_NUMBER={0}",obj.getBasePapersNumber());
  169 + }
  170 + if(obj.getContactWomanWay()!=null){
  171 + ew.and("CONTACT_WOMAN_WAY={0}",obj.getContactWomanWay());
  172 + }
  173 + if(obj.getHospitalPatientCard()!=null){
  174 + ew.and("HOSPITAL_PATIENT_CARD={0}",obj.getHospitalPatientCard());
  175 + }
  176 + return selectOne(ew);
131 177 }
132 178 }
parent/hospital.web/src/main/java/com/lyms/hospital/controller/CommonApiController.java View file @ 3d1cb89
  1 +package com.lyms.hospital.controller;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +
  14 +import com.lyms.base.common.entity.region.Regions;
  15 +import com.lyms.base.common.service.region.RegionsService;
  16 +import com.lyms.hospital.enums.ServiceStatusEnums;
  17 +import com.lyms.hospital.util.trans.OldDictionary;
  18 +import com.lyms.hospital.util.trans.XjhMapUtil;
  19 +import com.lyms.web.bean.AjaxResult;
  20 +import com.lyms.web.controller.BaseController;
  21 +
  22 +/**
  23 + * <p>
  24 + * 公用接口-前端控制器
  25 + * </p>
  26 + *
  27 + * @author xujiahong
  28 + * @since 2017-04-21
  29 + */
  30 +@Controller
  31 +@RequestMapping("/commonApi")
  32 +public class CommonApiController extends BaseController {
  33 +
  34 + @Autowired
  35 + private RegionsService regionService;
  36 +
  37 + /**
  38 + * <li>@Description:查询省市区数据
  39 + * <li>@param parentId
  40 + * <li>@return
  41 + * <li>创建人:xujiahong
  42 + * <li>创建时间:2017年4月24日
  43 + * <li>修改人:
  44 + * <li>修改时间:
  45 + */
  46 + @RequestMapping(value = "/queryRegions", method = RequestMethod.GET)
  47 + @ResponseBody
  48 + public AjaxResult queryRegions (String parentId){
  49 + List<Regions> list = regionService.selectRegions(parentId);
  50 + return AjaxResult.returnSuccess(list);
  51 + }
  52 +
  53 + /**
  54 + * <li>@Description:查询字典数据
  55 + * <li>@return
  56 + * <li>创建人:xujiahong
  57 + * <li>创建时间:2017年4月24日
  58 + * <li>修改人:
  59 + * <li>修改时间:
  60 + */
  61 + @RequestMapping(value = "/queryDictionary", method = RequestMethod.GET)
  62 + @ResponseBody
  63 + public AjaxResult queryDictionary (){
  64 + //TODO 模拟查询数据字典的数据
  65 + Map<String,Object> dictionary = new HashMap<>();
  66 + /*户口类型*/
  67 + List<Map<String, Object>> censusType = new ArrayList<>();
  68 + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("001", "非农业户口")));
  69 + censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("002", "农业户口")));
  70 + /*证件类型*/
  71 + List<Map<String, Object>> certeType = new ArrayList<>();
  72 + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("003", "身份证")));
  73 + certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("004", "手机号")));
  74 + /*国家*/
  75 + List<Map<String, Object>> country = new ArrayList<>();
  76 + country.add(XjhMapUtil.transBean2Map(new OldDictionary("005", "中国")));
  77 + country.add(XjhMapUtil.transBean2Map(new OldDictionary("006", "美国")));
  78 + /*vip体验类型*/
  79 + List<Map<String, Object>> expYunEnums = new ArrayList<>();
  80 + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("007", "vip体验类型1")));
  81 + expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("008", "vip体验类型2")));
  82 + /*居住类型*/
  83 + List<Map<String, Object>> liveType = new ArrayList<>();
  84 + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("009", "本地")));
  85 + liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("010", "非本地")));
  86 + /*民族*/
  87 + List<Map<String, Object>> nation = new ArrayList<>();
  88 + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("011", "汉族")));
  89 + nation.add(XjhMapUtil.transBean2Map(new OldDictionary("012", "白族")));
  90 + /*职业类型*/
  91 + List<Map<String, Object>> professionType = new ArrayList<>();
  92 + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("013", "医生")));
  93 + professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("014", "教师")));
  94 + /*服务状态*/
  95 + List<Map<String, String>> serviceStatus = ServiceStatusEnums.getServiceStatusList();
  96 + /*服务类型*/
  97 + List<Map<String, String>> serviceType = ServiceStatusEnums.getServiceTypeList();
  98 +
  99 + dictionary.put("censusType", censusType);
  100 + dictionary.put("certeType", certeType);
  101 + dictionary.put("country", country);
  102 + dictionary.put("expYunEnums", expYunEnums);
  103 + dictionary.put("liveType", liveType);
  104 + dictionary.put("nation", nation);
  105 + dictionary.put("professionType", professionType);
  106 + dictionary.put("serviceStatus", serviceStatus);
  107 + dictionary.put("serviceType", serviceType);
  108 + return AjaxResult.returnSuccess(dictionary);
  109 + }
  110 +}
parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/CommonApiController.java View file @ 3d1cb89
1   -package com.lyms.hospital.controller.woman;
2   -
3   -import java.util.ArrayList;
4   -import java.util.HashMap;
5   -import java.util.List;
6   -import java.util.Map;
7   -
8   -import org.springframework.stereotype.Controller;
9   -import org.springframework.web.bind.annotation.RequestMapping;
10   -import org.springframework.web.bind.annotation.RequestMethod;
11   -import org.springframework.web.bind.annotation.ResponseBody;
12   -
13   -import com.lyms.hospital.util.trans.OldDictionary;
14   -import com.lyms.hospital.util.trans.XjhMapUtil;
15   -import com.lyms.web.bean.AjaxResult;
16   -import com.lyms.web.controller.BaseController;
17   -
18   -/**
19   - * <p>
20   - * 公用接口-前端控制器
21   - * </p>
22   - *
23   - * @author xujiahong
24   - * @since 2017-04-21
25   - */
26   -@Controller
27   -@RequestMapping("/commonApi")
28   -public class CommonApiController extends BaseController {
29   -
30   - @RequestMapping(value = "/queryDictionary", method = RequestMethod.GET)
31   - @ResponseBody
32   - public AjaxResult queryDictionary (){
33   - //TODO 模拟查询数据字典的数据
34   - Map<String,Object> dictionary = new HashMap<>();
35   - /*户口类型*/
36   - List<Map<String, Object>> censusType = new ArrayList<>();
37   - censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("001", "非农业户口")));
38   - censusType.add(XjhMapUtil.transBean2Map(new OldDictionary("002", "农业户口")));
39   - /*证件类型*/
40   - List<Map<String, Object>> certeType = new ArrayList<>();
41   - certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("003", "身份证")));
42   - certeType.add(XjhMapUtil.transBean2Map(new OldDictionary("004", "手机号")));
43   - /*国家*/
44   - List<Map<String, Object>> country = new ArrayList<>();
45   - country.add(XjhMapUtil.transBean2Map(new OldDictionary("005", "中国")));
46   - country.add(XjhMapUtil.transBean2Map(new OldDictionary("006", "美国")));
47   - /*vip体验类型*/
48   - List<Map<String, Object>> expYunEnums = new ArrayList<>();
49   - expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("007", "vip体验类型1")));
50   - expYunEnums.add(XjhMapUtil.transBean2Map(new OldDictionary("008", "vip体验类型2")));
51   - /*居住类型*/
52   - List<Map<String, Object>> liveType = new ArrayList<>();
53   - liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("009", "本地")));
54   - liveType.add(XjhMapUtil.transBean2Map(new OldDictionary("010", "非本地")));
55   - /*民族*/
56   - List<Map<String, Object>> nation = new ArrayList<>();
57   - nation.add(XjhMapUtil.transBean2Map(new OldDictionary("011", "汉族")));
58   - nation.add(XjhMapUtil.transBean2Map(new OldDictionary("012", "白族")));
59   - /*职业类型*/
60   - List<Map<String, Object>> professionType = new ArrayList<>();
61   - professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("013", "医生")));
62   - professionType.add(XjhMapUtil.transBean2Map(new OldDictionary("014", "教师")));
63   - /*服务状态*/
64   - List<Map<String, Object>> serviceStatus = new ArrayList<>();
65   - serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("015", "开通")));
66   - serviceStatus.add(XjhMapUtil.transBean2Map(new OldDictionary("016", "未开通")));
67   - /*服务类型*/
68   - List<Map<String, Object>> serviceType = new ArrayList<>();
69   - serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("017", "标准服务")));
70   - serviceType.add(XjhMapUtil.transBean2Map(new OldDictionary("018", "增值服务")));
71   - dictionary.put("censusType", censusType);
72   - dictionary.put("certeType", certeType);
73   - dictionary.put("country", country);
74   - dictionary.put("expYunEnums", expYunEnums);
75   - dictionary.put("liveType", liveType);
76   - dictionary.put("nation", nation);
77   - dictionary.put("professionType", professionType);
78   - dictionary.put("serviceStatus", serviceStatus);
79   - dictionary.put("serviceType", serviceType);
80   - return AjaxResult.returnSuccess(dictionary);
81   - }
82   -}
parent/hospital.web/src/main/java/com/lyms/hospital/controller/woman/WomanPregnantController.java View file @ 3d1cb89
... ... @@ -7,33 +7,42 @@
7 7  
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Controller;
  10 +import org.springframework.web.bind.annotation.PathVariable;
10 11 import org.springframework.web.bind.annotation.RequestBody;
11 12 import org.springframework.web.bind.annotation.RequestMapping;
12 13 import org.springframework.web.bind.annotation.RequestMethod;
13 14 import org.springframework.web.bind.annotation.ResponseBody;
14 15  
  16 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
  17 +import com.lyms.base.common.service.sys.SysDictService;
15 18 import com.lyms.hospital.entity.woman.WomanFetationRecord;
16 19 import com.lyms.hospital.entity.woman.WomanHusband;
  20 +import com.lyms.hospital.enums.IfdelEnum;
  21 +import com.lyms.hospital.enums.StatusEnum;
17 22 import com.lyms.hospital.request.woman.WomanFetationRequest;
18 23 import com.lyms.hospital.request.woman.WomanFetationRequestWrapper;
19 24 import com.lyms.hospital.response.keymap.WomanFetationRecordKeymap;
20 25 import com.lyms.hospital.response.woman.WomanFetationResponse;
21 26 import com.lyms.hospital.service.token.TokenService;
22 27 import com.lyms.hospital.service.woman.WomanFetationRecordService;
  28 +import com.lyms.hospital.util.HospitalUtil;
  29 +import com.lyms.hospital.util.UnitConstants;
23 30 import com.lyms.hospital.util.trans.XjhMapUtil;
24 31 import com.lyms.util.DateUtil;
25 32 import com.lyms.web.bean.AjaxResult;
26 33 import com.lyms.web.controller.BaseController;
27 34  
  35 +
28 36 /**
29 37 * <p>
30 38 * 孕妇档案-前端控制器
31 39 * </p>
32 40 *
33 41 * []依据cardNo或vcCardNo查询孕妇档案
34   - * []孕妇建档(新增或修改)
35   - * 依据id得到“孕妇建档”表单详情
36   - *
  42 + * [--]孕妇建档(新增或修改)
  43 + * []依据id得到“孕妇建档”表单详情
  44 + * []建档-查看页面数据
  45 + * 删除档案
37 46 * @author xujiahong
38 47 * @since 2017-04-17
39 48 */
40 49  
41 50  
... ... @@ -45,8 +54,115 @@
45 54 private WomanFetationRecordService fetationService;
46 55 @Autowired
47 56 private TokenService tokenService;
  57 + @Autowired
  58 + private SysDictService dictService;
48 59  
  60 + @RequestMapping(value = "/deletePregnant/{id}", method = RequestMethod.POST)
  61 + @ResponseBody
  62 + public AjaxResult deletePregnant(@PathVariable String id){
  63 + Integer count = fetationService.deleteLogicById(id);
  64 + if(count>0){
  65 + return AjaxResult.returnSuccess();
  66 + }else{
  67 + return AjaxResult.returnFail();
  68 + }
  69 + }
  70 +
49 71 /**
  72 + * <li>@Description:建档-查看页面数据
  73 + * <li>@param id
  74 + * <li>@return
  75 + * <li>创建人:xujiahong
  76 + * <li>创建时间:2017年4月21日
  77 + * <li>修改人:
  78 + * <li>修改时间:
  79 + */
  80 + @RequestMapping(value = "/findPatientData", method = RequestMethod.GET)
  81 + @ResponseBody
  82 + public AjaxResult findPatientData(String id){
  83 + //查询详情相关对象
  84 + Map<String, Object> serviceMap = fetationService.selectWomanFetationMapById(id);
  85 + WomanFetationRecord f = (WomanFetationRecord)serviceMap.get("fetationRecord");
  86 + WomanHusband w = (WomanHusband)serviceMap.get("womanHusband");
  87 + /*
  88 + * 这里没有新建映射,拷贝 ViewFacade 的老代码
  89 + */
  90 + Map<String, Object> map = new HashMap<>();
  91 + map.put("id", f.getId());
  92 + /* 孕妇基础数据 */
  93 + map.put("username", f.getBaseWomanName());
  94 + map.put("pcerteType", dictService.getDictNameById(f.getBasePapersType()));//证件类型
  95 + map.put("cardNo", f.getBasePapersNumber());
  96 + map.put("phone", f.getContactWomanWay());
  97 + map.put("pworkUnit", f.getContactWorkAddress());
  98 + map.put("pcountry", dictService.getDictNameById(f.getBaseWomanCountry()));
  99 + map.put("pnation", dictService.getDictNameById(f.getBaseWomanNation()));
  100 + map.put("birth", DateUtil.getyyyy_MM_dd(f.getBaseWomanBirth()));
  101 + map.put("age", DateUtil.getAge(f.getBaseWomanBirth())+UnitConstants.SUI);
  102 + map.put("pcensusType", dictService.getDictNameById(f.getBaseRegisterType()));//户籍类型
  103 + map.put("pliveType", dictService.getDictNameById(f.getBaseDwellType()));//居住类别
  104 + map.put("pprofessionType", dictService.getDictNameById(f.getBaseOccupationType()));//职业类型
  105 + map.put("plevelType", dictService.getDictNameById(f.getBaseWomanCulture()));//
  106 + map.put("baseFamilyIncome", f.getBaseFamilyIncome());//家庭人均收入
  107 +
  108 + /* 孕妇联系方式 */
  109 + map.put("residence", f.getLiveAddress());
  110 + map.put("register", f.getRegisterAddress());
  111 + map.put("postRest", f.getPostpartumAddress());
  112 +
  113 + /* 丈夫信息 */
  114 + map.put("husbandName", w.getHusbandName());
  115 + map.put("hcertificateType", dictService.getDictNameById(w.getHusbandPapersType()));
  116 + map.put("hcertificateNum", w.getHusbandPapersNumber());
  117 + map.put("hcountry", dictService.getDictNameById(w.getHusbandCountry()));
  118 + map.put("hnation", dictService.getDictNameById(w.getHusbandNation()));
  119 + map.put("husbandPhone", w.getHusbandWay());
  120 + map.put("hprofessionType", dictService.getDictNameById(w.getHusbandOccupationType()));
  121 + map.put("hworkUnit", w.getHusbandWorkAddress());
  122 + String province = w.getHusbandRegisterProvince();
  123 + String city = w.getHusbandRegisterCity();
  124 + String area = w.getHusbandRegisterArea();
  125 + String street = w.getHusbandRegisterStreet();
  126 + String detail = w.getHusbandRegisterDetail();
  127 + map.put("hregister", (province==null?"":province)
  128 + +(city==null?"":city)
  129 + +(area==null?"":area)
  130 + +(street==null?"":street)
  131 + +(detail==null?"":detail)
  132 + );
  133 +
  134 + /* 院内信息 */
  135 + //末次月经
  136 + map.put("lastMenses", DateUtil.getyyyy_MM_dd(f.getHospitalLastMenstruation()));
  137 + //孕周(用末次月经去计算)
  138 + map.put("lastMensesWeek", HospitalUtil.getPregnantWeek(f.getHospitalLastMenstruation()));
  139 + //纠正末次月经,取末次月经数据
  140 + map.put("correctionLastMenses", DateUtil.getyyyy_MM_dd(f.getHospitalCorrectLastMenstruation()));
  141 + //纠正末次月经孕周
  142 + map.put("correctionLastMensesWeek", HospitalUtil.getPregnantWeek(f.getHospitalCorrectLastMenstruation()));
  143 +
  144 + map.put("dueDate", DateUtil.getyyyy_MM_dd(f.getHospitalExpectedDate()));
  145 + map.put("vcCardNo", f.getHospitalPatientCard());
  146 + //条码(暂时去掉)
  147 + //档案编号
  148 + map.put("fileCode", f.getHospitalRecordNumber());
  149 + //建档医生
  150 + map.put("bookbuildingDoctor", "暂时写死的医生名称");//TODO 查询医生姓名
  151 + //建档日期
  152 + map.put("bookbuildingDate", DateUtil.getyyyy_MM_dd(f.getHospitalRecordDate()));
  153 +
  154 + map.put("mremark", f.getHospitalRecordRemark());
  155 + //服务类型
  156 + map.put("serviceType",f.getHospitalServiceType() );
  157 + map.put("serviceStatus", f.getHospitalServiceStatus());
  158 +
  159 + //建档孕周
  160 + map.put("buildDueWeek",HospitalUtil.getPregnantWeek(f.getHospitalRecordDate()));
  161 +
  162 + return AjaxResult.returnSuccess(map);
  163 + }
  164 +
  165 + /**
50 166 * <li>@Description:依据id得到“孕妇建档”表单详情
51 167 * <li>@param id
52 168 * <li>@return
53 169  
... ... @@ -55,9 +171,9 @@
55 171 * <li>修改人:
56 172 * <li>修改时间:
57 173 */
58   - @RequestMapping(value = "/queryPregnantBuildById", method = RequestMethod.GET)
  174 + @RequestMapping(value = "/queryPregnantBuildById/{id}", method = RequestMethod.GET)
59 175 @ResponseBody
60   - public AjaxResult queryPregnantBuildById(String id){
  176 + public AjaxResult queryPregnantBuildById(@PathVariable String id){
61 177 //查询详情相关对象
62 178 Map<String, Object> map = fetationService.selectWomanFetationMapById(id);
63 179 WomanFetationRecord fetationRecord = (WomanFetationRecord)map.get("fetationRecord");
... ... @@ -69,8 +185,7 @@
69 185 XjhMapUtil.getKeyMap(WomanFetationRecordKeymap.original, WomanFetationRecordKeymap.alias));
70 186 fetationRecordMap.putAll(womanHusbandMap);
71 187  
72   - System.out.println(fetationRecordMap);
73   - WomanFetationResponse response = (WomanFetationResponse)XjhMapUtil.transMap2Bean(fetationRecordMap, new WomanFetationResponse());
  188 + WomanFetationResponse response = (WomanFetationResponse)XjhMapUtil.transMap2Bean(fetationRecordMap, new WomanFetationResponse());
74 189 response.setId(fetationRecord.getId());
75 190 response.setPid(fetationRecord.getWomanPersonId());
76 191 return AjaxResult.returnSuccess(response);
77 192  
... ... @@ -94,10 +209,12 @@
94 209  
95 210 //TODO 查询历史建档记录
96 211 List<Map<String, Object>> history = fetationService.selectHistory(cardType, cardNo, vcCardNo);
97   -
98 212 Map<String,Object> dataMap = new HashMap<>();
99 213 dataMap.put("history", history);
100 214 dataMap.put("now", DateUtil.getyyyy_MM_dd(new Date()));
  215 + //TODO 部分未涉及字段
  216 + dataMap.put("initBuildDate", DateUtil.getyyyy_MM_dd(new Date()));
  217 + dataMap.put("rBType", true);
101 218 return AjaxResult.returnSuccess(dataMap);
102 219 }
103 220  
104 221  
105 222  
106 223  
107 224  
... ... @@ -112,31 +229,85 @@
112 229 @RequestMapping(value = "/addOrUpdateYunBuild", method = RequestMethod.POST)
113 230 @ResponseBody
114 231 public AjaxResult addOrUpdateYunBuild(@RequestBody WomanFetationRequest request) {
  232 + /*
  233 + * 需求:
  234 + * (1)同一孕妇在不同医院(orgId)对应两份档案,第一份为主档案,往后都是隐藏档案(sourceId=主档案ID) womanPersonId
  235 + * (2)TODO 同一医院同一孕妇,多个产程对应多个档案
  236 + */
115 237  
  238 + //TODO 登录 token 验证
  239 +
116 240 /*
117 241 * 转换业务对象
118 242 */
119 243 WomanFetationRequestWrapper wrapper = new WomanFetationRequestWrapper(request);
120 244 WomanFetationRecord womanFetationRecord = wrapper.getWomanFetationRecord();
121 245 WomanHusband womanHusband = wrapper.getWomanHusband();
122   - /*
123   - * 需求:
124   - * (1)同一孕妇在不同医院(orgId)对应两份档案
125   - * (2)TODO 同一医院同一孕妇,多个产程对应多个档案
126   - */
127   - //查询档案信息的存在性
128   - WomanFetationRecord dbObj = fetationService.findByCard(
129   - request.getPregnantCertificateTypeId(), request.getPregnantCertificateNum(),
130   - request.getVcCardNo(), request.getHospitalId());
  246 + if(womanFetationRecord.getHostpitalId()==null){
  247 + AjaxResult.returnFail("入参错误:缺少参数hostpitalId");
  248 + }
  249 +
  250 + //新增或修改
131 251 boolean flag = false;
132 252 if(request.getId()==null){//新增
133   - if(dbObj!=null){//本院已有档案,修改现有档案
134   - womanFetationRecord.setId(dbObj.getId());
135   - womanHusband.setTargetId(dbObj.getId());
136   - flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband);
137   - }else{
138   - flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband);
  253 +
  254 + //用于重复性验证的查询对象(确保新建的档案在同医院同产程未重复)
  255 + WomanFetationRecord query = new WomanFetationRecord();
  256 + query.setIfdel(IfdelEnum.NO.getStatus());//未被删除的
  257 + query.setEnalble(StatusEnum.ENABLED.getStatus());//启用的
  258 + query.setWomanType(1);//妇女类别:1孕妇,3产妇
  259 + query.setDueStatus(0);//分娩状态 0未终止妊娠 1终止妊娠
  260 + query.setHostpitalId(womanFetationRecord.getHostpitalId());//医院ID
  261 + query.setBuildType(0);//建档来源:0未分娩建档,1儿童建档时建档,2自动分娩类型,3转诊自动建档 ???
  262 + //验证证件号是否重复
  263 + if(womanFetationRecord.getBasePapersNumber()!=null){
  264 + query.setBasePapersNumber(womanFetationRecord.getBasePapersNumber());
  265 + WomanFetationRecord dbObj = fetationService.queryOne(query);
  266 + if(dbObj!=null){
  267 + AjaxResult.returnFail("该证件在医院已经建档");
  268 + }
139 269 }
  270 + //验证联系方式是否重复
  271 + if(womanFetationRecord.getContactWomanWay()!=null){
  272 + query.setBasePapersNumber(null);
  273 + query.setContactWomanWay(womanFetationRecord.getContactWomanWay());
  274 + WomanFetationRecord dbObj = fetationService.queryOne(query);
  275 + if(dbObj!=null){
  276 + AjaxResult.returnFail("该联系方式在医院已经建档");
  277 + }
  278 + }
  279 + //验证就诊卡号是否重复
  280 + if(womanFetationRecord.getHospitalPatientCard()!=null){
  281 + query.setBasePapersNumber(null);
  282 + query.setContactWomanWay(null);
  283 + query.setHospitalPatientCard(womanFetationRecord.getHospitalPatientCard());
  284 + WomanFetationRecord dbObj = fetationService.queryOne(query);
  285 + if(dbObj!=null){
  286 + AjaxResult.returnFail("该就诊卡号在医院已经建档");
  287 + }
  288 + }
  289 + //查询档案信息在外院的存在性(如存在,则建立sourceId一致的隐藏档案)
  290 + query.setHostpitalId(null);
  291 + query.setHospitalPatientCard(null);
  292 + String sourceId = "";
  293 + if(womanFetationRecord.getBasePapersNumber()!=null){
  294 + query.setBasePapersNumber(womanFetationRecord.getBasePapersNumber());
  295 + WomanFetationRecord dbObj = fetationService.queryOne(query);
  296 + if(dbObj!=null){
  297 + sourceId = dbObj.getId();
  298 + }
  299 + }
  300 + if(womanFetationRecord.getContactWomanWay()!=null){
  301 + query.setBasePapersNumber(null);
  302 + query.setContactWomanWay(womanFetationRecord.getContactWomanWay());
  303 + WomanFetationRecord dbObj = fetationService.queryOne(query);
  304 + if(dbObj!=null){
  305 + sourceId = dbObj.getId();
  306 + }
  307 + }
  308 + womanFetationRecord.setSourceId(sourceId);
  309 +
  310 + flag = fetationService.insertbuildRecord(womanFetationRecord, womanHusband);
140 311 }else{//修改
141 312 flag = fetationService.updatebuildRecord(womanFetationRecord, womanHusband);
142 313 }
parent/hospital.web/src/main/java/com/lyms/hospital/response/woman/WomanFetationResponse.java View file @ 3d1cb89
... ... @@ -135,9 +135,28 @@
135 135  
136 136 //分娩状态 0未终止妊娠 1终止妊娠
137 137 private Integer dueStatus;
  138 + //1孕妇 3产妇
  139 + private Integer type; // add by xujiahong since 2017-04-24 13:17:21
  140 +
  141 + private String fmTime;
  142 +
  143 + public String getFmTime() {
  144 + return fmTime;
  145 + }
138 146  
  147 + public void setFmTime(String fmTime) {
  148 + this.fmTime = fmTime;
  149 + }
139 150  
140   - public Integer getDueStatus() {
  151 + public Integer getType() {
  152 + return type;
  153 + }
  154 +
  155 + public void setType(Integer type) {
  156 + this.type = type;
  157 + }
  158 +
  159 + public Integer getDueStatus() {
141 160 return dueStatus;
142 161 }
143 162  
parent/hospital.web/src/main/java/com/lyms/hospital/util/HospitalUtil.java View file @ 3d1cb89
  1 +package com.lyms.hospital.util;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import com.lyms.util.DateUtil;
  6 +
  7 +/**
  8 + * 计算孕周<br>
  9 + * a<br>
  10 + *
  11 + * @author xujiahong
  12 + *
  13 + */
  14 +public class HospitalUtil {
  15 +
  16 + /**
  17 + * <li>@Description:
  18 + * <li>@param date 末次月经日期
  19 + * <li>@return
  20 + * <li>创建人:xujiahong
  21 + * <li>创建时间:2017年4月24日
  22 + * <li>修改人:
  23 + * <li>修改时间:
  24 + */
  25 + public static String getPregnantWeek(Date date) {
  26 + Date now = new Date();
  27 + int days = DateUtil.daysBetween(date, now);//返回两个日期的间隔天数
  28 + if (days < 0) {
  29 + return "";
  30 + }
  31 + if (days >= 294) {
  32 + return "已分娩";
  33 + }
  34 + int week = (days / 7);
  35 + int day = (days % 7);
  36 + return "孕" + week + "周" + day + "天";
  37 + }
  38 +
  39 +}
parent/hospital.web/src/main/java/com/lyms/hospital/util/UnitConstants.java View file @ 3d1cb89
  1 +package com.lyms.hospital.util;
  2 +
  3 +/**
  4 + *
  5 + * 单位常量,用以返回值拼接
  6 + *
  7 + * Created by Administrator on 2017/1/11 0011.
  8 + */
  9 +public class UnitConstants {
  10 +
  11 + public static final String CM = " cm";
  12 + public static final String KG = " kg";
  13 + public static final String MMHG = " mmHg";
  14 + public static final String CIFEN = " 次/分";
  15 + public static final String GL = " g/L";
  16 + public static final String MMOLL = " mmol/L";
  17 + public static final String CI = " 次";
  18 + public static final String UL = " U/L";
  19 + public static final String TEN_LKG = "&times;10<sup>9</sup>/L";
  20 +// public static final String TEN_LKG = " 10^9/L";
  21 + public static final String UMOLL = " umol/L";
  22 + public static final String ZHEN = " 针";
  23 + public static final String ML = " ml";
  24 + public static final String G = " g";
  25 + public static final String FEN = " 分";
  26 + public static final String FZ = " 分钟";
  27 + public static final String GE = " 个";
  28 + public static final String SUI = " 岁";
  29 + public static final String REN = " 人";
  30 + public static final String HD = " 时/日";
  31 + public static final String WENDU = " ℃";
  32 + public static final String WSSD = " IU/日";
  33 + public static final String DAY = " 天";
  34 +
  35 +
  36 +}
parent/hospital.web/src/main/java/com/lyms/hospital/util/trans/XjhMapUtil.java View file @ 3d1cb89
... ... @@ -27,10 +27,17 @@
27 27 * @throws IllegalAccessException
28 28 */
29 29 private static void invokeIgnoreType(PropertyDescriptor property,Object value,Object obj) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{
30   - Class<?> keyType = property.getPropertyType();
31   - Class<?> valueType = value.getClass();
  30 + if(obj==null || property==null){
  31 + return;
  32 + }
32 33 // 得到property对应的setter方法
33 34 Method setter = property.getWriteMethod();
  35 + if(value==null){//null值可匹配任何类型的对象
  36 + setter.invoke(obj, value);
  37 + return;
  38 + }
  39 + Class<?> keyType = property.getPropertyType();
  40 + Class<?> valueType = value.getClass();
34 41 //简单处理映射字段类型不匹配的情况
35 42 if (keyType.equals(valueType)) {
36 43 setter.invoke(obj, value);
... ... @@ -49,6 +56,9 @@
49 56 }
50 57  
51 58 public static Object transMap2Bean(Map<String, Object> map, Object obj) {
  59 + if(map==null || obj==null){
  60 + return null;
  61 + }
52 62 try {
53 63 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
54 64 PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
55 65  
... ... @@ -62,12 +72,16 @@
62 72 } catch (Exception e) {
63 73 System.err.println("映射"+obj.getClass().getName()+"对象时发生错误");
64 74 System.err.println("transMap2Bean Error " + e);
  75 + e.printStackTrace();
65 76 }
66 77 return obj;
67 78 }
68 79  
69 80 // 自动处理时间字段和对应的字符串字段(Str结尾)
70 81 public static Object transMap2FormatBean(Map<String, Object> map, Object obj) {
  82 + if(map==null || obj==null){
  83 + return null;
  84 + }
71 85 try {
72 86 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
73 87 PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
74 88  
... ... @@ -103,11 +117,15 @@
103 117 } catch (Exception e) {
104 118 System.err.println("映射"+obj.getClass().getName()+"对象时发生错误");
105 119 System.err.println("transMap2FormatBean Error " + e);
  120 + e.printStackTrace();
106 121 }
107 122 return obj;
108 123 }
109 124  
110 125 public static Map<String, Object> transBean2Map(Object obj) {
  126 + if(obj==null){
  127 + return null;
  128 + }
111 129 Map<String, Object> map = new HashMap<>();
112 130 try {
113 131 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
... ... @@ -125,6 +143,7 @@
125 143 } catch (Exception e) {
126 144 System.err.println("映射"+obj.getClass().getName()+"对象时发生错误");
127 145 System.err.println("transBean2Map Error " + e);
  146 + e.printStackTrace();
128 147 }
129 148 return map;
130 149 }
... ... @@ -154,6 +173,9 @@
154 173 }
155 174  
156 175 public static Map<String, Object> transBean2AliasMap(Object obj, HashMap<String, String> keyMap) {
  176 + if(keyMap==null || obj==null){
  177 + return null;
  178 + }
157 179 Map<String, Object> map = new HashMap<>();
158 180 try {
159 181 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
160 182  
... ... @@ -173,11 +195,15 @@
173 195 } catch (Exception e) {
174 196 System.err.println("映射"+obj.getClass().getName()+"对象时发生错误");
175 197 System.err.println("transBean2AliasMap Error " + e);
  198 + e.printStackTrace();
176 199 }
177 200 return map;
178 201 }
179 202  
180 203 public static Map<String, Object> transBean2FormatAliasMap(Object obj, HashMap<String, String> keyMap) {
  204 + if(keyMap==null || obj==null){
  205 + return null;
  206 + }
181 207 Map<String, Object> map = new HashMap<>();
182 208 try {
183 209 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
184 210  
185 211  
186 212  
... ... @@ -208,24 +234,25 @@
208 234 } catch (Exception e) {
209 235 System.err.println("映射"+obj.getClass().getName()+"对象时发生错误");
210 236 System.err.println("transBean2FormatAliasMap Error " + e);
  237 + e.printStackTrace();
211 238 }
212 239 return map;
213 240 }
214 241  
215   - public static void mappingAlias(Object original, Object alias, HashMap<String, String> keyMap) {
216   - Map<String, Object> aliasMap = transBean2AliasMap(original, keyMap);
217   - transMap2Bean(aliasMap, alias);
218   - }
  242 +// public static void mappingAlias(Object original, Object alias, HashMap<String, String> keyMap) {
  243 +// Map<String, Object> aliasMap = transBean2AliasMap(original, keyMap);
  244 +// transMap2Bean(aliasMap, alias);
  245 +// }
  246 +//
  247 +// public static void mappingFormatAlias(Object original, Object alias, HashMap<String, String> keyMap) {
  248 +// Map<String, Object> aliasMap = transBean2FormatAliasMap(original, keyMap);
  249 +// transMap2FormatBean(aliasMap, alias);
  250 +// }
219 251  
220   - public static void mappingFormatAlias(Object original, Object alias, HashMap<String, String> keyMap) {
221   - Map<String, Object> aliasMap = transBean2FormatAliasMap(original, keyMap);
222   - transMap2FormatBean(aliasMap, alias);
223   - }
224   -
225 252 /*
226 253 * 方便书写映射文件keyMap
227 254 */
228   - public static void printField(Object obj) {
  255 + private static void printField(Object obj) {
229 256 try {
230 257 BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
231 258 PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
232 259  
... ... @@ -237,14 +264,14 @@
237 264 }
238 265 }
239 266 } catch (Exception e) {
240   - System.err.println("printField Error " + e);
  267 + e.printStackTrace();
241 268 }
242 269 }
243 270  
244 271 /*
245 272 * 方便书写 json
246 273 */
247   - public static void printJsonByArray(String[] args) {
  274 + private static void printJsonByArray(String[] args) {
248 275 System.out.println("{");
249 276 for (int i = 0; i < args.length; i++) {
250 277 String str = "\"" + args[i] + "\":\"666\"";
... ... @@ -257,7 +284,7 @@
257 284 }
258 285  
259 286 public static void main(String[] args) {
260   - // printField(new WomanHusband());
  287 +// printField(new WomanHusband());
261 288 printJsonByArray(WomanFetationRecordKeymap.alias);
262 289 }
263 290