From 37022a5aa114261dcb9e4f312b07c6e029f59e24 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期五, 08 十二月 2023 11:28:27 +0800
Subject: [PATCH] 1.治疗单新增字段

---
 phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java      |   10 +++++++---
 phi_platform_common/src/main/resources/mapper/platform/TreatSingleMapper.xml           |   10 +++++-----
 phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java |   21 ++++++++++++++++++---
 3 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/phi_platform_common/src/main/resources/mapper/platform/TreatSingleMapper.xml b/phi_platform_common/src/main/resources/mapper/platform/TreatSingleMapper.xml
index 72d88a2..2b19f42 100644
--- a/phi_platform_common/src/main/resources/mapper/platform/TreatSingleMapper.xml
+++ b/phi_platform_common/src/main/resources/mapper/platform/TreatSingleMapper.xml
@@ -8,7 +8,7 @@
 	<!-- 鏁翠釜瀹炰綋绫讳慨鏀癸紝琛ㄥ瓧娈�=瀹炰綋绫诲瓧娈�-->
 	<sql id="Update_Column_All">
 		<trim prefixOverrides=",">
-			,type = #{type},commonId = #{commonId},signData = #{signData},treatData = #{treatData},shopId = #{shopId},shopName = #{shopName},operatorId = #{operatorId},operatorName = #{operatorName},developerShopId = #{developerShopId},developerShopName = #{developerShopName},developerId = #{developerId},developerName = #{developerName},remarkInfo = #{remarkInfo},status = #{status},isLedProduct = #{isLedProduct},treatSingleNo = #{treatSingleNo},visitOrderId = #{visitOrderId},userConsultantId = #{userConsultantId},userConsultantName = #{userConsultantName},orderClassify = #{orderClassify},isKnow = #{isKnow},drugStatus = #{drugStatus},userId = #{userId},allergyInfo = #{allergyInfo},isWillPhoto = #{isWillPhoto},isFirstFm = #{isFirstFm},isRd = #{isRd},anStatus = #{anStatus},aDoctorId = #{aDoctorId},aDoctorName = #{aDoctorName},aNurseId = #{aNurseId},aNurseName = #{aNurseName},aMicId = #{aMicId},aRemark = #{aRemark},roomName = #{roomName},aTime = #{aTime},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
+			,type = #{type},commonId = #{commonId},signData = #{signData},treatData = #{treatData},shopId = #{shopId},shopName = #{shopName},operatorId = #{operatorId},operatorName = #{operatorName},developerShopId = #{developerShopId},developerShopName = #{developerShopName},developerId = #{developerId},developerName = #{developerName},remarkInfo = #{remarkInfo},status = #{status},isLedProduct = #{isLedProduct},treatSingleNo = #{treatSingleNo},visitOrderId = #{visitOrderId},userConsultantId = #{userConsultantId},userConsultantName = #{userConsultantName},orderClassify = #{orderClassify},isKnow = #{isKnow},drugStatus = #{drugStatus},userId = #{userId},allergyInfo = #{allergyInfo},isWillPhoto = #{isWillPhoto},isFirstFm = #{isFirstFm},isRd = #{isRd},isUserSign = #{isUserSign},anStatus = #{anStatus},aDoctorId = #{aDoctorId},aDoctorName = #{aDoctorName},aNurseId = #{aNurseId},aNurseName = #{aNurseName},aMicId = #{aMicId},aRemark = #{aRemark},roomName = #{roomName},aTime = #{aTime},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
 		</trim>
 	</sql>
 	 
@@ -19,11 +19,11 @@
 	    <selectKey keyProperty="id" resultType="String" order="BEFORE">
                select replace(uuid(),'-','') from dual
         </selectKey>
-        insert into treat_single (id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime)  values (#{id},#{type},#{commonId},#{signData},#{treatData},#{shopId},#{shopName},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{remarkInfo},#{status},#{isLedProduct},#{treatSingleNo},#{visitOrderId},#{userConsultantId},#{userConsultantName},#{orderClassify},#{isKnow},#{drugStatus},#{userId},#{allergyInfo},#{isWillPhoto},#{isFirstFm},#{isRd},#{anStatus},#{aDoctorId},#{aDoctorName},#{aNurseId},#{aNurseName},#{aMicId},#{aRemark},#{roomName},#{aTime},#{isDel},#{createTime},#{editTime})
+        insert into treat_single (id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,isUserSign,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime)  values (#{id},#{type},#{commonId},#{signData},#{treatData},#{shopId},#{shopName},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{remarkInfo},#{status},#{isLedProduct},#{treatSingleNo},#{visitOrderId},#{userConsultantId},#{userConsultantName},#{orderClassify},#{isKnow},#{drugStatus},#{userId},#{allergyInfo},#{isWillPhoto},#{isFirstFm},#{isRd},#{isUserSign},#{anStatus},#{aDoctorId},#{aDoctorName},#{aNurseId},#{aNurseName},#{aMicId},#{aRemark},#{roomName},#{aTime},#{isDel},#{createTime},#{editTime})
 	</insert>
 
 	<insert id="insertById" parameterType="com.hx.phiappt.model.treat.TreatSingle">
-        insert into treat_single (id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime)  values (#{id},#{type},#{commonId},#{signData},#{treatData},#{shopId},#{shopName},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{remarkInfo},#{status},#{isLedProduct},#{treatSingleNo},#{visitOrderId},#{userConsultantId},#{userConsultantName},#{orderClassify},#{isKnow},#{drugStatus},#{userId},#{allergyInfo},#{isWillPhoto},#{isFirstFm},#{isRd},#{anStatus},#{aDoctorId},#{aDoctorName},#{aNurseId},#{aNurseName},#{aMicId},#{aRemark},#{roomName},#{aTime},#{isDel},#{createTime},#{editTime})
+        insert into treat_single (id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,isUserSign,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime)  values (#{id},#{type},#{commonId},#{signData},#{treatData},#{shopId},#{shopName},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{remarkInfo},#{status},#{isLedProduct},#{treatSingleNo},#{visitOrderId},#{userConsultantId},#{userConsultantName},#{orderClassify},#{isKnow},#{drugStatus},#{userId},#{allergyInfo},#{isWillPhoto},#{isFirstFm},#{isRd},#{isUserSign},#{anStatus},#{aDoctorId},#{aDoctorName},#{aNurseId},#{aNurseName},#{aMicId},#{aRemark},#{roomName},#{aTime},#{isDel},#{createTime},#{editTime})
     </insert>
 
 	<select id="selectList" resultType="com.hx.phiappt.model.treat.TreatSingle" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
 
 	<select id="selectOneByKey" resultType="com.hx.phiappt.model.treat.TreatSingle" parameterType="java.lang.Object" >
 		select 
-			id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime
+			id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,isUserSign,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime
 		from treat_single
 		WHERE id = #{value}
 	</select>
 
 	<select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.treat.TreatSingle" parameterType="java.lang.Object" >
 		select 
-			id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime
+			id,type,commonId,signData,treatData,shopId,shopName,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,remarkInfo,status,isLedProduct,treatSingleNo,visitOrderId,userConsultantId,userConsultantName,orderClassify,isKnow,drugStatus,userId,allergyInfo,isWillPhoto,isFirstFm,isRd,isUserSign,anStatus,aDoctorId,aDoctorName,aNurseId,aNurseName,aMicId,aRemark,roomName,aTime,isDel,createTime,editTime
 		from treat_single
 		WHERE id = #{value}
 	</select>
diff --git a/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java b/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java
index 35b4790..87db2a7 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/controller/treat/TreatController.java
@@ -121,6 +121,8 @@
         treatSingle.setUserId(visitOrder.getUserId());
 
 
+
+
         treatV3Service.add(treatSingle, projectList, visitOrder, employeeRole, isMicNotice, signList);
 
         //杩斿洖id
@@ -285,7 +287,7 @@
             throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "鏌ヨ涓嶅埌娌荤枟閫氱煡鍗曚俊鎭紒");
         }
 
-        checkSignParam(reqVo.getSignList());
+        checkSignParam(reqVo.getSignList(), treatSingle);
 
         treatV3Service.updateSign(treatSingle, reqVo.getSignList(), employeeRole);
 
@@ -577,14 +579,15 @@
 
         //鏍¢獙绛惧悕鍙傛暟----------------------------------------------------------------------------------
         if(signList != null && signList.size() > 0){
-            checkSignParam(signList);
+            checkSignParam(signList, treatSingle);
         }
 
         //----------------------------------------------------------------------------------
     }
 
     /** 妫�娴嬫牎楠屾不鐤楀崟绛惧悕鍙傛暟 */
-    private void checkSignParam(List<TreatSingleSign> signList){
+    private void checkSignParam(List<TreatSingleSign> signList, TreatSingle treatSingle){
+        treatSingle.setIsUserSign(BaseEntity.NO);
         for(TreatSingleSign sign : signList){
             if(StringUtils.isEmpty(sign.getSignImg())){
                 throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"绛惧悕鍥剧墖涓嶈兘涓虹┖锛�");
@@ -599,6 +602,7 @@
             //鍒ゆ柇绫诲瀷锛屾洿鏀瑰搴斿��
             if(TreatSingleSign.SIGN_PER_TYPE_USER.equals(sign.getSignPerType())){
                 sign.setSortNo(1);
+                treatSingle.setIsUserSign(BaseEntity.YES);
             }else if(TreatSingleSign.SIGN_PER_TYPE_NURSE1.equals(sign.getSignPerType())){
                 sign.setSortNo(2);
             }else if(TreatSingleSign.SIGN_PER_TYPE_NURSE2.equals(sign.getSignPerType())){
diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java
index 28dfdde..b5cffdc 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java
@@ -256,13 +256,14 @@
         values.put("allergyInfo", treatSingle.getAllergyInfo());
         values.put("isFirstFm", treatSingle.getIsFirstFm());
         values.put("isRd", treatSingle.getIsRd());
+        values.put("isUserSign", treatSingle.getIsUserSign());
         sql.delete(0,sql.length());
         //operatorName = #{m.operatorName},operatorId = #{m.operatorId},
         sql.append(" developerName = #{m.developerName},developerId = #{m.developerId},remarkInfo = #{m.remarkInfo} ");
         sql.append(" ,developerShopName = #{m.developerShopName},developerShopId = #{m.developerShopId} ");
         sql.append(" ,shopName = #{m.shopName},shopId = #{m.shopId},status = #{m.status} ");
         sql.append(" , orderClassify  = #{m.orderClassify}, isWillPhoto  = #{m.isWillPhoto}, allergyInfo  = #{m.allergyInfo} ");
-        sql.append(" , isFirstFm = #{m.isFirstFm}, isRd = #{m.isRd} ");
+        sql.append(" , isFirstFm = #{m.isFirstFm}, isRd = #{m.isRd}, isisUserSign = #{m.isUserSign} ");
         sql.append(" where id = #{m.id} ");
         sqlSentence.setSqlSentence(sql.toString());
         if (treatSingleMapper.updateWhere(sqlSentence) != 1) {
@@ -403,7 +404,7 @@
         TreatSingleSign oldSign;
         StringBuffer logInfo = new StringBuffer();
         logInfo.append("鏇存柊绛惧悕绫诲瀷锛�");
-
+        Integer isUseSign = treatSingle.getIsUserSign();
         for(TreatSingleSign sign : signList){
 
             //绫诲瀷
@@ -418,12 +419,26 @@
                 throw new TipsException("鏂板娌荤枟鍗曠鍚嶅け璐ワ紒");
             }
 
+            //鍒ゆ柇鐢ㄦ埛鏄惁绛惧悕
+            if(TreatSingleSign.SIGN_PER_TYPE_USER.equals(sign.getSignPerType())){
+                isUseSign = BaseEntity.YES;
+            }
+
+
             //鎷兼帴鏃ュ織
             logInfo.append(TreatSingleSign.signPerTypeCh(sign.getSignPerType())).append("銆�");
         }
-
         logInfo.delete(logInfo.length() - 1, logInfo.length());
 
+        //鏇存柊娌荤枟鍗曟槸鍚︾敤鎴峰凡绛惧悕
+        if(treatSingle.getIsUserSign() == BaseEntity.NO && isUseSign == BaseEntity.YES){
+            values.put("id", treatSingle.getId());
+            sqlSentence.setSqlSentence(" isUseSign = 1 where id = #{m.id} ");
+            if(treatSingleMapper.updateWhere(sqlSentence) != 1){
+                throw new TipsException("鏇存柊娌荤枟鍗曠鍚嶅け璐ワ紒");
+            }
+        }
+
         //鏂板娌荤枟鍗曟棩蹇�
         TreatSingleLogTool.addLog(commonService, TreatSingleConstants.LOG_TYPE_EDIT_SIGN, treatSingle, employeeRole, logInfo.toString());
 

--
Gitblit v1.8.0