Browse Source

库存调拨修改

28169 2 years ago
parent
commit
a65599b73c

+ 11 - 9
controllers/dialysis_api_controller.go View File

@@ -445,7 +445,7 @@ func (c *DialysisApiController) PostPrescription() {
445 445
 	}
446 446
 
447 447
 	//长沙南雅医院,自动生成抗凝剂的临时处方
448
-	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 {
448
+	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
449 449
 		advice := models.DoctorAdvice{
450 450
 			UserOrgId:             adminUserInfo.CurrentOrgId,
451 451
 			PatientId:             patient,
@@ -521,7 +521,8 @@ func (c *DialysisApiController) PostPrescription() {
521 521
 			advice.AdviceName = "无抗凝剂"
522 522
 			break
523 523
 		}
524
-		advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
524
+		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
525
+
525 526
 		if appRole.UserType == 2 || appRole.UserType == 1 {
526 527
 			advice.AdviceDoctor = appRole.AdminUserId
527 528
 		}
@@ -1141,7 +1142,7 @@ func (c *DialysisApiController) PostSoulution() {
1141 1142
 	service.UpdateDialysisSolutionStatusTwo(dialysisSolution.ID, dialysisSolution.ModeId, dialysisSolution.UserOrgId, dialysisSolution.PatientId)
1142 1143
 
1143 1144
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1144
-	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 {
1145
+	if adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 10340 {
1145 1146
 		advice := models.DoctorAdvice{
1146 1147
 			UserOrgId:             adminUserInfo.CurrentOrgId,
1147 1148
 			PatientId:             patient,
@@ -1217,7 +1218,7 @@ func (c *DialysisApiController) PostSoulution() {
1217 1218
 			advice.AdviceName = "无抗凝剂"
1218 1219
 			break
1219 1220
 		}
1220
-		advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1221
+		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1221 1222
 		if appRole.UserType == 2 || appRole.UserType == 1 {
1222 1223
 			advice.AdviceDoctor = appRole.AdminUserId
1223 1224
 		}
@@ -1225,17 +1226,18 @@ func (c *DialysisApiController) PostSoulution() {
1225 1226
 		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
1226 1227
 		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
1227 1228
 
1228
-		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 5 || anticoagulant == 7) {
1229
-			advice.AdviceName = "低分子肝素注射液"
1229
+		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
1230
+			advice.AdviceName = "低分子肝素注射液"
1230 1231
 			// 修改患者临时医嘱里的抗凝剂医嘱
1231 1232
 			advice.ID = advicePrescription.ID
1232 1233
 			service.UpdateDoctorAdvice(&advice)
1233 1234
 		} else {
1234 1235
 			// 新增患者临时医嘱里的抗凝剂医嘱
1235
-			if anticoagulant == 3 || anticoagulant == 5 || anticoagulant == 7 {
1236
-				advice.AdviceName = "低分子肝素钙注射液"
1236
+			if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
1237
+				advice.AdviceName = "低分子肝素钠注射液"
1238
+				service.CreateDoctorAdvice(&advice)
1237 1239
 			}
1238
-			service.CreateDoctorAdvice(&advice)
1240
+
1239 1241
 		}
1240 1242
 
1241 1243
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"

+ 48 - 11
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1657,7 +1657,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1657 1657
 		err := service.AddSigleRecord(&prescription)
1658 1658
 
1659 1659
 		//长沙南雅医院,自动生成抗凝剂的临时处方
1660
-		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 {
1660
+		if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
1661 1661
 			advice := models.DoctorAdvice{
1662 1662
 				UserOrgId:             adminUserInfo.Org.Id,
1663 1663
 				PatientId:             id,
@@ -1733,7 +1733,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1733 1733
 				advice.AdviceName = "无抗凝剂"
1734 1734
 				break
1735 1735
 			}
1736
-			advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1736
+			//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
1737 1737
 			if appRole.UserType == 2 || appRole.UserType == 1 {
1738 1738
 				advice.AdviceDoctor = appRole.AdminUserId
1739 1739
 			}
@@ -1748,9 +1748,10 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1748 1748
 			} else {
1749 1749
 				if anticoagulant == 3 || anticoagulant == 5 || anticoagulant == 7 {
1750 1750
 					advice.AdviceName = "低分子肝素钠注射液"
1751
+					// 新增患者临时医嘱里的抗凝剂医嘱
1752
+					service.CreateDoctorAdvice(&advice)
1751 1753
 				}
1752
-				// 新增患者临时医嘱里的抗凝剂医嘱
1753
-				service.CreateDoctorAdvice(&advice)
1754
+
1754 1755
 			}
1755 1756
 
1756 1757
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
@@ -2747,7 +2748,7 @@ func (this *DialysisAPIController) StartDialysis() {
2747 2748
 
2748 2749
 	// 如果当天有插入数据,则不再往透析纪录里插入数据
2749 2750
 	if newdialysisRecord.ID > 0 {
2750
-		if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 9675 {
2751
+		if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 {
2751 2752
 			record.Temperature = 36.5
2752 2753
 			record.ArterialPressure = -100
2753 2754
 			record.DialysateTemperature = 36.5
@@ -2755,6 +2756,7 @@ func (this *DialysisAPIController) StartDialysis() {
2755 2756
 			record.BreathingRate = "20"
2756 2757
 			record.VenousPressure = 80
2757 2758
 			record.TransmembranePressure = 60
2759
+			record.Dispose = catheter_operation
2758 2760
 		}
2759 2761
 		//针对新化博翔
2760 2762
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10447 {
@@ -3210,7 +3212,7 @@ func (c *DialysisAPIController) PostSolution() {
3210 3212
 	service.UpdateDialysisSolutionStatusTwo(dialysisSolution.ID, dialysisSolution.ModeId, dialysisSolution.UserOrgId, dialysisSolution.PatientId)
3211 3213
 
3212 3214
 	//长沙南雅医院,自动生成抗凝剂的临时处方
3213
-	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 {
3215
+	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 {
3214 3216
 		advice := models.DoctorAdvice{
3215 3217
 			UserOrgId:             adminUserInfo.Org.Id,
3216 3218
 			PatientId:             id,
@@ -3286,7 +3288,7 @@ func (c *DialysisAPIController) PostSolution() {
3286 3288
 			advice.AdviceName = "无抗凝剂"
3287 3289
 			break
3288 3290
 		}
3289
-		advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
3291
+		//advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
3290 3292
 		if appRole.UserType == 2 || appRole.UserType == 1 {
3291 3293
 			advice.AdviceDoctor = appRole.AdminUserId
3292 3294
 		}
@@ -3294,13 +3296,18 @@ func (c *DialysisAPIController) PostSolution() {
3294 3296
 		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
3295 3297
 		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.Org.Id, id, recordDate.Unix())
3296 3298
 
3297
-		if advicePrescription.ID > 0 {
3299
+		if advicePrescription.ID > 0 && (anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7) {
3300
+
3301
+			advice.AdviceName = "低分子肝素钠注射液"
3298 3302
 			// 修改患者临时医嘱里的抗凝剂医嘱
3299 3303
 			advice.ID = advicePrescription.ID
3300 3304
 			service.UpdateDoctorAdvice(&advice)
3301 3305
 		} else {
3302
-			// 新增患者临时医嘱里的抗凝剂医嘱
3303
-			service.CreateDoctorAdvice(&advice)
3306
+			if anticoagulant == 3 || anticoagulant == 6 || anticoagulant == 7 {
3307
+				advice.AdviceName = "低分子肝素钠注射液"
3308
+				service.CreateDoctorAdvice(&advice)
3309
+			}
3310
+
3304 3311
 		}
3305 3312
 
3306 3313
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":doctor_advices"
@@ -3561,7 +3568,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3561 3568
 	}
3562 3569
 	//长沙南雅累计血容量自动计算
3563 3570
 	if adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 9671 {
3564
-		record.AccumulatedBloodVolume = record.BloodFlowVolume * (math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * 60) / 1000
3571
+		record.AccumulatedBloodVolume = (record.BloodFlowVolume - 25) * (math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * 60) / 1000
3565 3572
 	}
3566 3573
 
3567 3574
 	if template.TemplateId == 47 || template.TemplateId == 54 {
@@ -8139,3 +8146,33 @@ func (this *DialysisAPIController) CheckSchedule() {
8139 8146
 	}
8140 8147
 
8141 8148
 }
8149
+
8150
+func (this *DialysisAPIController) GetNewDoctorListToday() {
8151
+
8152
+	orgId := this.GetMobileAdminUserInfo().Org.Id
8153
+
8154
+	schedule_type, _ := this.GetInt64("schedule_type")
8155
+
8156
+	partion_type, _ := this.GetInt64("partion_type")
8157
+
8158
+	start_time := this.GetString("start_time")
8159
+	timeLayout := "2006-01-02"
8160
+	loc, _ := time.LoadLocation("Local")
8161
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8162
+	list, err := service.GetDialysisAdviceSchedulist(orgId, schedule_type, partion_type, startTime.Unix())
8163
+	_, config := service.FindXTHisRecordByOrgId(orgId)
8164
+	appId := this.GetMobileAdminUserInfo().App.Id
8165
+	doctorList, _ := service.GetAllAdminUsers(orgId, appId)
8166
+	if err == nil {
8167
+		this.ServeSuccessJSON(map[string]interface{}{
8168
+			"list":       list,
8169
+			"config":     config,
8170
+			"doctorList": doctorList,
8171
+		})
8172
+		return
8173
+
8174
+	} else {
8175
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
8176
+		return
8177
+	}
8178
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

@@ -188,4 +188,6 @@ func MobileAPIControllersRegisterRouters() {
188 188
 	beego.Router("/m/api/settlemobileadvice", &DialysisAPIController{}, "Get:GetSettleMobileAdvice")
189 189
 
190 190
 	beego.Router("/m/api/checkmobileadvice", &DialysisAPIController{}, "Get:GetCheckMobileAdvice")
191
+
192
+	beego.Router("/m/api/getnewdoctorlisttoday", &DialysisAPIController{}, "Get:GetNewDoctorListToday")
191 193
 }

+ 4 - 3
models/device_models.go View File

@@ -110,6 +110,7 @@ type DeviceZone struct {
110 110
 	CreateTime int64  `gorm:"column:ctime" json:"-"`
111 111
 	ModifyTime int64  `gorm:"column:mtime" json:"-"`
112 112
 	Status     int64  `gorm:"column:status" json:"status" form:"status"`
113
+	Sort       int64  `gorm:"column:sort" json:"sort" form:"sort"`
113 114
 }
114 115
 
115 116
 func (DeviceZone) TableName() string {
@@ -696,7 +697,7 @@ type DeviceCultures struct {
696 697
 	Modifications     int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
697 698
 }
698 699
 
699
-//细菌培养检测
700
+// 细菌培养检测
700 701
 type DeviceCulture struct {
701 702
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
702 703
 	SpelingDate       int64  `gorm:"column:speling_date" json:"speling_date" form:"speling_date"`
@@ -749,7 +750,7 @@ type DeviceDialysates struct {
749 750
 	Modifications     int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
750 751
 }
751 752
 
752
-//内霉素检测
753
+// 内霉素检测
753 754
 type DeviceDialysate struct {
754 755
 	ID                int64  `gorm:"column:id" json:"id" form:"id"`
755 756
 	SamplingDate      int64  `gorm:"column:sampling_date" json:"sampling_date" form:"sampling_date"`
@@ -808,7 +809,7 @@ type DeviceIons struct {
808 809
 	Modifications   int64  `gorm:"column:modifications" json:"modifications" form:"modifications"`
809 810
 }
810 811
 
811
-//透析液离子浓度检测
812
+// 透析液离子浓度检测
812 813
 type DeviceIon struct {
813 814
 	ID              int64  `gorm:"column:id" json:"id" form:"id"`
814 815
 	SamplingDate    int64  `gorm:"column:sampling_date" json:"sampling_date" form:"sampling_date"`