From 4f4382009d87e2b0cca038187715853b232a6aaf Mon Sep 17 00:00:00 2001 From: xujiahong Date: Wed, 5 Apr 2017 11:04:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=A8=A9=E7=9B=B8=E5=85=B3=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8C=85=E6=8B=AC=EF=BC=9A?= =?UTF-8?q?=E5=88=86=E5=A8=A9=E3=80=81=E8=83=8E=E5=84=BF=E3=80=81=E8=83=8E?= =?UTF-8?q?=E7=9B=98=E3=80=81=E6=96=B0=E7=94=9F=E5=84=BF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/childbirth/ChildbirthInfoMapper.xml | 3 +- .../dao/childbirth/ChildbirthNewbornMapper.xml | 3 +- .../dao/childbirth/ChildbirthTaiMapper.xml | 3 +- .../dao/childbirth/ChildbirthTaipanMapper.xml | 3 +- .../hospital/dao/recheck/PostpartumReeMapper.java | 9 +- .../hospital/entity/childbirth/ChildbirthInfo.java | 13 ++ .../entity/childbirth/ChildbirthInfoVo.java | 72 +++++++ .../entity/childbirth/ChildbirthNewborn.java | 15 ++ .../hospital/entity/childbirth/ChildbirthTai.java | 13 ++ .../entity/childbirth/ChildbirthTaipan.java | 13 ++ .../service/childbirth/ChildbirthInfoService.java | 64 +++++- .../childbirth/ChildbirthNewbornService.java | 52 ++++- .../service/childbirth/ChildbirthTaiService.java | 27 ++- .../childbirth/ChildbirthTaipanService.java | 30 ++- .../childbirth/impl/ChildbirthInfoServiceImpl.java | 230 ++++++++++++++++++++- .../impl/ChildbirthNewbornServiceImpl.java | 59 +++++- .../childbirth/impl/ChildbirthTaiServiceImpl.java | 43 +++- .../impl/ChildbirthTaipanServiceImpl.java | 43 +++- .../hospital/service/ChildbirthServiceTest.java | 45 ++++ 19 files changed, 707 insertions(+), 33 deletions(-) create mode 100644 parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfoVo.java create mode 100644 parent/hospital.web/src/test/java/test/hospital/service/ChildbirthServiceTest.java diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthInfoMapper.xml b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthInfoMapper.xml index 4362861..69e2186 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthInfoMapper.xml +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthInfoMapper.xml @@ -48,10 +48,11 @@ + - ID AS id, WOMAN_ID AS womanId, CHILDBIRTH_TIME AS childbirthTime, CHILDBIRTH_TIME_TEXT AS childbirthTimeText, FETUS_NUM AS fetusNum, PLACENTA_NUM AS placentaNum, CHILDBIRTH_TYPE AS childbirthType, OPERATION_REASON AS operationReason, PROCESS_FIRST AS processFirst, PROCESS_SECOND AS processSecond, PROCESS_THIRD AS processThird, PROCESS_TOTAL AS processTotal, PERINEUM_SITUATION AS perineumSituation, PERINEUM_SPLIT AS perineumSplit, NEEDLE_NUM AS needleNum, WOMAN_SITUATION AS womanSituation, OTHER_DEATH_REASON_TEXT AS otherDeathReasonText, BLOOD_SHRINK AS bloodShrink, BLOOD_DIASTOLE AS bloodDiastole, BLOOD_SHRINK_LATER AS bloodShrinkLater, BLOOD_DIASTOLE_LATER AS bloodDiastoleLater, BREATH AS breath, PULSE AS pulse, LOSE_BLOOD_A AS loseBloodA, LOSE_BLOOD_B AS loseBloodB, LOSE_BLOOD_C AS loseBloodC, LOSE_BLOOD_D AS loseBloodD, LOSE_BLOOD_REASON AS loseBloodReason, LOSE_BLOOD_OTHER_TEXT AS loseBloodOtherText, COMPLICATION_QZTP AS complicationQztp, COMPLICATION_TPZB AS complicationTpzb, COMPLICATION_TPZL AS complicationTpzl, COMPLICATION_TMZP AS complicationTmzp, COMPLICATION_CHCX AS complicationChcx, COMPLICATION_RSQGXY AS complicationRsqgxy, COMPLICATION_ZXA AS complicationZxa, COMPLICATION_ZXB AS complicationZxb, COMPLICATION_ZXC AS complicationZxc, COMPLICATION_RSHBMXGXY AS complicationRshbmxgxy, COMPLICATION_OTHER AS complicationOther, COMPLICATION_OTHER_TEXT AS complicationOtherText, ORG_ID AS orgId, DOCTOR_ID AS doctorId, CREATE_TIME AS createTime + ID AS id, WOMAN_ID AS womanId, CHILDBIRTH_TIME AS childbirthTime, CHILDBIRTH_TIME_TEXT AS childbirthTimeText, FETUS_NUM AS fetusNum, PLACENTA_NUM AS placentaNum, CHILDBIRTH_TYPE AS childbirthType, OPERATION_REASON AS operationReason, PROCESS_FIRST AS processFirst, PROCESS_SECOND AS processSecond, PROCESS_THIRD AS processThird, PROCESS_TOTAL AS processTotal, PERINEUM_SITUATION AS perineumSituation, PERINEUM_SPLIT AS perineumSplit, NEEDLE_NUM AS needleNum, WOMAN_SITUATION AS womanSituation, OTHER_DEATH_REASON_TEXT AS otherDeathReasonText, BLOOD_SHRINK AS bloodShrink, BLOOD_DIASTOLE AS bloodDiastole, BLOOD_SHRINK_LATER AS bloodShrinkLater, BLOOD_DIASTOLE_LATER AS bloodDiastoleLater, BREATH AS breath, PULSE AS pulse, LOSE_BLOOD_A AS loseBloodA, LOSE_BLOOD_B AS loseBloodB, LOSE_BLOOD_C AS loseBloodC, LOSE_BLOOD_D AS loseBloodD, LOSE_BLOOD_REASON AS loseBloodReason, LOSE_BLOOD_OTHER_TEXT AS loseBloodOtherText, COMPLICATION_QZTP AS complicationQztp, COMPLICATION_TPZB AS complicationTpzb, COMPLICATION_TPZL AS complicationTpzl, COMPLICATION_TMZP AS complicationTmzp, COMPLICATION_CHCX AS complicationChcx, COMPLICATION_RSQGXY AS complicationRsqgxy, COMPLICATION_ZXA AS complicationZxa, COMPLICATION_ZXB AS complicationZxb, COMPLICATION_ZXC AS complicationZxc, COMPLICATION_RSHBMXGXY AS complicationRshbmxgxy, COMPLICATION_OTHER AS complicationOther, COMPLICATION_OTHER_TEXT AS complicationOtherText, ORG_ID AS orgId, DOCTOR_ID AS doctorId, CREATE_TIME AS createTime, IF_DEL AS ifDel diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthNewbornMapper.xml b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthNewbornMapper.xml index 595e6cf..c0431a0 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthNewbornMapper.xml +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthNewbornMapper.xml @@ -21,10 +21,11 @@ + - ID AS id, CID AS cid, BIRTH_TIME AS birthTime, GESTATION_ENDING AS gestationEnding, DEFORMITY AS deformity, GENDER AS gender, WEIGHT AS weight, HEIGHT AS height, DISEASE AS disease, APGAR_SCORE_ONE AS apgarScoreOne, APGAR_SCORE_FIVE AS apgarScoreFive, APGAR_SCORE_TEN AS apgarScoreTen, ASPHYXIA AS asphyxia, TOUCH_BEGIN AS touchBegin, TOUCH_STAY AS touchStay, SUCK AS suck, CREATE_TIME AS createTime + ID AS id, CID AS cid, BIRTH_TIME AS birthTime, GESTATION_ENDING AS gestationEnding, DEFORMITY AS deformity, GENDER AS gender, WEIGHT AS weight, HEIGHT AS height, DISEASE AS disease, APGAR_SCORE_ONE AS apgarScoreOne, APGAR_SCORE_FIVE AS apgarScoreFive, APGAR_SCORE_TEN AS apgarScoreTen, ASPHYXIA AS asphyxia, TOUCH_BEGIN AS touchBegin, TOUCH_STAY AS touchStay, SUCK AS suck, CREATE_TIME AS createTime, IF_DEL AS ifDel diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaiMapper.xml b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaiMapper.xml index f770ee8..8bb7c6f 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaiMapper.xml +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaiMapper.xml @@ -10,10 +10,11 @@ + - ID AS id, CID AS cid, POSITION AS position, HEART_RATE AS heartRate, FIRST_EXPOSE AS firstExpose, CREATE_TIME AS createTime + ID AS id, CID AS cid, POSITION AS position, HEART_RATE AS heartRate, FIRST_EXPOSE AS firstExpose, CREATE_TIME AS createTime, IF_DEL AS ifDel diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaipanMapper.xml b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaipanMapper.xml index 006e7b1..44cc3c7 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaipanMapper.xml +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/childbirth/ChildbirthTaipanMapper.xml @@ -15,10 +15,11 @@ + - ID AS id, CID AS cid, PLACENTA_BIRTH_TYPE AS placentaBirthType, BIRTH_TYPE AS birthType, PLACENTA_LENGTH AS placentaLength, PLACENTA_WIDTH AS placentaWidth, PLACENTA_THICK AS placentaThick, PLACENTA_WEIGHT AS placentaWeight, UMBILICAL_LENGTH AS umbilicalLength, UMBILICAL_EXCEPTION AS umbilicalException, CREATE_TIME AS createTime + ID AS id, CID AS cid, PLACENTA_BIRTH_TYPE AS placentaBirthType, BIRTH_TYPE AS birthType, PLACENTA_LENGTH AS placentaLength, PLACENTA_WIDTH AS placentaWidth, PLACENTA_THICK AS placentaThick, PLACENTA_WEIGHT AS placentaWeight, UMBILICAL_LENGTH AS umbilicalLength, UMBILICAL_EXCEPTION AS umbilicalException, CREATE_TIME AS createTime, IF_DEL AS ifDel diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/recheck/PostpartumReeMapper.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/recheck/PostpartumReeMapper.java index 2e8ef95..4b260e5 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/recheck/PostpartumReeMapper.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/dao/recheck/PostpartumReeMapper.java @@ -1,10 +1,11 @@ package com.lyms.hospital.dao.recheck; -import com.lyms.hospital.entity.recheck.PostpartumRee; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import org.springframework.stereotype.Repository; import java.io.Serializable; -import java.util.List; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.lyms.hospital.entity.recheck.PostpartumRee; /** *

* Mapper接口 diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfo.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfo.java index 6c2652e..acbd45d 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfo.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfo.java @@ -239,6 +239,11 @@ public class ChildbirthInfo implements Serializable { */ @TableField(value="CREATE_TIME") private Date createTime; + /** + * 软删除标识:1删除,0正常 + */ + @TableField(value="IF_DEL") + private Integer ifDel; public String getId() { @@ -593,4 +598,12 @@ public class ChildbirthInfo implements Serializable { this.createTime = createTime; } + public Integer getIfDel() { + return ifDel; + } + + public void setIfDel(Integer ifDel) { + this.ifDel = ifDel; + } + } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfoVo.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfoVo.java new file mode 100644 index 0000000..a1d1d76 --- /dev/null +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/entity/childbirth/ChildbirthInfoVo.java @@ -0,0 +1,72 @@ +package com.lyms.hospital.entity.childbirth; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 分娩业务对象 + * @author xujiahong + * + */ +public class ChildbirthInfoVo { + + private ChildbirthInfo info; + private List newbornList; + private List taipanList; + private List taiList; + + 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; + } + + public static ChildbirthInfoVo createTestInstance(int childNum){ + ChildbirthInfoVo vo = new ChildbirthInfoVo(); + //分娩信息 + ChildbirthInfo info = new ChildbirthInfo(); + info.setWomanId("test0405"); + info.setChildbirthTime(new Date()); + info.setFetusNum(childNum); + info.setPlacentaNum(childNum); + List taiList = new ArrayList<>(); + List taipanList = new ArrayList<>(); + List newbornList = new ArrayList<>(); + for(int i = 0;i - * 服务类 + * 【分娩信息 服务类】 + * 新增-分娩信息 + * 修改-分娩信息 + * 查询-根据孕妇ID查询分娩信息详情 + * + * 新增vo(事务包括:新增分娩、胎盘、胎儿、新生儿信息) + * 修改vo(事务包括:修改分娩、物理删除再新增胎盘、胎儿、新生儿信息) + * 查询vo(事务包括:查询分娩详情,查询胎儿、胎盘、新生儿列表) + * 逻辑删除(事务)-分娩信息(同时逻辑删除:胎儿、胎盘、新生儿信息) *

* * @author xujiahong @@ -20,5 +29,58 @@ public interface ChildbirthInfoService extends BaseService { *
  • @return 大于0修改成功,否则为失败 */ public Integer deleteLogicById(Serializable id); + + /* + * 单表的增、改、查操作 + */ + public String create(ChildbirthInfo obj); + public boolean update(ChildbirthInfo obj); + public ChildbirthInfo getDetailById(String id); + + /** + *
  • @Description:新增vo(事务包括:新增分娩、胎盘、胎儿、新生儿信息) + *
  • @param vo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public String createChildbirthVo(ChildbirthInfoVo vo); + + /** + *
  • @Description:修改vo(事务包括:修改分娩、物理删除再新增胎盘、胎儿、新生儿信息) + *
  • @param vo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public boolean updateChildbirthVo(ChildbirthInfoVo vo); + + /** + *
  • @Description:查询vo(事务包括:查询分娩详情,查询胎儿、胎盘、新生儿列表) + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public ChildbirthInfoVo selectChildbirthVo(String id); + + /** + *
  • @Description:逻辑删除(事务)-分娩信息(同时逻辑删除:胎儿、胎盘、新生儿信息) + *
  • @param vo + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月5日 + *
  • 修改人: + *
  • 修改时间: + */ + public boolean softDeleteChildbirthVo(String infoId); + + } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthNewbornService.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthNewbornService.java index c47b5a6..da4a507 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthNewbornService.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthNewbornService.java @@ -3,10 +3,16 @@ package com.lyms.hospital.service.childbirth; import com.lyms.hospital.entity.childbirth.ChildbirthNewborn; import com.lyms.web.service.BaseService; import java.io.Serializable; +import java.util.List; /** *

    - * 服务类 + * 【分娩-新生儿信息-服务类】 + * 新增-新生儿信息 + * 修改-新生儿信息 + * 查询-通过ID查询“新生儿信息”详情 + * 查询-通过CID查询“新生儿信息”详情列表 + * *

    * * @author xujiahong @@ -20,5 +26,49 @@ public interface ChildbirthNewbornService extends BaseService *
  • @return 大于0修改成功,否则为失败 */ public Integer deleteLogicById(Serializable id); + + /** + *
  • @Description:新增-新生儿信息 + *
  • @param c + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public String create(ChildbirthNewborn c); + + /** + *
  • @Description:修改-新生儿信息 + *
  • @param c + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public boolean update(ChildbirthNewborn c); + + /** + *
  • @Description:查询-通过ID查询“新生儿信息”详情 + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public ChildbirthNewborn getDetailById(String id); + + /** + *
  • @Description:查询-通过CID查询“新生儿信息”详情列表 + *
  • @param cid + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public List listByCid(String cid); } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaiService.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaiService.java index 1c8ddd6..51f4809 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaiService.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaiService.java @@ -3,10 +3,13 @@ package com.lyms.hospital.service.childbirth; import com.lyms.hospital.entity.childbirth.ChildbirthTai; import com.lyms.web.service.BaseService; import java.io.Serializable; +import java.util.List; /** *

    - * 服务类 + * 【分娩-胎儿信息-服务类】 + * 新增-胎儿信息 + * 查询-通过CID查询“胎儿信息”详情列表 *

    * * @author xujiahong @@ -20,5 +23,27 @@ public interface ChildbirthTaiService extends BaseService { *
  • @return 大于0修改成功,否则为失败 */ public Integer deleteLogicById(Serializable id); + + /** + *
  • @Description:新增-胎儿信息 + *
  • @param obj + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public String create(ChildbirthTai obj); + + /** + *
  • @Description:查询-通过CID查询“胎儿信息”详情列表 + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public List listByCid(String cid); } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaipanService.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaipanService.java index cd746ff..739fa37 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaipanService.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/ChildbirthTaipanService.java @@ -1,12 +1,16 @@ package com.lyms.hospital.service.childbirth; +import java.io.Serializable; +import java.util.List; + import com.lyms.hospital.entity.childbirth.ChildbirthTaipan; import com.lyms.web.service.BaseService; -import java.io.Serializable; /** *

    - * 服务类 + * 【分娩-胎盘信息-服务类】 + * 新增-胎盘信息 + * 查询-通过CID查询“胎盘信息”详情列表 *

    * * @author xujiahong @@ -20,5 +24,27 @@ public interface ChildbirthTaipanService extends BaseService { *
  • @return 大于0修改成功,否则为失败 */ public Integer deleteLogicById(Serializable id); + + /** + *
  • @Description:新增-胎盘信息 + *
  • @param obj + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public String create(ChildbirthTaipan obj); + + /** + *
  • @Description:查询-通过CID查询“胎盘信息”详情列表 + *
  • @param id + *
  • @return + *
  • 创建人:xujiahong + *
  • 创建时间:2017年4月1日 + *
  • 修改人: + *
  • 修改时间: + */ + public List listByCid(String cid); } 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 46b6df7..5ff53b0 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 @@ -1,11 +1,32 @@ package com.lyms.hospital.service.childbirth.impl; -import com.lyms.hospital.entity.childbirth.ChildbirthInfo; +import java.io.Serializable; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.lyms.exception.SystemException; import com.lyms.hospital.dao.childbirth.ChildbirthInfoMapper; +import com.lyms.hospital.dao.childbirth.ChildbirthNewbornMapper; +import com.lyms.hospital.dao.childbirth.ChildbirthTaiMapper; +import com.lyms.hospital.dao.childbirth.ChildbirthTaipanMapper; +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; +import com.lyms.hospital.enums.IfdelEnum; import com.lyms.hospital.service.childbirth.ChildbirthInfoService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; -import java.io.Serializable; +import com.lyms.hospital.service.childbirth.ChildbirthNewbornService; +import com.lyms.hospital.service.childbirth.ChildbirthTaiService; +import com.lyms.hospital.service.childbirth.ChildbirthTaipanService; +import com.lyms.util.StrUtils; /** *

    @@ -18,7 +39,206 @@ import java.io.Serializable; @Service public class ChildbirthInfoServiceImpl extends ServiceImpl implements ChildbirthInfoService { + @Autowired + private ChildbirthNewbornService newbornService; + @Autowired + private ChildbirthTaipanService taipanService; + @Autowired + private ChildbirthTaiService taiService; + @Autowired + private ChildbirthNewbornMapper newbornMapper; + @Autowired + private ChildbirthTaipanMapper taipanMapper; + @Autowired + private ChildbirthTaiMapper taiMapper; + public Integer deleteLogicById(Serializable id){ - return baseMapper.deleteLogicById(id); + ChildbirthInfo obj = baseMapper.selectById(id); + obj.setIfDel(IfdelEnum.YES.getStatus()); + return baseMapper.updateById(obj); + } + + @Override + @Transactional + public String createChildbirthVo(ChildbirthInfoVo vo) { + if(vo==null){ + throw new SystemException("分娩业务对象VO为空"); + } + ChildbirthInfo info = vo.getInfo(); + List taiList = vo.getTaiList(); + List taipanList = vo.getTaipanList(); + List newbornList = vo.getNewbornList(); + //新增分娩基本信息 + String cid = this.create(info); + //【新增分娩信息的3个子列表】新增胎儿信息、新增胎盘信息、新增新生儿信息 + this.createChildbirth3Sublist(taiList, taipanList, newbornList, cid); + return cid; + } + + @Override + @Transactional + public boolean updateChildbirthVo(ChildbirthInfoVo vo) { + if(vo==null){ + throw new SystemException("分娩业务对象VO为空"); + } + ChildbirthInfo info = vo.getInfo(); + List taiList = vo.getTaiList(); + List taipanList = vo.getTaipanList(); + List newbornList = vo.getNewbornList(); + + if (info == null || StringUtils.isEmpty(info.getId())) { + throw new SystemException("分娩信息为空"); + } + //修改分娩信息 + this.update(info); + /* + * 删除再新增,胎儿信息列表 + * 删除再新增,胎盘信息列表 + * 删除再新增,新生儿信息列表 + */ + //删除 + EntityWrapper taiWrapper = new EntityWrapper<>(); + taiWrapper.eq("CID", info.getId()); + taiMapper.delete(taiWrapper); + + EntityWrapper taipanWrapper = new EntityWrapper<>(); + taipanWrapper.eq("CID", info.getId()); + taipanMapper.delete(taipanWrapper); + + EntityWrapper newbornWrapper = new EntityWrapper<>(); + newbornWrapper.eq("CID", info.getId()); + newbornMapper.delete(newbornWrapper); + + //【新增分娩信息的3个子列表】新增胎儿信息、新增胎盘信息、新增新生儿信息 + this.createChildbirth3Sublist(taiList, taipanList, newbornList, info.getId()); + return true; + } + + @Override + @Transactional + public ChildbirthInfoVo selectChildbirthVo(String id) { + // TODO Auto-generated method stub + ChildbirthInfoVo vo = new ChildbirthInfoVo(); + //查询分娩详情 + vo.setInfo(this.getDetailById(id)); + //查询胎儿列表 + vo.setTaiList(taiService.listByCid(id)); + //查询胎盘列表 + vo.setTaipanList(taipanService.listByCid(id)); + //查询新生儿列表 + vo.setNewbornList(newbornService.listByCid(id)); + return vo; + } + + @Override + @Transactional + public boolean softDeleteChildbirthVo(String infoId) { + if(StringUtils.isEmpty(infoId)){ + throw new SystemException("参数“分娩信息ID”为空"); + } + ChildbirthInfoVo vo = selectChildbirthVo(infoId); + ChildbirthInfo info = vo.getInfo(); + List taiList = vo.getTaiList(); + List taipanList = vo.getTaipanList(); + List newbornList = vo.getNewbornList(); + //逻辑删除:分娩信息 + if(info==null||info.getId()==null){ + throw new SystemException("分娩业务对象VO为空"); + } + this.deleteLogicById(info.getId()); + //逻辑删除:胎儿信息 + if(!CollectionUtils.isEmpty(taiList)){ + for(ChildbirthTai tai : taiList){ + taiService.deleteLogicById(tai.getId()); + } + } + //逻辑删除:胎盘信息 + if(!CollectionUtils.isEmpty(taipanList)){ + for(ChildbirthTaipan taipan : taipanList){ + taipanService.deleteLogicById(taipan.getId()); + } + } + //逻辑删除:新生儿信息 + if(!CollectionUtils.isEmpty(newbornList)){ + for(ChildbirthNewborn newborn : newbornList){ + newbornService.deleteLogicById(newborn.getId()); + } + } + return true; + } + + @Override + public String create(ChildbirthInfo obj) { + if (obj == null) { + throw new SystemException("分娩信息为空"); + } + String id = StrUtils.uuid(); + obj.setId(id); + obj.setIfDel(IfdelEnum.NO.getStatus()); + obj.setCreateTime(new java.util.Date()); + if (insert(obj)) { + return id; + } + return null; + } + + @Override + public boolean update(ChildbirthInfo obj) { + if (obj == null || StringUtils.isEmpty(obj.getId())) { + throw new SystemException("分娩信息为空"); + } + return updateById(obj); + } + + @Override + public ChildbirthInfo getDetailById(String id) { + ChildbirthInfo info = selectById(id); + ChildbirthInfo empty = new ChildbirthInfo(); + if(info==null){ + return empty; + } + return IfdelEnum.isDelete(info.getIfDel())?empty:info;//只能查询出“非逻辑删除”的记录 + } + + /* + * 【新增分娩信息的3个子列表】新增胎儿信息、新增胎盘信息、新增新生儿信息 + */ + @Transactional + private boolean createChildbirth3Sublist( + List taiList, + List taipanList, + List newbornList, + String cid){ + //新增胎儿信息 + if(!CollectionUtils.isEmpty(taipanList)){ + for(ChildbirthTaipan taipan : taipanList){ + taipan.setCid(cid); + String uuid = taipanService.create(taipan); + if(StringUtils.isEmpty(uuid)){ + throw new SystemException("新增胎儿信息失败");//抛出非检查型异常,让事务回滚 + } + } + } + //新增胎盘信息 + if(!CollectionUtils.isEmpty(taiList)){ + for(ChildbirthTai tai : taiList){ + tai.setCid(cid); + String uuid = taiService.create(tai); + if(StringUtils.isEmpty(uuid)){ + throw new SystemException("新增胎盘信息失败");//抛出非检查型异常,让事务回滚 + } + } + } + //新增新生儿信息 + if(!CollectionUtils.isEmpty(newbornList)){ + for(ChildbirthNewborn newborn : newbornList){ + newborn.setCid(cid); + String uuid = newbornService.create(newborn); + if(StringUtils.isEmpty(uuid)){ + throw new SystemException("新增新生儿信息失败");//抛出非检查型异常,让事务回滚 + } + } + } + return true; } } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthNewbornServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthNewbornServiceImpl.java index e791dfc..ab0b9e1 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthNewbornServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthNewbornServiceImpl.java @@ -1,11 +1,20 @@ package com.lyms.hospital.service.childbirth.impl; -import com.lyms.hospital.entity.childbirth.ChildbirthNewborn; +import java.io.Serializable; +import java.util.List; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.lyms.exception.SystemException; import com.lyms.hospital.dao.childbirth.ChildbirthNewbornMapper; +import com.lyms.hospital.entity.childbirth.ChildbirthNewborn; +import com.lyms.hospital.enums.IfdelEnum; import com.lyms.hospital.service.childbirth.ChildbirthNewbornService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; -import java.io.Serializable; +import com.lyms.util.StrUtils; /** *

    @@ -18,7 +27,47 @@ import java.io.Serializable; @Service public class ChildbirthNewbornServiceImpl extends ServiceImpl implements ChildbirthNewbornService { + @Override + @Transactional public Integer deleteLogicById(Serializable id){ - return baseMapper.deleteLogicById(id); + ChildbirthNewborn obj = baseMapper.selectById(id); + obj.setIfDel(IfdelEnum.YES.getStatus()); + return baseMapper.updateById(obj); + } + + @Override + public String create(ChildbirthNewborn obj) { + if (obj == null) { + throw new SystemException("新生儿信息为空"); + } + String id = StrUtils.uuid(); + obj.setId(id); + obj.setIfDel(IfdelEnum.NO.getStatus()); + obj.setCreateTime(new java.util.Date()); + if (insert(obj)) { + return id; + } + return null; + } + + @Override + public boolean update(ChildbirthNewborn obj) { + if (obj == null || StringUtils.isEmpty(obj.getId())) { + throw new SystemException("新生儿信息为空"); + } + return updateById(obj); + } + + @Override + public ChildbirthNewborn getDetailById(String id) { + return selectById(id); + } + + @Override + public List listByCid(String cid) { + EntityWrapper wrapper = new EntityWrapper(); + wrapper.eq("CID", cid); + wrapper.eq("IF_DEL", IfdelEnum.NO.getStatus());//只查询没有被软删除的项目 + return baseMapper.selectList(wrapper); } } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaiServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaiServiceImpl.java index 394a626..d5ab516 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaiServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaiServiceImpl.java @@ -1,11 +1,18 @@ package com.lyms.hospital.service.childbirth.impl; -import com.lyms.hospital.entity.childbirth.ChildbirthTai; +import java.io.Serializable; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.lyms.exception.SystemException; import com.lyms.hospital.dao.childbirth.ChildbirthTaiMapper; +import com.lyms.hospital.entity.childbirth.ChildbirthTai; +import com.lyms.hospital.enums.IfdelEnum; import com.lyms.hospital.service.childbirth.ChildbirthTaiService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; -import java.io.Serializable; +import com.lyms.util.StrUtils; /** *

    @@ -19,6 +26,32 @@ import java.io.Serializable; public class ChildbirthTaiServiceImpl extends ServiceImpl implements ChildbirthTaiService { public Integer deleteLogicById(Serializable id){ - return baseMapper.deleteLogicById(id); + ChildbirthTai obj = baseMapper.selectById(id); + obj.setIfDel(IfdelEnum.YES.getStatus()); + return baseMapper.updateById(obj); + } + + @Override + public String create(ChildbirthTai obj) { + if (obj == null) { + throw new SystemException("胎儿信息为空"); + } + String id = StrUtils.uuid(); + obj.setId(id); + obj.setIfDel(IfdelEnum.NO.getStatus()); + obj.setCreateTime(new java.util.Date()); + if (insert(obj)) { + return id; + } + return null; } + + @Override + public List listByCid(String cid) { + EntityWrapper wrapper = new EntityWrapper<>(); + wrapper.eq("CID", cid); + wrapper.eq("IF_DEL", IfdelEnum.NO.getStatus());//只查询没有被软删除的项目 + return baseMapper.selectList(wrapper); + } + } diff --git a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaipanServiceImpl.java b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaipanServiceImpl.java index edf18d3..45b62d1 100644 --- a/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaipanServiceImpl.java +++ b/parent/hospital.mac/src/main/java/com/lyms/hospital/service/childbirth/impl/ChildbirthTaipanServiceImpl.java @@ -1,11 +1,18 @@ package com.lyms.hospital.service.childbirth.impl; -import com.lyms.hospital.entity.childbirth.ChildbirthTaipan; +import java.io.Serializable; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.lyms.exception.SystemException; import com.lyms.hospital.dao.childbirth.ChildbirthTaipanMapper; +import com.lyms.hospital.entity.childbirth.ChildbirthTaipan; +import com.lyms.hospital.enums.IfdelEnum; import com.lyms.hospital.service.childbirth.ChildbirthTaipanService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; -import java.io.Serializable; +import com.lyms.util.StrUtils; /** *

    @@ -19,6 +26,32 @@ import java.io.Serializable; public class ChildbirthTaipanServiceImpl extends ServiceImpl implements ChildbirthTaipanService { public Integer deleteLogicById(Serializable id){ - return baseMapper.deleteLogicById(id); + ChildbirthTaipan obj = baseMapper.selectById(id); + obj.setIfDel(IfdelEnum.YES.getStatus()); + return baseMapper.updateById(obj); + } + + @Override + public String create(ChildbirthTaipan obj) { + if (obj == null) { + throw new SystemException("胎盘信息为空"); + } + String id = StrUtils.uuid(); + obj.setId(id); + obj.setIfDel(IfdelEnum.NO.getStatus()); + obj.setCreateTime(new java.util.Date()); + if (insert(obj)) { + return id; + } + return null; } + + @Override + public List listByCid(String cid) { + EntityWrapper wrapper = new EntityWrapper<>(); + wrapper.eq("CID", cid); + wrapper.eq("IF_DEL", IfdelEnum.NO.getStatus());//只查询没有被软删除的项目 + return baseMapper.selectList(wrapper); + } + } diff --git a/parent/hospital.web/src/test/java/test/hospital/service/ChildbirthServiceTest.java b/parent/hospital.web/src/test/java/test/hospital/service/ChildbirthServiceTest.java new file mode 100644 index 0000000..bad9b19 --- /dev/null +++ b/parent/hospital.web/src/test/java/test/hospital/service/ChildbirthServiceTest.java @@ -0,0 +1,45 @@ +package test.hospital.service; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.lyms.hospital.entity.childbirth.ChildbirthInfoVo; +import com.lyms.hospital.service.childbirth.ChildbirthInfoService; + +import test.hospital.BaseServiceTest; + +public class ChildbirthServiceTest extends BaseServiceTest{ + + @Autowired + private ChildbirthInfoService infoService; + +// @Test +// public void createChildbirthVo(){ +// ChildbirthInfoVo vo = ChildbirthInfoVo.createTestInstance(2); +// infoService.createChildbirthVo(vo); +// } + +// @Test +// public void updateChildbirthVo(){ +// ChildbirthInfoVo vo = ChildbirthInfoVo.createTestInstance(3); +// vo.getInfo().setId("8E180ED80A4E40E287F24CCE9EDF3703"); +// infoService.updateChildbirthVo(vo); +// } + +// @Test +// public void testSoftDelete(){ +// String infoId = "8E180ED80A4E40E287F24CCE9EDF3703"; +// infoService.softDeleteChildbirthVo(infoId); +// } + + @Test + public void selectChildbirthVo(){ + String id = "8E180ED80A4E40E287F24CCE9EDF3703"; + ChildbirthInfoVo vo = infoService.selectChildbirthVo(id); + outJson(vo); + //{"info":{},"newbornList":[],"taiList":[],"taipanList":[]} + } + + + +} -- 1.8.3.1