From ff6e84a8f969e2196041c500af051e3e33c46009 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期六, 22 二月 2025 18:16:32 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java |    3 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java            |    6 
 smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml                  |  459 ++++++------
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java           |  113 +++
 smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml                      | 1442 +++++++++++++++++++++-------------------
 smartor/src/main/java/com/smartor/domain/ExternalOperationInfo.java                      |   12 
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java      |   62 
 7 files changed, 1,151 insertions(+), 946 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
index 045aaf5..6aba903 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -60,7 +60,8 @@
         for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
             ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
             serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId());
-            serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
+            if (ObjectUtils.isNotEmpty((serviceSubtask.getTaskid())))
+                serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
             serviceSubtask.setServiceSubtaskRecordList(serviceSubtaskRecordService.selectServiceSubtaskRecordList(serviceSubtaskRecord));
         }
         Map<String, Object> map = serviceSubtaskService.patItemCount(serviceSubtaskVO);
diff --git a/smartor/src/main/java/com/smartor/domain/ExternalOperationInfo.java b/smartor/src/main/java/com/smartor/domain/ExternalOperationInfo.java
index fbfd376..7660ebc 100644
--- a/smartor/src/main/java/com/smartor/domain/ExternalOperationInfo.java
+++ b/smartor/src/main/java/com/smartor/domain/ExternalOperationInfo.java
@@ -140,4 +140,16 @@
     @ApiModelProperty(value = "涓欒倽鎶椾綋妫� 楠岀粨鏋�")
     private String BingGanKTJYJGMC;
 
+    @ApiModelProperty(value = "浣滃簾鍘熷洜")
+    private String ZuoFeiYY;
+
+    @ApiModelProperty(value = "浣滃簾浜� ID")
+    private String ZuoFeiRID;
+
+    @ApiModelProperty(value = "浣滃簾浜哄鍚�")
+    private String ZuoFeiRXM;
+
+    @ApiModelProperty(value = "浣滃簾鏃堕棿")
+    private String ZuoFeiSJ;
+
 }
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index f4607c6..1f72652 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -3,6 +3,8 @@
 import java.lang.reflect.Field;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.StringUtils;
@@ -45,6 +47,10 @@
     private PatArchiveMapper patArchiveMapper;
     @Autowired
     private PatMedInhospMapper patMedInhospMapper;
+    @Autowired
+    private PatMedOperationMapper patMedOperationMapper;
+    @Autowired
+    private PatMedOperationItemMapper patMedOperationItemMapper;
     @Autowired
     private Icd10AssociationMapper icd10AssociationMapper;
 
@@ -383,10 +389,111 @@
 
     @Override
     public Boolean addOperationInfo(Map dataMap) {
-        //
+        log.error("ServiceExternalServiceImpl---addOperationInfo鐨勬柊澧炵殑鍊间负锛歿}", dataMap);
 
+        Map yeWuXX = (Map) dataMap.get("YeWuXX");
+        Map<String, Object> BingRenXX = (Map<String, Object>) yeWuXX.get("BingRenXX");
+        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
 
-        return null;
+        //鎵嬫湳淇℃伅鏂板
+        Map<String, Object> ssxx = (Map<String, Object>) yeWuXX.get("ShouShuSQ");
+        //鎵嬫湳鏇存柊
+        Map<String, Object> ssgx = (Map<String, Object>) yeWuXX.get("ShouShuGX");
+        //鎵嬫湳鎾ら攢
+        Map<String, Object> sscx = (Map<String, Object>) yeWuXX.get("ShouShuCX");
+        ExternalOperationInfo externalOperationInfo = null;
+        if (ObjectUtils.isNotEmpty(ssxx))
+            externalOperationInfo = BeanUtil.mapToBean(ssxx, ExternalOperationInfo.class, true);
+        else if (ObjectUtils.isNotEmpty(ssgx))
+            externalOperationInfo = BeanUtil.mapToBean(ssgx, ExternalOperationInfo.class, true);
+        else if (ObjectUtils.isNotEmpty(sscx))
+            externalOperationInfo = BeanUtil.mapToBean(sscx, ExternalOperationInfo.class, true);
+        PatMedOperation patMedOperation = new PatMedOperation();
+        patMedOperation.setPatid(null);
+        patMedOperation.setPatcode(externalInHospPatientInfo.getBingRenID());
+        patMedOperation.setPaname(externalInHospPatientInfo.getXingMing());
+//        patMedOperation.setOpreqid(externalOperationInfo.getShenQingDID());
+        patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID());
+        //鏌ヨ涓�涓嬶紝璇ユ偅鑰呮槸鍚﹀凡缁忔湁杩欎簺鏁版嵁
+        List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation);
+
+        patMedOperation.setOpsstatus(null);
+        patMedOperation.setOperationcode(externalOperationInfo.getShouShuLBDM());
+        patMedOperation.setOperationname(externalOperationInfo.getShouShuLBMC());
+        patMedOperation.setOperatortime(externalOperationInfo.getYaoQiuSJ());
+        patMedOperation.setOpreqtime(externalOperationInfo.getShenQingSJ());
+        patMedOperation.setReqdoccode(externalOperationInfo.getShenQingYSID());
+        patMedOperation.setReqdocname(externalOperationInfo.getShenQingYSXM());
+        patMedOperation.setReqdeptcode(externalOperationInfo.getShenQingKSID());
+        patMedOperation.setReqdeptname(externalOperationInfo.getShenQingKSMC());
+        patMedOperation.setReqloccode(externalOperationInfo.getShouShuKSID());
+        patMedOperation.setReqlocname(externalOperationInfo.getShouShuKSMC());
+        patMedOperation.setSurgeoncode(externalOperationInfo.getZhuDaoYSID());
+        patMedOperation.setSurgeonname(externalOperationInfo.getSanZhuYSXM());
+        patMedOperation.setFirasscode(externalOperationInfo.getYiZhuID());
+        patMedOperation.setFirassname(externalOperationInfo.getYiZhuMC());
+        patMedOperation.setSecasscode(externalOperationInfo.getErZhuYSID());
+        patMedOperation.setSecassname(externalOperationInfo.getErZhuYSXM());
+        patMedOperation.setThrasscode(externalOperationInfo.getSanZhuYSID());
+        patMedOperation.setThrassname(externalOperationInfo.getSanZhuYSXM());
+        patMedOperation.setCanceltime(null);
+        patMedOperation.setCancelreason(null);
+        patMedOperation.setCancelcode(null);
+        patMedOperation.setCancelname(null);
+        patMedOperation.setVisittype(null);
+        patMedOperation.setStatus(null);
+        patMedOperation.setSchemetime(null);
+        patMedOperation.setSchemestatus(null);
+        patMedOperation.setDelFlag("0");
+        patMedOperation.setIsupload(null);
+        patMedOperation.setUploadTime(null);
+        patMedOperation.setOrgid(externalInHospPatientInfo.getZuZhiJGID());
+        patMedOperation.setInhospstate(null);
+        patMedOperation.setPatno(externalInHospPatientInfo.getBingRenID());
+        patMedOperation.setPatname(externalInHospPatientInfo.getXingMing());
+        patMedOperation.setVisitid(null);
+        patMedOperation.setSerialnum(externalInHospPatientInfo.getZhuYuanHao());
+        patMedOperation.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
+        patMedOperation.setHospitalname(externalInHospPatientInfo.getZuZhiJGMC());
+        patMedOperation.setHospitalcode(externalInHospPatientInfo.getZuZhiJGID());
+        patMedOperation.setDeptid(externalOperationInfo.getShouShuKSID());
+        patMedOperation.setDeptcode(externalOperationInfo.getShouShuKSID());
+        patMedOperation.setDeptname(externalOperationInfo.getShouShuKSMC());
+        patMedOperation.setHospitaldistrictcode(null);
+        patMedOperation.setHospitaldistrictname(null);
+        patMedOperation.setRoomno(null);
+        patMedOperation.setBedNo(null);
+        patMedOperation.setDrcode(externalOperationInfo.getZhuDaoYSID());
+        patMedOperation.setDrname(externalOperationInfo.getZhuDaoYSXM());
+        patMedOperation.setNurseId(null);
+        patMedOperation.setNurseName(null);
+        if (CollectionUtils.isNotEmpty(patMedOperations)) {
+            Long id = patMedOperations.get(0).getId();
+            patMedOperation.setId(id);
+            patMedOperationMapper.updatePatMedOperation(patMedOperation);
+        } else patMedOperationMapper.insertPatMedOperation(patMedOperation);
+        log.error("-----patMedOperation鐨勪富閿甶d涓猴細{}", patMedOperation.getId());
+
+        if (ObjectUtils.isNotEmpty(ssxx)) {
+            Map<String, Object> ShouShuMXList = (Map<String, Object>) ssxx.get("ShouShuMXList");
+            List<ExternalOperationDetail> externalOperationDetails = BeanUtil.mapToBean(ShouShuMXList, List.class, true);
+            for (ExternalOperationDetail externalOperationDetail : externalOperationDetails) {
+                PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
+                patMedOperationItem.setOpid(patMedOperation.getId());
+                patMedOperationItem.setOpcode(externalOperationDetail.getShouShuMCID());
+                patMedOperationItem.setOpdesc(externalOperationDetail.getShouShuMC());
+                patMedOperationItem.setMainFlag(externalOperationDetail.getZhuShouSBZ());
+                patMedOperationItem.setIncitypecode(externalOperationDetail.getQieKouLBDM());
+                patMedOperationItem.setIncitypedesc(externalOperationDetail.getQieKouLBMC());
+                patMedOperationItem.setOplevelcode(externalOperationDetail.getShouShuJBDM());
+                patMedOperationItem.setOpleveldesc(externalOperationDetail.getShouShuJBMC());
+                patMedOperationItem.setOpposition(externalOperationDetail.getShouShuBW());
+                patMedOperationItem.setDelFlag("0");
+                patMedOperationItem.setOrgid(patMedOperation.getOrgid());
+                patMedOperationItemMapper.insertPatMedOperationItem(patMedOperationItem);
+            }
+        }
+        return true;
     }
 
     //鏂板鎮h�呭熀鏈俊鎭�
@@ -412,6 +519,7 @@
         patArchive.setAgeUnit(externalInHospPatientInfo.getNianLingDW());
         patArchive.setTelcode(externalInHospPatientInfo.getLianXiDH());
         patArchive.setGuid(externalInHospPatientInfo.getZuZhiJGID());
+        patArchive.setOrgid(externalInHospPatientInfo.getZuZhiJGID());
         if (ObjectUtils.isNotEmpty(externalInHospPatientLiaisonInfo))
             patArchive.setRelativetelcode(externalInHospPatientLiaisonInfo.getLianXiRDH());
         patArchive.setInhospno(externalInHospPatientInfo.getZhuYuanHao());
@@ -552,6 +660,7 @@
                 return true;
             case "SM_SQ_ShenQing":
                 log.error("鎵嬫湳鐢宠鍏ュ弬绫诲瀷涓猴細{}", type);
+                addOperationInfo(dataMap);
                 return true;
             case "TJ_YW_BaoGaoXX":
                 log.error("浣撴鎶ュ憡鍏ュ弬绫诲瀷涓猴細{}", type);
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
index 5c13879..cb275c2 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -253,7 +253,6 @@
     }
 
 
-
     /**
      * 灏嗛棶棰樹繚瀛樺埌缂撳瓨涓�
      *
@@ -297,6 +296,7 @@
         }
         return 0;
     }
+
     @Override
     public Map<String, Object> getQuestionCache(ServiceSubTaskCacheReq serviceSubTaskCacheReq, Long flag) {
         Map<String, Object> map = new HashMap<>();
@@ -341,39 +341,41 @@
         Map<String, Object> map = new HashMap<>();
 
         Map<String, Object> scriptInfoByCondition = serviceTaskService.getScriptInfoByCondition(serviceSubTaskQueryReq.getTaskid(), serviceSubTaskQueryReq.getPatid(), serviceSubTaskQueryReq.getIsFinish(), serviceSubTaskQueryReq.getPatfrom());
-        if (scriptInfoByCondition.get("type").equals("1")) {
-            List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList = (List) scriptInfoByCondition.get("script");
-            for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOList) {
-                Map<String, String> scriptResult = getScriptResult(serviceSubTaskQueryReq.getSubId(), serviceSubTaskQueryReq.getPatid(), ivrLibaTemplateScriptVO.getId());
-                if (ObjectUtils.isNotEmpty(scriptResult)) {
-                    ivrLibaTemplateScriptVO.setScriptResult(scriptResult.get("asrtext"));
-                    ivrLibaTemplateScriptVO.setScriptResultId(scriptResult.get("asrtextId"));
+        if (ObjectUtils.isNotEmpty(scriptInfoByCondition) && ObjectUtils.isNotEmpty(scriptInfoByCondition.get("script"))) {
+            log.error("-----------scriptInfoByCondition鐨勫�间负锛歿}",scriptInfoByCondition);
+            if (scriptInfoByCondition.get("type").equals("1")) {
+                List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList = (List) scriptInfoByCondition.get("script");
+                for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOList) {
+                    Map<String, String> scriptResult = getScriptResult(serviceSubTaskQueryReq.getSubId(), serviceSubTaskQueryReq.getPatid(), ivrLibaTemplateScriptVO.getId());
+                    if (ObjectUtils.isNotEmpty(scriptResult)) {
+                        ivrLibaTemplateScriptVO.setScriptResult(scriptResult.get("asrtext"));
+                        ivrLibaTemplateScriptVO.setScriptResultId(scriptResult.get("asrtextId"));
+                    }
                 }
-            }
-            map.put("scriptResult", ivrLibaTemplateScriptVOList);
-            map.put("taskName", scriptInfoByCondition.get("taskName"));
-            return map;
-        } else if (scriptInfoByCondition.get("type").equals("2")) {
-            List<SvyLibTemplateScriptVO> svyLibTemplateScriptVOList = (List) scriptInfoByCondition.get("script");
-            for (SvyLibTemplateScriptVO svyLibTemplateScriptVO : svyLibTemplateScriptVOList) {
-                Map<String, String> scriptResult = getScriptResult(serviceSubTaskQueryReq.getSubId(), serviceSubTaskQueryReq.getPatid(), svyLibTemplateScriptVO.getId());
-                if (ObjectUtils.isNotEmpty(scriptResult)) {
-                    svyLibTemplateScriptVO.setScriptResult(scriptResult.get("asrtext"));
-                    svyLibTemplateScriptVO.setScriptResultId(scriptResult.get("asrtextId"));
+                map.put("scriptResult", ivrLibaTemplateScriptVOList);
+                map.put("taskName", scriptInfoByCondition.get("taskName"));
+                return map;
+            } else if (scriptInfoByCondition.get("type").equals("2")) {
+                List<SvyLibTemplateScriptVO> svyLibTemplateScriptVOList = (List) scriptInfoByCondition.get("script");
+                for (SvyLibTemplateScriptVO svyLibTemplateScriptVO : svyLibTemplateScriptVOList) {
+                    Map<String, String> scriptResult = getScriptResult(serviceSubTaskQueryReq.getSubId(), serviceSubTaskQueryReq.getPatid(), svyLibTemplateScriptVO.getId());
+                    if (ObjectUtils.isNotEmpty(scriptResult)) {
+                        svyLibTemplateScriptVO.setScriptResult(scriptResult.get("asrtext"));
+                        svyLibTemplateScriptVO.setScriptResultId(scriptResult.get("asrtextId"));
+                    }
                 }
+                map.put("scriptResult", scriptInfoByCondition);
+                map.put("taskName", scriptInfoByCondition.get("taskName"));
+                return map;
+            } else if (scriptInfoByCondition.get("type").equals("3")) {
+                //瀹f暀涓嶉渶瑕佹煡鐪�
+                List<HeLibrary> heLibraryList = (List) scriptInfoByCondition.get("script");
+                map.put("scriptResult", heLibraryList);
+                map.put("taskName", scriptInfoByCondition.get("taskName"));
+                return map;
             }
-            map.put("scriptResult", scriptInfoByCondition);
-            map.put("taskName", scriptInfoByCondition.get("taskName"));
-            return map;
-        } else if (scriptInfoByCondition.get("type").equals("3")) {
-            //瀹f暀涓嶉渶瑕佹煡鐪�
-            List<HeLibrary> heLibraryList = (List) scriptInfoByCondition.get("script");
-            map.put("scriptResult", heLibraryList);
-            map.put("taskName", scriptInfoByCondition.get("taskName"));
-            return map;
         }
-
-        return null;
+        return map;
     }
 
     private Map<String, String> getScriptResult(Long subid, Long pid, Long sid) {
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index cbfbd00..3dd094c 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -251,8 +251,8 @@
     public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
         List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
         //鏍规嵁鍑洪櫌 鏃堕棿鍊掑簭
-//        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime).reversed()).collect(Collectors.toList());
-        return selectServiceSubtaskList;
+        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime, Comparator.nullsLast(Comparator.naturalOrder())).reversed()).collect(Collectors.toList());
+        return sortedServiceSubtaskList;
     }
 
     @Override
@@ -1936,7 +1936,7 @@
     public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
         log.error("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
         List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
-        Map<String, List<ServiceSubtask>> collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(ServiceSubtask::getLeavehospitaldistrictname));
+        Map<String, List<ServiceSubtask>> collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
         for (List<ServiceSubtask> serviceSubtaskList : collect.values()) {
             if (CollectionUtils.isEmpty(serviceSubtaskList)) {
                 continue;
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
index aea8479..db3b5bf 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
@@ -5,31 +5,51 @@
 <mapper namespace="com.smartor.mapper.PatMedOperationItemMapper">
 
     <resultMap type="com.smartor.domain.PatMedOperationItem" id="PatMedOperationItemResult">
-            <result property="id" column="id"/>
-            <result property="opid" column="opid"/>
-            <result property="opcode" column="opcode"/>
-            <result property="opdesc" column="opdesc"/>
-            <result property="mainFlag" column="main_flag"/>
-            <result property="incitypecode" column="incitypecode"/>
-            <result property="incitypedesc" column="incitypedesc"/>
-            <result property="oplevelcode" column="oplevelcode"/>
-            <result property="opleveldesc" column="opleveldesc"/>
-            <result property="opposition" column="opposition"/>
-            <result property="delFlag" column="del_flag"/>
-            <result property="updateBy" column="update_by"/>
-            <result property="updateTime" column="update_time"/>
-            <result property="createBy" column="create_by"/>
-            <result property="createTime" column="create_time"/>
-            <result property="isupload" column="isupload"/>
-            <result property="uploadTime" column="upload_time"/>
-            <result property="orgid" column="orgid"/>
-            <result property="pguid" column="pguid"/>
-            <result property="guid" column="guid"/>
-            <result property="pid" column="pid"/>
+        <result property="id" column="id"/>
+        <result property="opid" column="opid"/>
+        <result property="opcode" column="opcode"/>
+        <result property="opdesc" column="opdesc"/>
+        <result property="mainFlag" column="main_flag"/>
+        <result property="incitypecode" column="incitypecode"/>
+        <result property="incitypedesc" column="incitypedesc"/>
+        <result property="oplevelcode" column="oplevelcode"/>
+        <result property="opleveldesc" column="opleveldesc"/>
+        <result property="opposition" column="opposition"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="isupload" column="isupload"/>
+        <result property="uploadTime" column="upload_time"/>
+        <result property="orgid" column="orgid"/>
+        <result property="pguid" column="pguid"/>
+        <result property="guid" column="guid"/>
+        <result property="pid" column="pid"/>
     </resultMap>
 
     <sql id="selectPatMedOperationItemVo">
-        select id, opid, opcode, opdesc, main_flag, incitypecode, incitypedesc, oplevelcode, opleveldesc, opposition, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pguid, guid, pid
+        select id,
+               opid,
+               opcode,
+               opdesc,
+               main_flag,
+               incitypecode,
+               incitypedesc,
+               oplevelcode,
+               opleveldesc,
+               opposition,
+               del_flag,
+               update_by,
+               update_time,
+               create_by,
+               create_time,
+               isupload,
+               upload_time,
+               orgid,
+               pguid,
+               guid,
+               pid
         from pat_med_operation_item
     </sql>
 
@@ -37,229 +57,230 @@
             resultMap="PatMedOperationItemResult">
         <include refid="selectPatMedOperationItemVo"/>
         <where>
-                        <if test="opid != null ">
-                            and opid = #{opid}
-                        </if>
-                        <if test="opcode != null  and opcode != ''">
-                            and opcode = #{opcode}
-                        </if>
-                        <if test="opdesc != null  and opdesc != ''">
-                            and opdesc = #{opdesc}
-                        </if>
-                        <if test="mainFlag != null  and mainFlag != ''">
-                            and main_flag = #{mainFlag}
-                        </if>
-                        <if test="incitypecode != null  and incitypecode != ''">
-                            and incitypecode = #{incitypecode}
-                        </if>
-                        <if test="incitypedesc != null  and incitypedesc != ''">
-                            and incitypedesc = #{incitypedesc}
-                        </if>
-                        <if test="oplevelcode != null  and oplevelcode != ''">
-                            and oplevelcode = #{oplevelcode}
-                        </if>
-                        <if test="opleveldesc != null  and opleveldesc != ''">
-                            and opleveldesc = #{opleveldesc}
-                        </if>
-                        <if test="opposition != null  and opposition != ''">
-                            and opposition = #{opposition}
-                        </if>
-                        <if test="isupload != null ">
-                            and isupload = #{isupload}
-                        </if>
-                        <if test="uploadTime != null ">
-                            and upload_time = #{uploadTime}
-                        </if>
-                        <if test="orgid != null  and orgid != ''">
-                            and orgid = #{orgid}
-                        </if>
-                        <if test="pguid != null  and pguid != ''">
-                            and pguid = #{pguid}
-                        </if>
-                        <if test="guid != null  and guid != ''">
-                            and guid = #{guid}
-                        </if>
-                        <if test="pid != null ">
-                            and pid = #{pid}
-                        </if>
+            <if test="opid != null ">
+                and opid = #{opid}
+            </if>
+            <if test="opcode != null  and opcode != ''">
+                and opcode = #{opcode}
+            </if>
+            <if test="opdesc != null  and opdesc != ''">
+                and opdesc = #{opdesc}
+            </if>
+            <if test="mainFlag != null  and mainFlag != ''">
+                and main_flag = #{mainFlag}
+            </if>
+            <if test="incitypecode != null  and incitypecode != ''">
+                and incitypecode = #{incitypecode}
+            </if>
+            <if test="incitypedesc != null  and incitypedesc != ''">
+                and incitypedesc = #{incitypedesc}
+            </if>
+            <if test="oplevelcode != null  and oplevelcode != ''">
+                and oplevelcode = #{oplevelcode}
+            </if>
+            <if test="opleveldesc != null  and opleveldesc != ''">
+                and opleveldesc = #{opleveldesc}
+            </if>
+            <if test="opposition != null  and opposition != ''">
+                and opposition = #{opposition}
+            </if>
+            <if test="isupload != null ">
+                and isupload = #{isupload}
+            </if>
+            <if test="uploadTime != null ">
+                and upload_time = #{uploadTime}
+            </if>
+            <if test="orgid != null  and orgid != ''">
+                and orgid = #{orgid}
+            </if>
+            <if test="pguid != null  and pguid != ''">
+                and pguid = #{pguid}
+            </if>
+            <if test="guid != null  and guid != ''">
+                and guid = #{guid}
+            </if>
+            <if test="pid != null ">
+                and pid = #{pid}
+            </if>
         </where>
     </select>
 
     <select id="selectPatMedOperationItemById" parameterType="Long"
             resultMap="PatMedOperationItemResult">
-            <include refid="selectPatMedOperationItemVo"/>
-            where id = #{id}
+        <include refid="selectPatMedOperationItemVo"/>
+        where id = #{id}
     </select>
 
-    <insert id="insertPatMedOperationItem" parameterType="com.smartor.domain.PatMedOperationItem">
+    <insert id="insertPatMedOperationItem" parameterType="com.smartor.domain.PatMedOperationItem"
+            useGeneratedKeys="true" keyProperty="id">
         insert into pat_med_operation_item
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                    <if test="id != null">id,
-                    </if>
-                    <if test="opid != null">opid,
-                    </if>
-                    <if test="opcode != null">opcode,
-                    </if>
-                    <if test="opdesc != null">opdesc,
-                    </if>
-                    <if test="mainFlag != null">main_flag,
-                    </if>
-                    <if test="incitypecode != null">incitypecode,
-                    </if>
-                    <if test="incitypedesc != null">incitypedesc,
-                    </if>
-                    <if test="oplevelcode != null">oplevelcode,
-                    </if>
-                    <if test="opleveldesc != null">opleveldesc,
-                    </if>
-                    <if test="opposition != null">opposition,
-                    </if>
-                    <if test="delFlag != null">del_flag,
-                    </if>
-                    <if test="updateBy != null">update_by,
-                    </if>
-                    <if test="updateTime != null">update_time,
-                    </if>
-                    <if test="createBy != null">create_by,
-                    </if>
-                    <if test="createTime != null">create_time,
-                    </if>
-                    <if test="isupload != null">isupload,
-                    </if>
-                    <if test="uploadTime != null">upload_time,
-                    </if>
-                    <if test="orgid != null">orgid,
-                    </if>
-                    <if test="pguid != null">pguid,
-                    </if>
-                    <if test="guid != null">guid,
-                    </if>
-                    <if test="pid != null">pid,
-                    </if>
+            <if test="id != null">id,
+            </if>
+            <if test="opid != null">opid,
+            </if>
+            <if test="opcode != null">opcode,
+            </if>
+            <if test="opdesc != null">opdesc,
+            </if>
+            <if test="mainFlag != null">main_flag,
+            </if>
+            <if test="incitypecode != null">incitypecode,
+            </if>
+            <if test="incitypedesc != null">incitypedesc,
+            </if>
+            <if test="oplevelcode != null">oplevelcode,
+            </if>
+            <if test="opleveldesc != null">opleveldesc,
+            </if>
+            <if test="opposition != null">opposition,
+            </if>
+            <if test="delFlag != null">del_flag,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="updateTime != null">update_time,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="isupload != null">isupload,
+            </if>
+            <if test="uploadTime != null">upload_time,
+            </if>
+            <if test="orgid != null">orgid,
+            </if>
+            <if test="pguid != null">pguid,
+            </if>
+            <if test="guid != null">guid,
+            </if>
+            <if test="pid != null">pid,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                    <if test="id != null">#{id},
-                    </if>
-                    <if test="opid != null">#{opid},
-                    </if>
-                    <if test="opcode != null">#{opcode},
-                    </if>
-                    <if test="opdesc != null">#{opdesc},
-                    </if>
-                    <if test="mainFlag != null">#{mainFlag},
-                    </if>
-                    <if test="incitypecode != null">#{incitypecode},
-                    </if>
-                    <if test="incitypedesc != null">#{incitypedesc},
-                    </if>
-                    <if test="oplevelcode != null">#{oplevelcode},
-                    </if>
-                    <if test="opleveldesc != null">#{opleveldesc},
-                    </if>
-                    <if test="opposition != null">#{opposition},
-                    </if>
-                    <if test="delFlag != null">#{delFlag},
-                    </if>
-                    <if test="updateBy != null">#{updateBy},
-                    </if>
-                    <if test="updateTime != null">#{updateTime},
-                    </if>
-                    <if test="createBy != null">#{createBy},
-                    </if>
-                    <if test="createTime != null">#{createTime},
-                    </if>
-                    <if test="isupload != null">#{isupload},
-                    </if>
-                    <if test="uploadTime != null">#{uploadTime},
-                    </if>
-                    <if test="orgid != null">#{orgid},
-                    </if>
-                    <if test="pguid != null">#{pguid},
-                    </if>
-                    <if test="guid != null">#{guid},
-                    </if>
-                    <if test="pid != null">#{pid},
-                    </if>
+            <if test="id != null">#{id},
+            </if>
+            <if test="opid != null">#{opid},
+            </if>
+            <if test="opcode != null">#{opcode},
+            </if>
+            <if test="opdesc != null">#{opdesc},
+            </if>
+            <if test="mainFlag != null">#{mainFlag},
+            </if>
+            <if test="incitypecode != null">#{incitypecode},
+            </if>
+            <if test="incitypedesc != null">#{incitypedesc},
+            </if>
+            <if test="oplevelcode != null">#{oplevelcode},
+            </if>
+            <if test="opleveldesc != null">#{opleveldesc},
+            </if>
+            <if test="opposition != null">#{opposition},
+            </if>
+            <if test="delFlag != null">#{delFlag},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="isupload != null">#{isupload},
+            </if>
+            <if test="uploadTime != null">#{uploadTime},
+            </if>
+            <if test="orgid != null">#{orgid},
+            </if>
+            <if test="pguid != null">#{pguid},
+            </if>
+            <if test="guid != null">#{guid},
+            </if>
+            <if test="pid != null">#{pid},
+            </if>
         </trim>
     </insert>
 
     <update id="updatePatMedOperationItem" parameterType="com.smartor.domain.PatMedOperationItem">
         update pat_med_operation_item
         <trim prefix="SET" suffixOverrides=",">
-                    <if test="opid != null">opid =
-                        #{opid},
-                    </if>
-                    <if test="opcode != null">opcode =
-                        #{opcode},
-                    </if>
-                    <if test="opdesc != null">opdesc =
-                        #{opdesc},
-                    </if>
-                    <if test="mainFlag != null">main_flag =
-                        #{mainFlag},
-                    </if>
-                    <if test="incitypecode != null">incitypecode =
-                        #{incitypecode},
-                    </if>
-                    <if test="incitypedesc != null">incitypedesc =
-                        #{incitypedesc},
-                    </if>
-                    <if test="oplevelcode != null">oplevelcode =
-                        #{oplevelcode},
-                    </if>
-                    <if test="opleveldesc != null">opleveldesc =
-                        #{opleveldesc},
-                    </if>
-                    <if test="opposition != null">opposition =
-                        #{opposition},
-                    </if>
-                    <if test="delFlag != null">del_flag =
-                        #{delFlag},
-                    </if>
-                    <if test="updateBy != null">update_by =
-                        #{updateBy},
-                    </if>
-                    <if test="updateTime != null">update_time =
-                        #{updateTime},
-                    </if>
-                    <if test="createBy != null">create_by =
-                        #{createBy},
-                    </if>
-                    <if test="createTime != null">create_time =
-                        #{createTime},
-                    </if>
-                    <if test="isupload != null">isupload =
-                        #{isupload},
-                    </if>
-                    <if test="uploadTime != null">upload_time =
-                        #{uploadTime},
-                    </if>
-                    <if test="orgid != null">orgid =
-                        #{orgid},
-                    </if>
-                    <if test="pguid != null">pguid =
-                        #{pguid},
-                    </if>
-                    <if test="guid != null">guid =
-                        #{guid},
-                    </if>
-                    <if test="pid != null">pid =
-                        #{pid},
-                    </if>
+            <if test="opid != null">opid =
+                #{opid},
+            </if>
+            <if test="opcode != null">opcode =
+                #{opcode},
+            </if>
+            <if test="opdesc != null">opdesc =
+                #{opdesc},
+            </if>
+            <if test="mainFlag != null">main_flag =
+                #{mainFlag},
+            </if>
+            <if test="incitypecode != null">incitypecode =
+                #{incitypecode},
+            </if>
+            <if test="incitypedesc != null">incitypedesc =
+                #{incitypedesc},
+            </if>
+            <if test="oplevelcode != null">oplevelcode =
+                #{oplevelcode},
+            </if>
+            <if test="opleveldesc != null">opleveldesc =
+                #{opleveldesc},
+            </if>
+            <if test="opposition != null">opposition =
+                #{opposition},
+            </if>
+            <if test="delFlag != null">del_flag =
+                #{delFlag},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="updateTime != null">update_time =
+                #{updateTime},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="isupload != null">isupload =
+                #{isupload},
+            </if>
+            <if test="uploadTime != null">upload_time =
+                #{uploadTime},
+            </if>
+            <if test="orgid != null">orgid =
+                #{orgid},
+            </if>
+            <if test="pguid != null">pguid =
+                #{pguid},
+            </if>
+            <if test="guid != null">guid =
+                #{guid},
+            </if>
+            <if test="pid != null">pid =
+                #{pid},
+            </if>
         </trim>
         where id = #{id}
     </update>
 
-                <update id="deletePatMedOperationItemById" parameterType="Long">
+    <update id="deletePatMedOperationItemById" parameterType="Long">
         update pat_med_operation_item
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
-        where  id = #{id}
+        where id = #{id}
     </update>
 
-                            <update id="deletePatMedOperationItemByIds" parameterType="String">
-        update  pat_med_operation_item
+    <update id="deletePatMedOperationItemByIds" parameterType="String">
+        update pat_med_operation_item
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
@@ -268,8 +289,6 @@
             #{id}
         </foreach>
     </update>
-
-
 
 
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
index e153a6c..880a5cc 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
@@ -5,74 +5,137 @@
 <mapper namespace="com.smartor.mapper.PatMedOperationMapper">
 
     <resultMap type="com.smartor.domain.PatMedOperation" id="PatMedOperationResult">
-            <result property="id" column="id"/>
-            <result property="patid" column="patid"/>
-            <result property="patcode" column="patcode"/>
-            <result property="paname" column="paname"/>
-            <result property="opreqid" column="opreqid"/>
-            <result property="opreqcode" column="opreqcode"/>
-            <result property="opsstatus" column="opsstatus"/>
-            <result property="operationcode" column="operationcode"/>
-            <result property="operationname" column="operationname"/>
-            <result property="operatortime" column="operatortime"/>
-            <result property="opreqtime" column="opreqtime"/>
-            <result property="reqdoccode" column="reqdoccode"/>
-            <result property="reqdocname" column="reqdocname"/>
-            <result property="reqdeptcode" column="reqdeptcode"/>
-            <result property="reqdeptname" column="reqdeptname"/>
-            <result property="reqloccode" column="reqloccode"/>
-            <result property="reqlocname" column="reqlocname"/>
-            <result property="remark" column="remark"/>
-            <result property="surgeoncode" column="surgeoncode"/>
-            <result property="surgeonname" column="surgeonname"/>
-            <result property="firasscode" column="firasscode"/>
-            <result property="firassname" column="firassname"/>
-            <result property="secasscode" column="secasscode"/>
-            <result property="secassname" column="secassname"/>
-            <result property="thrasscode" column="thrasscode"/>
-            <result property="thrassname" column="thrassname"/>
-            <result property="canceltime" column="canceltime"/>
-            <result property="cancelreason" column="cancelreason"/>
-            <result property="cancelcode" column="cancelcode"/>
-            <result property="cancelname" column="cancelname"/>
-            <result property="visittype" column="visittype"/>
-            <result property="status" column="status"/>
-            <result property="schemetime" column="schemetime"/>
-            <result property="schemestatus" column="schemestatus"/>
-            <result property="delFlag" column="del_flag"/>
-            <result property="updateBy" column="update_by"/>
-            <result property="updateTime" column="update_time"/>
-            <result property="createBy" column="create_by"/>
-            <result property="createTime" column="create_time"/>
-            <result property="isupload" column="isupload"/>
-            <result property="uploadTime" column="upload_time"/>
-            <result property="orgid" column="orgid"/>
-            <result property="guid" column="guid"/>
-            <result property="pguid" column="pguid"/>
-            <result property="pid" column="pid"/>
-            <result property="inhospstate" column="inhospstate"/>
-            <result property="patno" column="patno"/>
-            <result property="patname" column="patname"/>
-            <result property="visitid" column="visitid"/>
-            <result property="serialnum" column="serialnum"/>
-            <result property="inhospno" column="inhospno"/>
-            <result property="hospitalname" column="hospitalname"/>
-            <result property="hospitalcode" column="hospitalcode"/>
-            <result property="deptid" column="deptid"/>
-            <result property="deptcode" column="deptcode"/>
-            <result property="deptname" column="deptname"/>
-            <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
-            <result property="hospitaldistrictname" column="hospitaldistrictname"/>
-            <result property="roomno" column="roomno"/>
-            <result property="bedNo" column="bed_no"/>
-            <result property="drcode" column="drcode"/>
-            <result property="drname" column="drname"/>
-            <result property="nurseId" column="nurse_id"/>
-            <result property="nurseName" column="nurse_name"/>
+        <result property="id" column="id"/>
+        <result property="patid" column="patid"/>
+        <result property="patcode" column="patcode"/>
+        <result property="paname" column="paname"/>
+        <result property="opreqid" column="opreqid"/>
+        <result property="opreqcode" column="opreqcode"/>
+        <result property="opsstatus" column="opsstatus"/>
+        <result property="operationcode" column="operationcode"/>
+        <result property="operationname" column="operationname"/>
+        <result property="operatortime" column="operatortime"/>
+        <result property="opreqtime" column="opreqtime"/>
+        <result property="reqdoccode" column="reqdoccode"/>
+        <result property="reqdocname" column="reqdocname"/>
+        <result property="reqdeptcode" column="reqdeptcode"/>
+        <result property="reqdeptname" column="reqdeptname"/>
+        <result property="reqloccode" column="reqloccode"/>
+        <result property="reqlocname" column="reqlocname"/>
+        <result property="remark" column="remark"/>
+        <result property="surgeoncode" column="surgeoncode"/>
+        <result property="surgeonname" column="surgeonname"/>
+        <result property="firasscode" column="firasscode"/>
+        <result property="firassname" column="firassname"/>
+        <result property="secasscode" column="secasscode"/>
+        <result property="secassname" column="secassname"/>
+        <result property="thrasscode" column="thrasscode"/>
+        <result property="thrassname" column="thrassname"/>
+        <result property="canceltime" column="canceltime"/>
+        <result property="cancelreason" column="cancelreason"/>
+        <result property="cancelcode" column="cancelcode"/>
+        <result property="cancelname" column="cancelname"/>
+        <result property="visittype" column="visittype"/>
+        <result property="status" column="status"/>
+        <result property="schemetime" column="schemetime"/>
+        <result property="schemestatus" column="schemestatus"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="isupload" column="isupload"/>
+        <result property="uploadTime" column="upload_time"/>
+        <result property="orgid" column="orgid"/>
+        <result property="guid" column="guid"/>
+        <result property="pguid" column="pguid"/>
+        <result property="pid" column="pid"/>
+        <result property="inhospstate" column="inhospstate"/>
+        <result property="patno" column="patno"/>
+        <result property="patname" column="patname"/>
+        <result property="visitid" column="visitid"/>
+        <result property="serialnum" column="serialnum"/>
+        <result property="inhospno" column="inhospno"/>
+        <result property="hospitalname" column="hospitalname"/>
+        <result property="hospitalcode" column="hospitalcode"/>
+        <result property="deptid" column="deptid"/>
+        <result property="deptcode" column="deptcode"/>
+        <result property="deptname" column="deptname"/>
+        <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
+        <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+        <result property="roomno" column="roomno"/>
+        <result property="bedNo" column="bed_no"/>
+        <result property="drcode" column="drcode"/>
+        <result property="drname" column="drname"/>
+        <result property="nurseId" column="nurse_id"/>
+        <result property="nurseName" column="nurse_name"/>
     </resultMap>
 
     <sql id="selectPatMedOperationVo">
-        select id, patid, patcode, paname, opreqid, opreqcode, opsstatus, operationcode, operationname,  operatortime, opreqtime, reqdoccode, reqdocname, reqdeptcode, reqdeptname, reqloccode, reqlocname, remark, surgeoncode, surgeonname, firasscode, firassname, secasscode, secassname, thrasscode, thrassname, canceltime, cancelreason, cancelcode, cancelname, visittype, status, schemetime, schemestatus, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, guid, pguid, pid, inhospstate, patno, patname, visitid, serialnum, inhospno, hospitalname, hospitalcode, deptid, deptcode, deptname, hospitaldistrictcode, hospitaldistrictname, roomno, bed_no, drcode, drname, nurse_id, nurse_name
+        select id,
+               patid,
+               patcode,
+               paname,
+               opreqid,
+               opreqcode,
+               opsstatus,
+               operationcode,
+               operationname,
+               operatortime,
+               opreqtime,
+               reqdoccode,
+               reqdocname,
+               reqdeptcode,
+               reqdeptname,
+               reqloccode,
+               reqlocname,
+               remark,
+               surgeoncode,
+               surgeonname,
+               firasscode,
+               firassname,
+               secasscode,
+               secassname,
+               thrasscode,
+               thrassname,
+               canceltime,
+               cancelreason,
+               cancelcode,
+               cancelname,
+               visittype,
+               status,
+               schemetime,
+               schemestatus,
+               del_flag,
+               update_by,
+               update_time,
+               create_by,
+               create_time,
+               isupload,
+               upload_time,
+               orgid,
+               guid,
+               pguid,
+               pid,
+               inhospstate,
+               patno,
+               patname,
+               visitid,
+               serialnum,
+               inhospno,
+               hospitalname,
+               hospitalcode,
+               deptid,
+               deptcode,
+               deptname,
+               hospitaldistrictcode,
+               hospitaldistrictname,
+               roomno,
+               bed_no,
+               drcode,
+               drname,
+               nurse_id,
+               nurse_name
         from pat_med_operation
     </sql>
 
@@ -80,657 +143,658 @@
             resultMap="PatMedOperationResult">
         <include refid="selectPatMedOperationVo"/>
         <where>
-                        <if test="patid != null ">
-                            and patid = #{patid}
-                        </if>
-                        <if test="patcode != null  and patcode != ''">
-                            and patcode = #{patcode}
-                        </if>
-                        <if test="paname != null  and paname != ''">
-                            and paname like concat('%', #{paname}, '%')
-                        </if>
-                        <if test="opreqid != null ">
-                            and opreqid = #{opreqid}
-                        </if>
-                        <if test="opreqcode != null  and opreqcode != ''">
-                            and opreqcode = #{opreqcode}
-                        </if>
-                        <if test="opsstatus != null  and opsstatus != ''">
-                            and opsstatus = #{opsstatus}
-                        </if>
-                        <if test="operationcode != null  and operationcode != ''">
-                            and operationcode = #{operationcode}
-                        </if>
-                        <if test="operationname != null  and operationname != ''">
-                            and operationname like concat('%', #{operationname}, '%')
-                        </if>
+            <if test="patid != null ">
+                and patid = #{patid}
+            </if>
+            <if test="patcode != null  and patcode != ''">
+                and patcode = #{patcode}
+            </if>
+            <if test="paname != null  and paname != ''">
+                and paname like concat('%', #{paname}, '%')
+            </if>
+            <if test="opreqid != null ">
+                and opreqid = #{opreqid}
+            </if>
+            <if test="opreqcode != null  and opreqcode != ''">
+                and opreqcode = #{opreqcode}
+            </if>
+            <if test="opsstatus != null  and opsstatus != ''">
+                and opsstatus = #{opsstatus}
+            </if>
+            <if test="operationcode != null  and operationcode != ''">
+                and operationcode = #{operationcode}
+            </if>
+            <if test="operationname != null  and operationname != ''">
+                and operationname like concat('%', #{operationname}, '%')
+            </if>
 
-                        <if test="operatortime != null ">
-                            and operatortime = #{operatortime}
-                        </if>
-                        <if test="opreqtime != null ">
-                            and opreqtime = #{opreqtime}
-                        </if>
-                        <if test="reqdoccode != null  and reqdoccode != ''">
-                            and reqdoccode = #{reqdoccode}
-                        </if>
-                        <if test="reqdocname != null  and reqdocname != ''">
-                            and reqdocname like concat('%', #{reqdocname}, '%')
-                        </if>
-                        <if test="reqdeptcode != null  and reqdeptcode != ''">
-                            and reqdeptcode = #{reqdeptcode}
-                        </if>
-                        <if test="reqdeptname != null  and reqdeptname != ''">
-                            and reqdeptname like concat('%', #{reqdeptname}, '%')
-                        </if>
-                        <if test="reqloccode != null  and reqloccode != ''">
-                            and reqloccode = #{reqloccode}
-                        </if>
-                        <if test="reqlocname != null  and reqlocname != ''">
-                            and reqlocname like concat('%', #{reqlocname}, '%')
-                        </if>
-                        <if test="surgeoncode != null  and surgeoncode != ''">
-                            and surgeoncode = #{surgeoncode}
-                        </if>
-                        <if test="surgeonname != null  and surgeonname != ''">
-                            and surgeonname like concat('%', #{surgeonname}, '%')
-                        </if>
-                        <if test="firasscode != null  and firasscode != ''">
-                            and firasscode = #{firasscode}
-                        </if>
-                        <if test="firassname != null  and firassname != ''">
-                            and firassname like concat('%', #{firassname}, '%')
-                        </if>
-                        <if test="secasscode != null  and secasscode != ''">
-                            and secasscode = #{secasscode}
-                        </if>
-                        <if test="secassname != null  and secassname != ''">
-                            and secassname like concat('%', #{secassname}, '%')
-                        </if>
-                        <if test="thrasscode != null  and thrasscode != ''">
-                            and thrasscode = #{thrasscode}
-                        </if>
-                        <if test="thrassname != null  and thrassname != ''">
-                            and thrassname like concat('%', #{thrassname}, '%')
-                        </if>
-                        <if test="canceltime != null  and canceltime != ''">
-                            and canceltime = #{canceltime}
-                        </if>
-                        <if test="cancelreason != null  and cancelreason != ''">
-                            and cancelreason = #{cancelreason}
-                        </if>
-                        <if test="cancelcode != null  and cancelcode != ''">
-                            and cancelcode = #{cancelcode}
-                        </if>
-                        <if test="cancelname != null  and cancelname != ''">
-                            and cancelname like concat('%', #{cancelname}, '%')
-                        </if>
-                        <if test="visittype != null ">
-                            and visittype = #{visittype}
-                        </if>
-                        <if test="status != null  and status != ''">
-                            and status = #{status}
-                        </if>
-                        <if test="schemetime != null ">
-                            and schemetime = #{schemetime}
-                        </if>
-                        <if test="schemestatus != null ">
-                            and schemestatus = #{schemestatus}
-                        </if>
-                        <if test="isupload != null ">
-                            and isupload = #{isupload}
-                        </if>
-                        <if test="uploadTime != null ">
-                            and upload_time = #{uploadTime}
-                        </if>
-                        <if test="orgid != null  and orgid != ''">
-                            and orgid = #{orgid}
-                        </if>
-                        <if test="guid != null  and guid != ''">
-                            and guid = #{guid}
-                        </if>
-                        <if test="pguid != null  and pguid != ''">
-                            and pguid = #{pguid}
-                        </if>
-                        <if test="pid != null ">
-                            and pid = #{pid}
-                        </if>
-                        <if test="inhospstate != null  and inhospstate != ''">
-                            and inhospstate = #{inhospstate}
-                        </if>
-                        <if test="patno != null  and patno != ''">
-                            and patno = #{patno}
-                        </if>
-                        <if test="patname != null  and patname != ''">
-                            and patname like concat('%', #{patname}, '%')
-                        </if>
-                        <if test="visitid != null ">
-                            and visitid = #{visitid}
-                        </if>
-                        <if test="serialnum != null  and serialnum != ''">
-                            and serialnum = #{serialnum}
-                        </if>
-                        <if test="inhospno != null  and inhospno != ''">
-                            and inhospno = #{inhospno}
-                        </if>
-                        <if test="hospitalname != null  and hospitalname != ''">
-                            and hospitalname like concat('%', #{hospitalname}, '%')
-                        </if>
-                        <if test="hospitalcode != null  and hospitalcode != ''">
-                            and hospitalcode = #{hospitalcode}
-                        </if>
-                        <if test="deptid != null  and deptid != ''">
-                            and deptid = #{deptid}
-                        </if>
-                        <if test="deptcode != null  and deptcode != ''">
-                            and deptcode = #{deptcode}
-                        </if>
-                        <if test="deptname != null  and deptname != ''">
-                            and deptname like concat('%', #{deptname}, '%')
-                        </if>
-                        <if test="hospitaldistrictcode != null  and hospitaldistrictcode != ''">
-                            and hospitaldistrictcode = #{hospitaldistrictcode}
-                        </if>
-                        <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">
-                            and hospitaldistrictname like concat('%', #{hospitaldistrictname}, '%')
-                        </if>
-                        <if test="roomno != null  and roomno != ''">
-                            and roomno = #{roomno}
-                        </if>
-                        <if test="bedNo != null  and bedNo != ''">
-                            and bed_no = #{bedNo}
-                        </if>
-                        <if test="drcode != null  and drcode != ''">
-                            and drcode = #{drcode}
-                        </if>
-                        <if test="drname != null  and drname != ''">
-                            and drname like concat('%', #{drname}, '%')
-                        </if>
-                        <if test="nurseId != null  and nurseId != ''">
-                            and nurse_id = #{nurseId}
-                        </if>
-                        <if test="nurseName != null  and nurseName != ''">
-                            and nurse_name like concat('%', #{nurseName}, '%')
-                        </if>
+            <if test="operatortime != null ">
+                and operatortime = #{operatortime}
+            </if>
+            <if test="opreqtime != null ">
+                and opreqtime = #{opreqtime}
+            </if>
+            <if test="reqdoccode != null  and reqdoccode != ''">
+                and reqdoccode = #{reqdoccode}
+            </if>
+            <if test="reqdocname != null  and reqdocname != ''">
+                and reqdocname like concat('%', #{reqdocname}, '%')
+            </if>
+            <if test="reqdeptcode != null  and reqdeptcode != ''">
+                and reqdeptcode = #{reqdeptcode}
+            </if>
+            <if test="reqdeptname != null  and reqdeptname != ''">
+                and reqdeptname like concat('%', #{reqdeptname}, '%')
+            </if>
+            <if test="reqloccode != null  and reqloccode != ''">
+                and reqloccode = #{reqloccode}
+            </if>
+            <if test="reqlocname != null  and reqlocname != ''">
+                and reqlocname like concat('%', #{reqlocname}, '%')
+            </if>
+            <if test="surgeoncode != null  and surgeoncode != ''">
+                and surgeoncode = #{surgeoncode}
+            </if>
+            <if test="surgeonname != null  and surgeonname != ''">
+                and surgeonname like concat('%', #{surgeonname}, '%')
+            </if>
+            <if test="firasscode != null  and firasscode != ''">
+                and firasscode = #{firasscode}
+            </if>
+            <if test="firassname != null  and firassname != ''">
+                and firassname like concat('%', #{firassname}, '%')
+            </if>
+            <if test="secasscode != null  and secasscode != ''">
+                and secasscode = #{secasscode}
+            </if>
+            <if test="secassname != null  and secassname != ''">
+                and secassname like concat('%', #{secassname}, '%')
+            </if>
+            <if test="thrasscode != null  and thrasscode != ''">
+                and thrasscode = #{thrasscode}
+            </if>
+            <if test="thrassname != null  and thrassname != ''">
+                and thrassname like concat('%', #{thrassname}, '%')
+            </if>
+            <if test="canceltime != null  and canceltime != ''">
+                and canceltime = #{canceltime}
+            </if>
+            <if test="cancelreason != null  and cancelreason != ''">
+                and cancelreason = #{cancelreason}
+            </if>
+            <if test="cancelcode != null  and cancelcode != ''">
+                and cancelcode = #{cancelcode}
+            </if>
+            <if test="cancelname != null  and cancelname != ''">
+                and cancelname like concat('%', #{cancelname}, '%')
+            </if>
+            <if test="visittype != null ">
+                and visittype = #{visittype}
+            </if>
+            <if test="status != null  and status != ''">
+                and status = #{status}
+            </if>
+            <if test="schemetime != null ">
+                and schemetime = #{schemetime}
+            </if>
+            <if test="schemestatus != null ">
+                and schemestatus = #{schemestatus}
+            </if>
+            <if test="isupload != null ">
+                and isupload = #{isupload}
+            </if>
+            <if test="uploadTime != null ">
+                and upload_time = #{uploadTime}
+            </if>
+            <if test="orgid != null  and orgid != ''">
+                and orgid = #{orgid}
+            </if>
+            <if test="guid != null  and guid != ''">
+                and guid = #{guid}
+            </if>
+            <if test="pguid != null  and pguid != ''">
+                and pguid = #{pguid}
+            </if>
+            <if test="pid != null ">
+                and pid = #{pid}
+            </if>
+            <if test="inhospstate != null  and inhospstate != ''">
+                and inhospstate = #{inhospstate}
+            </if>
+            <if test="patno != null  and patno != ''">
+                and patno = #{patno}
+            </if>
+            <if test="patname != null  and patname != ''">
+                and patname like concat('%', #{patname}, '%')
+            </if>
+            <if test="visitid != null ">
+                and visitid = #{visitid}
+            </if>
+            <if test="serialnum != null  and serialnum != ''">
+                and serialnum = #{serialnum}
+            </if>
+            <if test="inhospno != null  and inhospno != ''">
+                and inhospno = #{inhospno}
+            </if>
+            <if test="hospitalname != null  and hospitalname != ''">
+                and hospitalname like concat('%', #{hospitalname}, '%')
+            </if>
+            <if test="hospitalcode != null  and hospitalcode != ''">
+                and hospitalcode = #{hospitalcode}
+            </if>
+            <if test="deptid != null  and deptid != ''">
+                and deptid = #{deptid}
+            </if>
+            <if test="deptcode != null  and deptcode != ''">
+                and deptcode = #{deptcode}
+            </if>
+            <if test="deptname != null  and deptname != ''">
+                and deptname like concat('%', #{deptname}, '%')
+            </if>
+            <if test="hospitaldistrictcode != null  and hospitaldistrictcode != ''">
+                and hospitaldistrictcode = #{hospitaldistrictcode}
+            </if>
+            <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">
+                and hospitaldistrictname like concat('%', #{hospitaldistrictname}, '%')
+            </if>
+            <if test="roomno != null  and roomno != ''">
+                and roomno = #{roomno}
+            </if>
+            <if test="bedNo != null  and bedNo != ''">
+                and bed_no = #{bedNo}
+            </if>
+            <if test="drcode != null  and drcode != ''">
+                and drcode = #{drcode}
+            </if>
+            <if test="drname != null  and drname != ''">
+                and drname like concat('%', #{drname}, '%')
+            </if>
+            <if test="nurseId != null  and nurseId != ''">
+                and nurse_id = #{nurseId}
+            </if>
+            <if test="nurseName != null  and nurseName != ''">
+                and nurse_name like concat('%', #{nurseName}, '%')
+            </if>
         </where>
     </select>
 
     <select id="selectPatMedOperationById" parameterType="Long"
             resultMap="PatMedOperationResult">
-            <include refid="selectPatMedOperationVo"/>
-            where id = #{id}
+        <include refid="selectPatMedOperationVo"/>
+        where id = #{id}
     </select>
 
-    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation">
+    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation" useGeneratedKeys="true"
+            keyProperty="id">
         insert into pat_med_operation
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                    <if test="id != null">id,
-                    </if>
-                    <if test="patid != null">patid,
-                    </if>
-                    <if test="patcode != null">patcode,
-                    </if>
-                    <if test="paname != null">paname,
-                    </if>
-                    <if test="opreqid != null">opreqid,
-                    </if>
-                    <if test="opreqcode != null">opreqcode,
-                    </if>
-                    <if test="opsstatus != null">opsstatus,
-                    </if>
-                    <if test="operationcode != null">operationcode,
-                    </if>
-                    <if test="operationname != null">operationname,
-                    </if>
-                    <if test="operatortime != null">operatortime,
-                    </if>
-                    <if test="opreqtime != null">opreqtime,
-                    </if>
-                    <if test="reqdoccode != null">reqdoccode,
-                    </if>
-                    <if test="reqdocname != null">reqdocname,
-                    </if>
-                    <if test="reqdeptcode != null">reqdeptcode,
-                    </if>
-                    <if test="reqdeptname != null">reqdeptname,
-                    </if>
-                    <if test="reqloccode != null">reqloccode,
-                    </if>
-                    <if test="reqlocname != null">reqlocname,
-                    </if>
-                    <if test="remark != null">remark,
-                    </if>
-                    <if test="surgeoncode != null">surgeoncode,
-                    </if>
-                    <if test="surgeonname != null">surgeonname,
-                    </if>
-                    <if test="firasscode != null">firasscode,
-                    </if>
-                    <if test="firassname != null">firassname,
-                    </if>
-                    <if test="secasscode != null">secasscode,
-                    </if>
-                    <if test="secassname != null">secassname,
-                    </if>
-                    <if test="thrasscode != null">thrasscode,
-                    </if>
-                    <if test="thrassname != null">thrassname,
-                    </if>
-                    <if test="canceltime != null">canceltime,
-                    </if>
-                    <if test="cancelreason != null">cancelreason,
-                    </if>
-                    <if test="cancelcode != null">cancelcode,
-                    </if>
-                    <if test="cancelname != null">cancelname,
-                    </if>
-                    <if test="visittype != null">visittype,
-                    </if>
-                    <if test="status != null">status,
-                    </if>
-                    <if test="schemetime != null">schemetime,
-                    </if>
-                    <if test="schemestatus != null">schemestatus,
-                    </if>
-                    <if test="delFlag != null">del_flag,
-                    </if>
-                    <if test="updateBy != null">update_by,
-                    </if>
-                    <if test="updateTime != null">update_time,
-                    </if>
-                    <if test="createBy != null">create_by,
-                    </if>
-                    <if test="createTime != null">create_time,
-                    </if>
-                    <if test="isupload != null">isupload,
-                    </if>
-                    <if test="uploadTime != null">upload_time,
-                    </if>
-                    <if test="orgid != null">orgid,
-                    </if>
-                    <if test="guid != null">guid,
-                    </if>
-                    <if test="pguid != null">pguid,
-                    </if>
-                    <if test="pid != null">pid,
-                    </if>
-                    <if test="inhospstate != null">inhospstate,
-                    </if>
-                    <if test="patno != null">patno,
-                    </if>
-                    <if test="patname != null">patname,
-                    </if>
-                    <if test="visitid != null">visitid,
-                    </if>
-                    <if test="serialnum != null">serialnum,
-                    </if>
-                    <if test="inhospno != null">inhospno,
-                    </if>
-                    <if test="hospitalname != null">hospitalname,
-                    </if>
-                    <if test="hospitalcode != null">hospitalcode,
-                    </if>
-                    <if test="deptid != null">deptid,
-                    </if>
-                    <if test="deptcode != null">deptcode,
-                    </if>
-                    <if test="deptname != null">deptname,
-                    </if>
-                    <if test="hospitaldistrictcode != null">hospitaldistrictcode,
-                    </if>
-                    <if test="hospitaldistrictname != null">hospitaldistrictname,
-                    </if>
-                    <if test="roomno != null">roomno,
-                    </if>
-                    <if test="bedNo != null">bed_no,
-                    </if>
-                    <if test="drcode != null">drcode,
-                    </if>
-                    <if test="drname != null">drname,
-                    </if>
-                    <if test="nurseId != null">nurse_id,
-                    </if>
-                    <if test="nurseName != null">nurse_name,
-                    </if>
+            <if test="id != null">id,
+            </if>
+            <if test="patid != null">patid,
+            </if>
+            <if test="patcode != null">patcode,
+            </if>
+            <if test="paname != null">paname,
+            </if>
+            <if test="opreqid != null">opreqid,
+            </if>
+            <if test="opreqcode != null">opreqcode,
+            </if>
+            <if test="opsstatus != null">opsstatus,
+            </if>
+            <if test="operationcode != null">operationcode,
+            </if>
+            <if test="operationname != null">operationname,
+            </if>
+            <if test="operatortime != null">operatortime,
+            </if>
+            <if test="opreqtime != null">opreqtime,
+            </if>
+            <if test="reqdoccode != null">reqdoccode,
+            </if>
+            <if test="reqdocname != null">reqdocname,
+            </if>
+            <if test="reqdeptcode != null">reqdeptcode,
+            </if>
+            <if test="reqdeptname != null">reqdeptname,
+            </if>
+            <if test="reqloccode != null">reqloccode,
+            </if>
+            <if test="reqlocname != null">reqlocname,
+            </if>
+            <if test="remark != null">remark,
+            </if>
+            <if test="surgeoncode != null">surgeoncode,
+            </if>
+            <if test="surgeonname != null">surgeonname,
+            </if>
+            <if test="firasscode != null">firasscode,
+            </if>
+            <if test="firassname != null">firassname,
+            </if>
+            <if test="secasscode != null">secasscode,
+            </if>
+            <if test="secassname != null">secassname,
+            </if>
+            <if test="thrasscode != null">thrasscode,
+            </if>
+            <if test="thrassname != null">thrassname,
+            </if>
+            <if test="canceltime != null">canceltime,
+            </if>
+            <if test="cancelreason != null">cancelreason,
+            </if>
+            <if test="cancelcode != null">cancelcode,
+            </if>
+            <if test="cancelname != null">cancelname,
+            </if>
+            <if test="visittype != null">visittype,
+            </if>
+            <if test="status != null">status,
+            </if>
+            <if test="schemetime != null">schemetime,
+            </if>
+            <if test="schemestatus != null">schemestatus,
+            </if>
+            <if test="delFlag != null">del_flag,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="updateTime != null">update_time,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="isupload != null">isupload,
+            </if>
+            <if test="uploadTime != null">upload_time,
+            </if>
+            <if test="orgid != null">orgid,
+            </if>
+            <if test="guid != null">guid,
+            </if>
+            <if test="pguid != null">pguid,
+            </if>
+            <if test="pid != null">pid,
+            </if>
+            <if test="inhospstate != null">inhospstate,
+            </if>
+            <if test="patno != null">patno,
+            </if>
+            <if test="patname != null">patname,
+            </if>
+            <if test="visitid != null">visitid,
+            </if>
+            <if test="serialnum != null">serialnum,
+            </if>
+            <if test="inhospno != null">inhospno,
+            </if>
+            <if test="hospitalname != null">hospitalname,
+            </if>
+            <if test="hospitalcode != null">hospitalcode,
+            </if>
+            <if test="deptid != null">deptid,
+            </if>
+            <if test="deptcode != null">deptcode,
+            </if>
+            <if test="deptname != null">deptname,
+            </if>
+            <if test="hospitaldistrictcode != null">hospitaldistrictcode,
+            </if>
+            <if test="hospitaldistrictname != null">hospitaldistrictname,
+            </if>
+            <if test="roomno != null">roomno,
+            </if>
+            <if test="bedNo != null">bed_no,
+            </if>
+            <if test="drcode != null">drcode,
+            </if>
+            <if test="drname != null">drname,
+            </if>
+            <if test="nurseId != null">nurse_id,
+            </if>
+            <if test="nurseName != null">nurse_name,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                    <if test="id != null">#{id},
-                    </if>
-                    <if test="patid != null">#{patid},
-                    </if>
-                    <if test="patcode != null">#{patcode},
-                    </if>
-                    <if test="paname != null">#{paname},
-                    </if>
-                    <if test="opreqid != null">#{opreqid},
-                    </if>
-                    <if test="opreqcode != null">#{opreqcode},
-                    </if>
-                    <if test="opsstatus != null">#{opsstatus},
-                    </if>
-                    <if test="operationcode != null">#{operationcode},
-                    </if>
-                    <if test="operationname != null">#{operationname},
-                    </if>
-                    <if test="operatortime != null">#{operatortime},
-                    </if>
-                    <if test="opreqtime != null">#{opreqtime},
-                    </if>
-                    <if test="reqdoccode != null">#{reqdoccode},
-                    </if>
-                    <if test="reqdocname != null">#{reqdocname},
-                    </if>
-                    <if test="reqdeptcode != null">#{reqdeptcode},
-                    </if>
-                    <if test="reqdeptname != null">#{reqdeptname},
-                    </if>
-                    <if test="reqloccode != null">#{reqloccode},
-                    </if>
-                    <if test="reqlocname != null">#{reqlocname},
-                    </if>
-                    <if test="remark != null">#{remark},
-                    </if>
-                    <if test="surgeoncode != null">#{surgeoncode},
-                    </if>
-                    <if test="surgeonname != null">#{surgeonname},
-                    </if>
-                    <if test="firasscode != null">#{firasscode},
-                    </if>
-                    <if test="firassname != null">#{firassname},
-                    </if>
-                    <if test="secasscode != null">#{secasscode},
-                    </if>
-                    <if test="secassname != null">#{secassname},
-                    </if>
-                    <if test="thrasscode != null">#{thrasscode},
-                    </if>
-                    <if test="thrassname != null">#{thrassname},
-                    </if>
-                    <if test="canceltime != null">#{canceltime},
-                    </if>
-                    <if test="cancelreason != null">#{cancelreason},
-                    </if>
-                    <if test="cancelcode != null">#{cancelcode},
-                    </if>
-                    <if test="cancelname != null">#{cancelname},
-                    </if>
-                    <if test="visittype != null">#{visittype},
-                    </if>
-                    <if test="status != null">#{status},
-                    </if>
-                    <if test="schemetime != null">#{schemetime},
-                    </if>
-                    <if test="schemestatus != null">#{schemestatus},
-                    </if>
-                    <if test="delFlag != null">#{delFlag},
-                    </if>
-                    <if test="updateBy != null">#{updateBy},
-                    </if>
-                    <if test="updateTime != null">#{updateTime},
-                    </if>
-                    <if test="createBy != null">#{createBy},
-                    </if>
-                    <if test="createTime != null">#{createTime},
-                    </if>
-                    <if test="isupload != null">#{isupload},
-                    </if>
-                    <if test="uploadTime != null">#{uploadTime},
-                    </if>
-                    <if test="orgid != null">#{orgid},
-                    </if>
-                    <if test="guid != null">#{guid},
-                    </if>
-                    <if test="pguid != null">#{pguid},
-                    </if>
-                    <if test="pid != null">#{pid},
-                    </if>
-                    <if test="inhospstate != null">#{inhospstate},
-                    </if>
-                    <if test="patno != null">#{patno},
-                    </if>
-                    <if test="patname != null">#{patname},
-                    </if>
-                    <if test="visitid != null">#{visitid},
-                    </if>
-                    <if test="serialnum != null">#{serialnum},
-                    </if>
-                    <if test="inhospno != null">#{inhospno},
-                    </if>
-                    <if test="hospitalname != null">#{hospitalname},
-                    </if>
-                    <if test="hospitalcode != null">#{hospitalcode},
-                    </if>
-                    <if test="deptid != null">#{deptid},
-                    </if>
-                    <if test="deptcode != null">#{deptcode},
-                    </if>
-                    <if test="deptname != null">#{deptname},
-                    </if>
-                    <if test="hospitaldistrictcode != null">#{hospitaldistrictcode},
-                    </if>
-                    <if test="hospitaldistrictname != null">#{hospitaldistrictname},
-                    </if>
-                    <if test="roomno != null">#{roomno},
-                    </if>
-                    <if test="bedNo != null">#{bedNo},
-                    </if>
-                    <if test="drcode != null">#{drcode},
-                    </if>
-                    <if test="drname != null">#{drname},
-                    </if>
-                    <if test="nurseId != null">#{nurseId},
-                    </if>
-                    <if test="nurseName != null">#{nurseName},
-                    </if>
+            <if test="id != null">#{id},
+            </if>
+            <if test="patid != null">#{patid},
+            </if>
+            <if test="patcode != null">#{patcode},
+            </if>
+            <if test="paname != null">#{paname},
+            </if>
+            <if test="opreqid != null">#{opreqid},
+            </if>
+            <if test="opreqcode != null">#{opreqcode},
+            </if>
+            <if test="opsstatus != null">#{opsstatus},
+            </if>
+            <if test="operationcode != null">#{operationcode},
+            </if>
+            <if test="operationname != null">#{operationname},
+            </if>
+            <if test="operatortime != null">#{operatortime},
+            </if>
+            <if test="opreqtime != null">#{opreqtime},
+            </if>
+            <if test="reqdoccode != null">#{reqdoccode},
+            </if>
+            <if test="reqdocname != null">#{reqdocname},
+            </if>
+            <if test="reqdeptcode != null">#{reqdeptcode},
+            </if>
+            <if test="reqdeptname != null">#{reqdeptname},
+            </if>
+            <if test="reqloccode != null">#{reqloccode},
+            </if>
+            <if test="reqlocname != null">#{reqlocname},
+            </if>
+            <if test="remark != null">#{remark},
+            </if>
+            <if test="surgeoncode != null">#{surgeoncode},
+            </if>
+            <if test="surgeonname != null">#{surgeonname},
+            </if>
+            <if test="firasscode != null">#{firasscode},
+            </if>
+            <if test="firassname != null">#{firassname},
+            </if>
+            <if test="secasscode != null">#{secasscode},
+            </if>
+            <if test="secassname != null">#{secassname},
+            </if>
+            <if test="thrasscode != null">#{thrasscode},
+            </if>
+            <if test="thrassname != null">#{thrassname},
+            </if>
+            <if test="canceltime != null">#{canceltime},
+            </if>
+            <if test="cancelreason != null">#{cancelreason},
+            </if>
+            <if test="cancelcode != null">#{cancelcode},
+            </if>
+            <if test="cancelname != null">#{cancelname},
+            </if>
+            <if test="visittype != null">#{visittype},
+            </if>
+            <if test="status != null">#{status},
+            </if>
+            <if test="schemetime != null">#{schemetime},
+            </if>
+            <if test="schemestatus != null">#{schemestatus},
+            </if>
+            <if test="delFlag != null">#{delFlag},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="isupload != null">#{isupload},
+            </if>
+            <if test="uploadTime != null">#{uploadTime},
+            </if>
+            <if test="orgid != null">#{orgid},
+            </if>
+            <if test="guid != null">#{guid},
+            </if>
+            <if test="pguid != null">#{pguid},
+            </if>
+            <if test="pid != null">#{pid},
+            </if>
+            <if test="inhospstate != null">#{inhospstate},
+            </if>
+            <if test="patno != null">#{patno},
+            </if>
+            <if test="patname != null">#{patname},
+            </if>
+            <if test="visitid != null">#{visitid},
+            </if>
+            <if test="serialnum != null">#{serialnum},
+            </if>
+            <if test="inhospno != null">#{inhospno},
+            </if>
+            <if test="hospitalname != null">#{hospitalname},
+            </if>
+            <if test="hospitalcode != null">#{hospitalcode},
+            </if>
+            <if test="deptid != null">#{deptid},
+            </if>
+            <if test="deptcode != null">#{deptcode},
+            </if>
+            <if test="deptname != null">#{deptname},
+            </if>
+            <if test="hospitaldistrictcode != null">#{hospitaldistrictcode},
+            </if>
+            <if test="hospitaldistrictname != null">#{hospitaldistrictname},
+            </if>
+            <if test="roomno != null">#{roomno},
+            </if>
+            <if test="bedNo != null">#{bedNo},
+            </if>
+            <if test="drcode != null">#{drcode},
+            </if>
+            <if test="drname != null">#{drname},
+            </if>
+            <if test="nurseId != null">#{nurseId},
+            </if>
+            <if test="nurseName != null">#{nurseName},
+            </if>
         </trim>
     </insert>
 
     <update id="updatePatMedOperation" parameterType="com.smartor.domain.PatMedOperation">
         update pat_med_operation
         <trim prefix="SET" suffixOverrides=",">
-                    <if test="patid != null">patid =
-                        #{patid},
-                    </if>
-                    <if test="patcode != null">patcode =
-                        #{patcode},
-                    </if>
-                    <if test="paname != null">paname =
-                        #{paname},
-                    </if>
-                    <if test="opreqid != null">opreqid =
-                        #{opreqid},
-                    </if>
-                    <if test="opreqcode != null">opreqcode =
-                        #{opreqcode},
-                    </if>
-                    <if test="opsstatus != null">opsstatus =
-                        #{opsstatus},
-                    </if>
-                    <if test="operationcode != null">operationcode =
-                        #{operationcode},
-                    </if>
-                    <if test="operationname != null">operationname =
-                        #{operationname},
-                    </if>
-                    <if test="operatortime != null">operatortime =
-                        #{operatortime},
-                    </if>
-                    <if test="opreqtime != null">opreqtime =
-                        #{opreqtime},
-                    </if>
-                    <if test="reqdoccode != null">reqdoccode =
-                        #{reqdoccode},
-                    </if>
-                    <if test="reqdocname != null">reqdocname =
-                        #{reqdocname},
-                    </if>
-                    <if test="reqdeptcode != null">reqdeptcode =
-                        #{reqdeptcode},
-                    </if>
-                    <if test="reqdeptname != null">reqdeptname =
-                        #{reqdeptname},
-                    </if>
-                    <if test="reqloccode != null">reqloccode =
-                        #{reqloccode},
-                    </if>
-                    <if test="reqlocname != null">reqlocname =
-                        #{reqlocname},
-                    </if>
-                    <if test="remark != null">remark =
-                        #{remark},
-                    </if>
-                    <if test="surgeoncode != null">surgeoncode =
-                        #{surgeoncode},
-                    </if>
-                    <if test="surgeonname != null">surgeonname =
-                        #{surgeonname},
-                    </if>
-                    <if test="firasscode != null">firasscode =
-                        #{firasscode},
-                    </if>
-                    <if test="firassname != null">firassname =
-                        #{firassname},
-                    </if>
-                    <if test="secasscode != null">secasscode =
-                        #{secasscode},
-                    </if>
-                    <if test="secassname != null">secassname =
-                        #{secassname},
-                    </if>
-                    <if test="thrasscode != null">thrasscode =
-                        #{thrasscode},
-                    </if>
-                    <if test="thrassname != null">thrassname =
-                        #{thrassname},
-                    </if>
-                    <if test="canceltime != null">canceltime =
-                        #{canceltime},
-                    </if>
-                    <if test="cancelreason != null">cancelreason =
-                        #{cancelreason},
-                    </if>
-                    <if test="cancelcode != null">cancelcode =
-                        #{cancelcode},
-                    </if>
-                    <if test="cancelname != null">cancelname =
-                        #{cancelname},
-                    </if>
-                    <if test="visittype != null">visittype =
-                        #{visittype},
-                    </if>
-                    <if test="status != null">status =
-                        #{status},
-                    </if>
-                    <if test="schemetime != null">schemetime =
-                        #{schemetime},
-                    </if>
-                    <if test="schemestatus != null">schemestatus =
-                        #{schemestatus},
-                    </if>
-                    <if test="delFlag != null">del_flag =
-                        #{delFlag},
-                    </if>
-                    <if test="updateBy != null">update_by =
-                        #{updateBy},
-                    </if>
-                    <if test="updateTime != null">update_time =
-                        #{updateTime},
-                    </if>
-                    <if test="createBy != null">create_by =
-                        #{createBy},
-                    </if>
-                    <if test="createTime != null">create_time =
-                        #{createTime},
-                    </if>
-                    <if test="isupload != null">isupload =
-                        #{isupload},
-                    </if>
-                    <if test="uploadTime != null">upload_time =
-                        #{uploadTime},
-                    </if>
-                    <if test="orgid != null">orgid =
-                        #{orgid},
-                    </if>
-                    <if test="guid != null">guid =
-                        #{guid},
-                    </if>
-                    <if test="pguid != null">pguid =
-                        #{pguid},
-                    </if>
-                    <if test="pid != null">pid =
-                        #{pid},
-                    </if>
-                    <if test="inhospstate != null">inhospstate =
-                        #{inhospstate},
-                    </if>
-                    <if test="patno != null">patno =
-                        #{patno},
-                    </if>
-                    <if test="patname != null">patname =
-                        #{patname},
-                    </if>
-                    <if test="visitid != null">visitid =
-                        #{visitid},
-                    </if>
-                    <if test="serialnum != null">serialnum =
-                        #{serialnum},
-                    </if>
-                    <if test="inhospno != null">inhospno =
-                        #{inhospno},
-                    </if>
-                    <if test="hospitalname != null">hospitalname =
-                        #{hospitalname},
-                    </if>
-                    <if test="hospitalcode != null">hospitalcode =
-                        #{hospitalcode},
-                    </if>
-                    <if test="deptid != null">deptid =
-                        #{deptid},
-                    </if>
-                    <if test="deptcode != null">deptcode =
-                        #{deptcode},
-                    </if>
-                    <if test="deptname != null">deptname =
-                        #{deptname},
-                    </if>
-                    <if test="hospitaldistrictcode != null">hospitaldistrictcode =
-                        #{hospitaldistrictcode},
-                    </if>
-                    <if test="hospitaldistrictname != null">hospitaldistrictname =
-                        #{hospitaldistrictname},
-                    </if>
-                    <if test="roomno != null">roomno =
-                        #{roomno},
-                    </if>
-                    <if test="bedNo != null">bed_no =
-                        #{bedNo},
-                    </if>
-                    <if test="drcode != null">drcode =
-                        #{drcode},
-                    </if>
-                    <if test="drname != null">drname =
-                        #{drname},
-                    </if>
-                    <if test="nurseId != null">nurse_id =
-                        #{nurseId},
-                    </if>
-                    <if test="nurseName != null">nurse_name =
-                        #{nurseName},
-                    </if>
+            <if test="patid != null">patid =
+                #{patid},
+            </if>
+            <if test="patcode != null">patcode =
+                #{patcode},
+            </if>
+            <if test="paname != null">paname =
+                #{paname},
+            </if>
+            <if test="opreqid != null">opreqid =
+                #{opreqid},
+            </if>
+            <if test="opreqcode != null">opreqcode =
+                #{opreqcode},
+            </if>
+            <if test="opsstatus != null">opsstatus =
+                #{opsstatus},
+            </if>
+            <if test="operationcode != null">operationcode =
+                #{operationcode},
+            </if>
+            <if test="operationname != null">operationname =
+                #{operationname},
+            </if>
+            <if test="operatortime != null">operatortime =
+                #{operatortime},
+            </if>
+            <if test="opreqtime != null">opreqtime =
+                #{opreqtime},
+            </if>
+            <if test="reqdoccode != null">reqdoccode =
+                #{reqdoccode},
+            </if>
+            <if test="reqdocname != null">reqdocname =
+                #{reqdocname},
+            </if>
+            <if test="reqdeptcode != null">reqdeptcode =
+                #{reqdeptcode},
+            </if>
+            <if test="reqdeptname != null">reqdeptname =
+                #{reqdeptname},
+            </if>
+            <if test="reqloccode != null">reqloccode =
+                #{reqloccode},
+            </if>
+            <if test="reqlocname != null">reqlocname =
+                #{reqlocname},
+            </if>
+            <if test="remark != null">remark =
+                #{remark},
+            </if>
+            <if test="surgeoncode != null">surgeoncode =
+                #{surgeoncode},
+            </if>
+            <if test="surgeonname != null">surgeonname =
+                #{surgeonname},
+            </if>
+            <if test="firasscode != null">firasscode =
+                #{firasscode},
+            </if>
+            <if test="firassname != null">firassname =
+                #{firassname},
+            </if>
+            <if test="secasscode != null">secasscode =
+                #{secasscode},
+            </if>
+            <if test="secassname != null">secassname =
+                #{secassname},
+            </if>
+            <if test="thrasscode != null">thrasscode =
+                #{thrasscode},
+            </if>
+            <if test="thrassname != null">thrassname =
+                #{thrassname},
+            </if>
+            <if test="canceltime != null">canceltime =
+                #{canceltime},
+            </if>
+            <if test="cancelreason != null">cancelreason =
+                #{cancelreason},
+            </if>
+            <if test="cancelcode != null">cancelcode =
+                #{cancelcode},
+            </if>
+            <if test="cancelname != null">cancelname =
+                #{cancelname},
+            </if>
+            <if test="visittype != null">visittype =
+                #{visittype},
+            </if>
+            <if test="status != null">status =
+                #{status},
+            </if>
+            <if test="schemetime != null">schemetime =
+                #{schemetime},
+            </if>
+            <if test="schemestatus != null">schemestatus =
+                #{schemestatus},
+            </if>
+            <if test="delFlag != null">del_flag =
+                #{delFlag},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="updateTime != null">update_time =
+                #{updateTime},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="isupload != null">isupload =
+                #{isupload},
+            </if>
+            <if test="uploadTime != null">upload_time =
+                #{uploadTime},
+            </if>
+            <if test="orgid != null">orgid =
+                #{orgid},
+            </if>
+            <if test="guid != null">guid =
+                #{guid},
+            </if>
+            <if test="pguid != null">pguid =
+                #{pguid},
+            </if>
+            <if test="pid != null">pid =
+                #{pid},
+            </if>
+            <if test="inhospstate != null">inhospstate =
+                #{inhospstate},
+            </if>
+            <if test="patno != null">patno =
+                #{patno},
+            </if>
+            <if test="patname != null">patname =
+                #{patname},
+            </if>
+            <if test="visitid != null">visitid =
+                #{visitid},
+            </if>
+            <if test="serialnum != null">serialnum =
+                #{serialnum},
+            </if>
+            <if test="inhospno != null">inhospno =
+                #{inhospno},
+            </if>
+            <if test="hospitalname != null">hospitalname =
+                #{hospitalname},
+            </if>
+            <if test="hospitalcode != null">hospitalcode =
+                #{hospitalcode},
+            </if>
+            <if test="deptid != null">deptid =
+                #{deptid},
+            </if>
+            <if test="deptcode != null">deptcode =
+                #{deptcode},
+            </if>
+            <if test="deptname != null">deptname =
+                #{deptname},
+            </if>
+            <if test="hospitaldistrictcode != null">hospitaldistrictcode =
+                #{hospitaldistrictcode},
+            </if>
+            <if test="hospitaldistrictname != null">hospitaldistrictname =
+                #{hospitaldistrictname},
+            </if>
+            <if test="roomno != null">roomno =
+                #{roomno},
+            </if>
+            <if test="bedNo != null">bed_no =
+                #{bedNo},
+            </if>
+            <if test="drcode != null">drcode =
+                #{drcode},
+            </if>
+            <if test="drname != null">drname =
+                #{drname},
+            </if>
+            <if test="nurseId != null">nurse_id =
+                #{nurseId},
+            </if>
+            <if test="nurseName != null">nurse_name =
+                #{nurseName},
+            </if>
         </trim>
         where id = #{id}
     </update>
 
-                <update id="deletePatMedOperationById" parameterType="Long">
+    <update id="deletePatMedOperationById" parameterType="Long">
         update pat_med_operation
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
-        where  id = #{id}
+        where id = #{id}
     </update>
 
-                            <update id="deletePatMedOperationByIds" parameterType="String">
-        update  pat_med_operation
+    <update id="deletePatMedOperationByIds" parameterType="String">
+        update pat_med_operation
         <trim prefix="SET" suffixOverrides=",">
             del_flag =1
         </trim>
@@ -739,8 +803,6 @@
             #{id}
         </foreach>
     </update>
-
-
 
 
 </mapper>

--
Gitblit v1.9.3