瀏覽代碼

历史排班

28169 9 月之前
父節點
當前提交
43ad67e466

二進制
XT_New.exe 查看文件


+ 4 - 4
controllers/base_api_controller.go 查看文件

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 10537 //机构id 10344
85
+		subscibe.OrgId = 10164 //机构id 10344
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,7 +92,7 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 94
 		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
95
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96 96
 		adminUserInfo.CurrentAppId = 12123 //4
97 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
@@ -327,7 +327,7 @@ func (this *BaseServeAPIController) Prepare() {
327 327
 		userAdmin.ModifyTime = 1530786071
328 328
 		var subscibe models.ServeSubscibe
329 329
 		subscibe.ID = 11
330
-		subscibe.OrgId = 10537 //机构id小英10344或4
330
+		subscibe.OrgId = 10265 //机构id小英10344或4
331 331
 		subscibe.PeriodStart = 1538035409
332 332
 		subscibe.PeriodEnd = 1569571409
333 333
 		subscibe.State = 1
@@ -337,7 +337,7 @@ func (this *BaseServeAPIController) Prepare() {
337 337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338 338
 		subscibes[4] = &subscibe
339 339
 		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
340
+		adminUserInfo.CurrentOrgId = 10265 //机构id小英9675或4
341 341
 		adminUserInfo.CurrentAppId = 12123 //4
342 342
 		adminUserInfo.AdminUser = &userAdmin
343 343
 		adminUserInfo.Subscibes = subscibes

+ 4 - 2
controllers/dialysis_api_controller.go 查看文件

@@ -7688,10 +7688,12 @@ func (this *DialysisApiController) GetPatientRecordList() {
7688 7688
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7689 7689
 	beforList, _ := service.GetPatientBeforRecordList(patient_id, orgId)
7690 7690
 	afterList, _ := service.GetPatientAfterRecordList(patient_id, orgId)
7691
+	monitorList, _ := service.GetMonitorRecordByGroup(patient_id, orgId)
7691 7692
 
7692 7693
 	this.ServeSuccessJSON(map[string]interface{}{
7693
-		"beforList": beforList,
7694
-		"afterList": afterList,
7694
+		"beforList":   beforList,
7695
+		"afterList":   afterList,
7696
+		"monitorList": monitorList,
7695 7697
 	})
7696 7698
 
7697 7699
 }

+ 9 - 5
controllers/dialysis_record_api_controller.go 查看文件

@@ -1,20 +1,22 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"encoding/json"
6
-	"github.com/jinzhu/gorm"
7 5
 	"math"
8 6
 	"strconv"
9 7
 	"time"
10 8
 
9
+	"XT_New/models"
10
+	"github.com/jinzhu/gorm"
11
+
12
+	"fmt"
13
+	"net/http"
14
+	"net/url"
15
+
11 16
 	"XT_New/enums"
12 17
 	"XT_New/service"
13 18
 	"XT_New/utils"
14
-	"fmt"
15 19
 	"github.com/astaxie/beego"
16
-	"net/http"
17
-	"net/url"
18 20
 )
19 21
 
20 22
 func DialysisRecordAPIControllerRegistRouter() {
@@ -433,11 +435,13 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
433 435
 
434 436
 	if is_open_config.IsOpen == 1 {
435 437
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
438
+		fmt.Println("his_advicses--------------------222222", his_advices)
436 439
 	}
437 440
 	//查询是否是开起
438 441
 	adviceConfig, _ := service.FindAdviceSettingById(adminInfo.CurrentOrgId)
439 442
 	if adviceConfig.IsAdviceOpen == 1 {
440 443
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
444
+		fmt.Println("his_advicses--------------------", his_advices)
441 445
 	}
442 446
 
443 447
 	_, errcode := service.GetOrgFollowIsExist(adminInfo.CurrentOrgId)

+ 26 - 40
controllers/his_api_controller.go 查看文件

@@ -1647,6 +1647,12 @@ func (c *HisApiController) GetHisPatientInfo() {
1647 1647
 				info, _ := service.GetWarehoseInfoByDrugId(subItem.DrugId, admin.CurrentOrgId)
1648 1648
 				if info.RetailPrice > 0 {
1649 1649
 					subItem.Drug.MinPrice = info.RetailPrice
1650
+
1651
+					service.UpdatePrescriptionAdvice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1652
+
1653
+					service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1654
+
1655
+					fmt.Println("haaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
1650 1656
 				}
1651 1657
 			}
1652 1658
 		}
@@ -1659,6 +1665,11 @@ func (c *HisApiController) GetHisPatientInfo() {
1659 1665
 					info, _ := service.GetGoodWarehoseInfoByGoodId(subItem.ProjectId, admin.CurrentOrgId)
1660 1666
 					if info.Price > 0 {
1661 1667
 						subItem.GoodInfo.PackingPrice = info.Price
1668
+
1669
+						service.UpdatePrescriptionProject(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1670
+
1671
+						service.UpdateGood(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1672
+						fmt.Println("baaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
1662 1673
 					}
1663 1674
 				}
1664 1675
 			}
@@ -3487,7 +3498,7 @@ func (c *HisApiController) CreateHisPrescription() {
3487 3498
 								var p models.HisPrescriptionProject
3488 3499
 								p.PrescriptionId = tempPrescription.ID
3489 3500
 								p.Ctime = time.Now().Unix()
3490
-								p.Mtime = p.Ctime
3501
+								p.Mtime = time.Now().Unix()
3491 3502
 								p.PatientId = patient_id
3492 3503
 								p.RecordDate = theTime3.Unix()
3493 3504
 								p.Doctor = doctor_id
@@ -3538,6 +3549,12 @@ func (c *HisApiController) CreateHisPrescription() {
3538 3549
 								//	}
3539 3550
 								//
3540 3551
 								//}
3552
+								var randNum int
3553
+								randNum = rand.Intn(10000) + 1000
3554
+								timestamp := time.Now().Unix()
3555
+								tempTime := time.Unix(timestamp, 0)
3556
+								timeFormat := tempTime.Format("20060102150405")
3557
+								p.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "2" + "-" + strconv.FormatInt(p.ID, 10)
3541 3558
 
3542 3559
 								service.CreateNewHisProjectTwo(&p, tx)
3543 3560
 
@@ -3743,12 +3760,6 @@ func (c *HisApiController) CreateHisPrescription() {
3743 3760
 										service.CreateDoctorAdviceLog(adviceLog)
3744 3761
 
3745 3762
 										projectList = append(projectList, p)
3746
-										var randNum int
3747
-										randNum = rand.Intn(10000) + 1000
3748
-										timestamp := time.Now().Unix()
3749
-										tempTime := time.Unix(timestamp, 0)
3750
-										timeFormat := tempTime.Format("20060102150405")
3751
-										p.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "2" + "-" + strconv.FormatInt(p.ID, 10)
3752 3763
 
3753 3764
 										if p.Type == 2 { //因为项目和耗材的基础库存在id相同的情况,所以需要根据该字段来判断,type为2的话为从项目开出来的
3754 3765
 											//新增或者编辑项目,修改对应的标签数据
@@ -3800,8 +3811,6 @@ func (c *HisApiController) CreateHisPrescription() {
3800 3811
 											}
3801 3812
 										}
3802 3813
 
3803
-										service.SaveNewHisProjectTwo(&p, tx)
3804
-
3805 3814
 									}
3806 3815
 								}
3807 3816
 								tx.Commit()
@@ -4116,16 +4125,6 @@ func (c *HisApiController) CreateHisPrescription() {
4116 4125
 			return
4117 4126
 		}
4118 4127
 	} else {
4119
-		// 开始主事务
4120
-		db := service.XTWriteDB()
4121
-		tx := db.Begin()
4122
-
4123
-		// 在函数结束时处理事务回滚
4124
-		defer func() {
4125
-			if r := recover(); r != nil {
4126
-				tx.Rollback()
4127
-			}
4128
-		}()
4129 4128
 
4130 4129
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
4131 4130
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
@@ -7448,11 +7447,7 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
7448 7447
 			hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
7449 7448
 			if err == nil {
7450 7449
 				if hisAdvice.ID > 0 {
7451
-					if hisAdvice.YbSyncStatus == 1 {
7452
-						advice.YbSyncStatus = 0
7453
-					}
7454
-					advice.UpdatedTime = time.Now().Unix()
7455
-					advice.CreatedTime = hisAdvice.CreatedTime
7450
+
7456 7451
 					advice.ExecutionTime = hisAdvice.ExecutionTime
7457 7452
 					advice.ExecutionStaff = hisAdvice.ExecutionStaff
7458 7453
 					advice.ExecutionState = hisAdvice.ExecutionState
@@ -7623,22 +7618,13 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
7623 7618
 		id := int64(json["id"].(float64))
7624 7619
 		project.ID = id
7625 7620
 		temp_project, _ := service.GetHisPrescriptionProjectByID(id)
7626
-		if temp_project.ID > 0 {
7627
-			if temp_project.YbSyncStatus == 1 {
7628
-				project.YbSyncStatus = 0
7629
-			}
7630
-			project.ExecutionStaff = temp_project.ExecutionStaff
7631
-			project.ExecutionState = temp_project.ExecutionState
7632
-			project.ExecutionTime = temp_project.ExecutionTime
7633
-			project.Checker = temp_project.Checker
7634
-			project.CheckState = temp_project.CheckState
7635
-			project.CheckTime = temp_project.CheckTime
7636
-			project.TeamId = temp_project.TeamId
7637
-			project.Ctime = temp_project.Ctime
7638
-			project.Mtime = time.Now().Unix()
7639
-
7640
-		}
7641
-
7621
+		project.ExecutionStaff = temp_project.ExecutionStaff
7622
+		project.ExecutionState = temp_project.ExecutionState
7623
+		project.ExecutionTime = temp_project.ExecutionTime
7624
+		project.Checker = temp_project.Checker
7625
+		project.CheckState = temp_project.CheckState
7626
+		project.CheckTime = temp_project.CheckTime
7627
+		project.TeamId = temp_project.TeamId
7642 7628
 	}
7643 7629
 	if json["type"] != nil || reflect.TypeOf(json["type"]).String() == "float64" {
7644 7630
 		types := int64(json["type"].(float64))

+ 1 - 0
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -1529,6 +1529,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1529 1529
 								PrescribingNumberUnit: advice.PrescribingNumberUnit,
1530 1530
 							}
1531 1531
 							service.CreateDrugError(drugError)
1532
+							tx.Commit()
1532 1533
 							c.ServeSuccessJSON(map[string]interface{}{
1533 1534
 								"msg":    "1",
1534 1535
 								"advice": advice,

+ 84 - 87
controllers/pharmacy_controller.go 查看文件

@@ -91,49 +91,48 @@ func (this *PharmacyController) TodayNumber() {
91 91
 		etime = stime + 86399
92 92
 	}
93 93
 
94
-	if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 && orgid != 10480 {
95
-		//查询表里当天的数据
96
-		var wtotal int
97
-		wtotal, err = service.GetTodayPharmacy(stime, etime, orgid, 1)
94
+	//if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 && orgid != 10480 {
95
+	//	//查询表里当天的数据
96
+	//	var wtotal int
97
+	//	wtotal, err = service.GetTodayPharmacy(stime, etime, orgid, 1)
98
+	//
99
+	//	if err != nil {
100
+	//		utils.ErrorLog(err.Error())
101
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
102
+	//		return
103
+	//	}
104
+	//
105
+	//	var itotal int
106
+	//	itotal, err = service.GetTodayPharmacy(stime, etime, orgid, 0)
107
+	//
108
+	//	drug, _ := service.GetAllBaseDrugList(orgid)
109
+	//	if err != nil {
110
+	//		utils.ErrorLog(err.Error())
111
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
112
+	//		return
113
+	//	}
114
+	//	this.ServeSuccessJSON(map[string]interface{}{
115
+	//		"wtotal": wtotal,
116
+	//		"itotal": itotal,
117
+	//		"drug":   drug,
118
+	//	})
119
+	//	return
120
+	//}
98 121
 
99
-		if err != nil {
100
-			utils.ErrorLog(err.Error())
101
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
102
-			return
103
-		}
122
+	var wtotal int
123
+	var itotal int
124
+	//查找出库数量
125
+	wtotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 1)
104 126
 
105
-		var itotal int
106
-		itotal, err = service.GetTodayPharmacy(stime, etime, orgid, 0)
127
+	itotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 0)
107 128
 
108
-		drug, _ := service.GetAllBaseDrugList(orgid)
109
-		if err != nil {
110
-			utils.ErrorLog(err.Error())
111
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
112
-			return
113
-		}
114
-		this.ServeSuccessJSON(map[string]interface{}{
115
-			"wtotal": wtotal,
116
-			"itotal": itotal,
117
-			"drug":   drug,
118
-		})
119
-		return
120
-	}
121
-
122
-	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 || orgid == 10480 {
123
-		var wtotal int
124
-		var itotal int
125
-		//查找出库数量
126
-		wtotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 1)
127
-
128
-		itotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 0)
129
-		drug, _ := service.GetAllBaseDrugList(orgid)
130
-		this.ServeSuccessJSON(map[string]interface{}{
131
-			"wtotal": wtotal,
132
-			"itotal": itotal,
133
-			"drug":   drug,
134
-		})
135
-		return
136
-	}
129
+	drug, _ := service.GetAllBaseDrugList(orgid)
130
+	this.ServeSuccessJSON(map[string]interface{}{
131
+		"wtotal": wtotal,
132
+		"itotal": itotal,
133
+		"drug":   drug,
134
+	})
135
+	return
137 136
 
138 137
 }
139 138
 func (this *PharmacyController) IssuedDrug() {
@@ -180,7 +179,7 @@ func (this *PharmacyController) IssuedDrug() {
180 179
 	}
181 180
 
182 181
 	list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
183
-
182
+	fmt.Println("LIST=================", list)
184 183
 	var flist []models.TmpPatientOne
185 184
 	if len(list) > 0 {
186 185
 		for _, item := range list {
@@ -248,57 +247,54 @@ func (this *PharmacyController) WaitingDrug() {
248 247
 		etime = stime + 86399
249 248
 	}
250 249
 
251
-	if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid != 10344 {
252
-		//查询表里当天的数据
253
-		var flist []*models.TmpPatient
254
-		flist, err = service.GetTodayDrug(stime, etime, orgid, 0, keyword)
255
-
256
-		if err != nil {
257
-			utils.ErrorLog(err.Error())
258
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
259
-			return
260
-		}
261
-		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
262
-
263
-		if err != nil {
264
-			utils.ErrorLog(err.Error())
265
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
266
-			return
267
-		}
268
-		baseList, _ := service.GetAllBaseDrugListTwo(orgid)
269
-		this.ServeSuccessJSON(map[string]interface{}{
270
-			"list":     listt,
271
-			"baseList": baseList,
272
-		})
273
-		return
250
+	//if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid != 10344 {
251
+	//	//查询表里当天的数据
252
+	//	var flist []*models.TmpPatient
253
+	//	flist, err = service.GetTodayDrug(stime, etime, orgid, 0, keyword)
254
+	//
255
+	//	if err != nil {
256
+	//		utils.ErrorLog(err.Error())
257
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
258
+	//		return
259
+	//	}
260
+	//	listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
261
+	//
262
+	//	if err != nil {
263
+	//		utils.ErrorLog(err.Error())
264
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
265
+	//		return
266
+	//	}
267
+	//	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
268
+	//	this.ServeSuccessJSON(map[string]interface{}{
269
+	//		"list":     listt,
270
+	//		"baseList": baseList,
271
+	//	})
272
+	//	return
273
+	//}
274
+	fmt.Println(keyword)
275
+	//当未发药的人数
276
+	//获取排班班次
277
+	schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
278
+	var ids []int64
279
+	for _, item := range schedule {
280
+		ids = append(ids, item.PatientId)
274 281
 	}
275 282
 
276
-	//当天已发药的人数
277
-	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 || orgid == 10387 || orgid == 10375 || orgid == 10480 || orgid == 10344 {
283
+	list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
278 284
 
279
-		//获取排班班次
280
-		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
281
-		var ids []int64
282
-		for _, item := range schedule {
283
-			ids = append(ids, item.PatientId)
284
-		}
285
-
286
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
287
-
288
-		var flist []models.TmpPatientOne
289
-		if len(list) > 0 {
290
-			for _, item := range list {
291
-				patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
292
-				flist = append(flist, patientlist)
293
-			}
285
+	var flist []models.TmpPatientOne
286
+	if len(list) > 0 {
287
+		for _, item := range list {
288
+			patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
289
+			flist = append(flist, patientlist)
294 290
 		}
295
-		baseList, _ := service.GetAllBaseDrugListTwo(orgid)
296
-		this.ServeSuccessJSON(map[string]interface{}{
297
-			"list":     flist,
298
-			"baseList": baseList,
299
-		})
300
-		return
301 291
 	}
292
+	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
293
+	this.ServeSuccessJSON(map[string]interface{}{
294
+		"list":     flist,
295
+		"baseList": baseList,
296
+	})
297
+	return
302 298
 
303 299
 }
304 300
 
@@ -328,6 +324,7 @@ func (this *PharmacyController) GetPharmacyContent() {
328 324
 	}
329 325
 	var list []*models.PharmacyContent
330 326
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
327
+
331 328
 	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
332 329
 	if err != nil {
333 330
 		utils.ErrorLog(err.Error())

+ 1 - 1
controllers/self_drug_api_congtroller.go 查看文件

@@ -4121,7 +4121,7 @@ func (this *SelfDrugApiController) GetDrugFlowDetailById() {
4121 4121
 			}
4122 4122
 			if index == 0 {
4123 4123
 				var count int64
4124
-				count = list[index].OverCount + list[index].Count
4124
+				count = list[index].FlushOverCount + list[index].Count
4125 4125
 				service.UpdateDrugOverCount(list[index+1].ID, count)
4126 4126
 			}
4127 4127
 

+ 68 - 3
controllers/sign_api_controller.go 查看文件

@@ -1,14 +1,15 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/service"
6 4
 	"encoding/base64"
7 5
 	"encoding/json"
8 6
 	"fmt"
9
-	"github.com/astaxie/beego"
10 7
 	"io/ioutil"
11 8
 	"time"
9
+
10
+	"XT_New/models"
11
+	"XT_New/service"
12
+	"github.com/astaxie/beego"
12 13
 )
13 14
 
14 15
 type SignApiController struct {
@@ -92,6 +93,9 @@ func SignApiRegistRouters() {
92 93
 	//加油
93 94
 	beego.Router("/api/device/toautojiayou", &SignApiController{}, "Get:ToAutoJiaYou")
94 95
 
96
+	//显示字段脚本
97
+	beego.Router("/api/device/getfieldconfiglist", &SignApiController{}, "Get:GetFieldConfigList")
98
+
95 99
 }
96 100
 
97 101
 // 短信服务接口
@@ -1280,3 +1284,64 @@ func (this *SignApiController) ToAutoJiaYou() {
1280 1284
 		service.UpdateDialysisScheduleOne(schedule.ID, item.ModeId, DialysisMachineName)
1281 1285
 	}
1282 1286
 }
1287
+
1288
+func (this *SignApiController) GetFieldConfigList() {
1289
+
1290
+	orderList, _ := service.GetDialysisOrderByUserOrgId()
1291
+
1292
+	if len(orderList) > 0 {
1293
+		filedConfigList, _ := service.GetFieldConfigList(9442)
1294
+
1295
+		for _, item := range orderList {
1296
+			for _, it := range filedConfigList {
1297
+				//查询该机构该模式是否有这个字段
1298
+				fiedConfigObj, _ := service.GetFieldConfigByOrgId(item.UserOrgId, it.FiledNameCn, it.Module)
1299
+				if fiedConfigObj.ID == 0 {
1300
+					config := models.FiledConfig{
1301
+						OrgId:        item.UserOrgId,
1302
+						Module:       it.Module,
1303
+						FiledName:    it.FiledName,
1304
+						FiledNameCn:  it.FiledNameCn,
1305
+						IsShow:       2,
1306
+						CreateTime:   time.Now().Unix(),
1307
+						UpdateTime:   time.Now().Unix(),
1308
+						SysModule:    it.SysModule,
1309
+						IsWrite:      it.IsWrite,
1310
+						IsSecondMenu: it.IsSecondMenu,
1311
+					}
1312
+					service.CretedConfig(config)
1313
+				}
1314
+			}
1315
+		}
1316
+	}
1317
+
1318
+	//filedConfig, _ := service.GetFieldConfigGroupList(7)
1319
+	//if len(filedConfig) > 0 {
1320
+	//	for _, item := range filedConfig {
1321
+	//		//查询该机构
1322
+	//		fiedConfigObj, _ := service.GetFieldConfigByOrgId(9442, item.FiledNameCn, item.Module)
1323
+	//
1324
+	//		if fiedConfigObj.ID == 0 {
1325
+	//
1326
+	//			config := models.FiledConfig{
1327
+	//				OrgId:        9442,
1328
+	//				Module:       item.Module,
1329
+	//				FiledName:    item.FiledName,
1330
+	//				FiledNameCn:  item.FiledNameCn,
1331
+	//				IsShow:       2,
1332
+	//				CreateTime:   time.Now().Unix(),
1333
+	//				UpdateTime:   time.Now().Unix(),
1334
+	//				SysModule:    item.SysModule,
1335
+	//				IsWrite:      item.IsWrite,
1336
+	//				IsSecondMenu: item.IsSecondMenu,
1337
+	//			}
1338
+	//
1339
+	//			service.CretedConfig(config)
1340
+	//		}
1341
+	//	}
1342
+	//}
1343
+
1344
+	this.ServeSuccessJSON(map[string]interface{}{
1345
+		"msg": "ok",
1346
+	})
1347
+}

+ 107 - 87
controllers/stock_in_api_controller.go 查看文件

@@ -3820,6 +3820,12 @@ func (this *StockManagerApiController) AddGoodInformation() {
3820 3820
 		packing_unit := goodNameM["good_unit"].(string)
3821 3821
 		good.PackingUnit = packing_unit
3822 3822
 
3823
+		number := goodNameM["number"].(string)
3824
+		good.Number = number
3825
+
3826
+		register_number := goodNameM["register_number"].(string)
3827
+		good.RegisterNumber = register_number
3828
+
3823 3829
 		goods = append(goods, &good)
3824 3830
 
3825 3831
 	}
@@ -3882,6 +3888,8 @@ func (this *StockManagerApiController) AddGoodInformation() {
3882 3888
 				DefaultCount:                item.DefaultCount,
3883 3889
 				DefaultCountUnit:            item.DefaultCountUnit,
3884 3890
 				FirstLetter:                 item.FirstLetter,
3891
+				RegisterNumber:              item.RegisterNumber,
3892
+				Number:                      item.Number,
3885 3893
 			}
3886 3894
 
3887 3895
 			//查询同种耗材名称同种类型同种规格的耗材是否存在
@@ -8202,115 +8210,127 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8202 8210
 
8203 8211
 	orgId := this.GetAdminUserInfo().CurrentOrgId
8204 8212
 
8205
-	list, _ := service.GetAllBaseDrugList(orgId)
8213
+	//list, _ := service.GetAllBaseDrugList(orgId)
8206 8214
 	//
8207 8215
 
8208
-	for _, item := range list {
8209
-		var sum_in_count int64
8210
-		var sum_out_count int64
8211
-		var flush_out_count int64
8212
-		//var str = ""
8213
-		//str = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit
8214
-		//service.UpdateBaseDrugById(item.ID, drug_dosage_form_str)
8215
-
8216
-		//drug_dosage_form_str := service.GetDosageFormListById(item.DrugDosageForm, orgId)
8217
-		//service.UpdateDosageFormListById(drug_dosage_form_str, item.ID)
8218
-
8219
-		warehouseinfo, _ := service.GetDrugWarehouseInfoByItemId(item.ID)
8220
-		if len(warehouseinfo) > 0 {
8221
-			for _, it := range warehouseinfo {
8222
-				if item.MaxUnit == it.MaxUnit && item.MaxUnit != item.MinUnit {
8223
-					it.WarehousingCount = it.WarehousingCount * item.MinNumber
8224
-				}
8216
+	//for _, item := range list {
8217
+	//	var sum_in_count int64
8218
+	//	var sum_out_count int64
8219
+	//	var flush_out_count int64
8220
+	//	//var str = ""
8221
+	//	//str = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit
8222
+	//	//service.UpdateBaseDrugById(item.ID, str)
8223
+	//	//
8224
+	//	//drug_dosage_form_str := service.GetDosageFormListById(item.DrugDosageForm, orgId)
8225
+	//	//service.UpdateDosageFormListById(drug_dosage_form_str, item.ID)
8226
+	//
8227
+	//	warehouseinfo, _ := service.GetDrugWarehouseInfoByItemId(item.ID)
8228
+	//	if len(warehouseinfo) > 0 {
8229
+	//		for _, it := range warehouseinfo {
8230
+	//			if item.MaxUnit == it.MaxUnit && item.MaxUnit != item.MinUnit {
8231
+	//				it.WarehousingCount = it.WarehousingCount * item.MinNumber
8232
+	//			}
8233
+	//
8234
+	//			if item.MaxUnit == it.MinUnit && item.MaxUnit != item.MinUnit {
8235
+	//				it.WarehousingCount = it.WarehousingCount
8236
+	//			}
8237
+	//
8238
+	//			if item.MaxUnit == it.MinUnit && item.MaxUnit == item.MinUnit {
8239
+	//				it.WarehousingCount = it.WarehousingCount
8240
+	//			}
8241
+	//
8242
+	//			sum_in_count += it.WarehousingCount
8243
+	//		}
8244
+	//
8245
+	//	}
8246
+	//	//
8247
+	//	outList, _ := service.GetDrugWarehosueOutInfoByItemId(item.ID)
8248
+	//	if len(outList) > 0 {
8249
+	//		for _, it := range outList {
8250
+	//			if item.MaxUnit == it.CountUnit && item.MaxUnit != item.MinUnit {
8251
+	//				it.Count = it.Count * item.MinNumber
8252
+	//			}
8253
+	//
8254
+	//			if item.MaxUnit == it.CountUnit && item.MaxUnit != item.MinUnit {
8255
+	//				it.Count = it.Count
8256
+	//			}
8257
+	//
8258
+	//			if item.MaxUnit == it.CountUnit && item.MaxUnit == item.MinUnit {
8259
+	//				it.Count = it.Count
8260
+	//			}
8261
+	//
8262
+	//			sum_out_count += it.Count
8263
+	//		}
8264
+	//	}
8265
+	//
8266
+	//	flush_out_count = sum_in_count - sum_out_count
8267
+	//	fmt.Println("sum_in_count+++++++++++++", sum_in_count)
8268
+	//	fmt.Println("sum_out_count++++++++++++++", sum_out_count)
8269
+	//	fmt.Println("flushi_out_count===========", flush_out_count)
8270
+	//
8271
+	//	service.UpdateBaseDrugByIdCountTwo(item.ID, flush_out_count)
8272
+	//}
8225 8273
 
8226
-				if item.MaxUnit == it.MinUnit && item.MaxUnit != item.MinUnit {
8227
-					it.WarehousingCount = it.WarehousingCount
8228
-				}
8274
+	//info, _ := service.GetDrugAllInfo(orgId)
8229 8275
 
8230
-				if item.MaxUnit == it.MinUnit && item.MaxUnit == item.MinUnit {
8231
-					it.WarehousingCount = it.WarehousingCount
8232
-				}
8276
+	info, _ := service.GetDrugOutAllInfo(orgId)
8233 8277
 
8234
-				sum_in_count += it.WarehousingCount
8235
-			}
8278
+	for _, item := range info {
8236 8279
 
8237
-		}
8280
+		//dealer, _ := service.GetDealerById(item.Dealer)
8238 8281
 
8239
-		outList, _ := service.GetDrugWarehosueOutInfoByItemId(item.ID)
8240
-		if len(outList) > 0 {
8241
-			for _, it := range outList {
8242
-				if item.MaxUnit == it.CountUnit && item.MaxUnit != item.MinUnit {
8243
-					it.Count = it.Count * item.MinNumber
8244
-				}
8282
+		manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8245 8283
 
8246
-				if item.MaxUnit == it.CountUnit && item.MaxUnit != item.MinUnit {
8247
-					it.Count = it.Count
8248
-				}
8284
+		service.UpdateDealerManufacturerOne(item.ID, manufacturer.ManufacturerName)
8285
+	}
8249 8286
 
8250
-				if item.MaxUnit == it.CountUnit && item.MaxUnit == item.MinUnit {
8251
-					it.Count = it.Count
8252
-				}
8287
+}
8253 8288
 
8254
-				sum_out_count += it.Count
8255
-			}
8256
-		}
8289
+func (this *StockManagerApiController) UpdateGoodInfoByUserOrgId() {
8290
+
8291
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8257 8292
 
8258
-		flush_out_count = sum_in_count - sum_out_count
8293
+	info, _ := service.GetAllWareHouseOutByUserOrg(orgId)
8259 8294
 
8260
-		service.UpdateBaseDrugByIdCount(item.ID, flush_out_count)
8261
-	}
8295
+	if len(info) > 0 {
8296
+		for _, item := range info {
8297
+			dealer, _ := service.GetDealerById(item.Dealer)
8262 8298
 
8263
-	//info, _ := service.GetDrugAllInfo(orgId)
8264
-	//
8265
-	//for _, item := range info {
8299
+			//manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8300
+
8301
+			service.UpdateGoodInfoByUserOrgIdTwo(item.ID, dealer.DealerName)
8302
+		}
8303
+	}
8304
+	//goodList, _ := service.GetAllGoodList(orgId)
8266 8305
 	//
8267
-	//	dealer, _ := service.GetDealerById(item.Dealer)
8306
+	//for _, item := range goodList {
8268 8307
 	//
8269
-	//	manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8308
+	//	good_type_name := service.GetAllGoodTypeName(item.GoodTypeId, orgId)
8270 8309
 	//
8271
-	//	service.UpdateDealerManufacturer(item.ID, dealer.DealerName, manufacturer.ManufacturerName)
8310
+	//	service.UpdateGoodTypeName(item.ID, good_type_name)
8272 8311
 	//}
8273 8312
 
8274
-}
8275
-
8276
-func (this *StockManagerApiController) UpdateGoodInfoByUserOrgId() {
8277
-
8278
-	orgId := this.GetAdminUserInfo().CurrentOrgId
8279
-
8280
-	//info, _ := service.GetAllWareHouseInforByUserOrg(orgId)
8281 8313
 	//
8282
-	//if len(info) > 0 {
8283
-	//	for _, item := range info {
8284
-	//		dealer, _ := service.GetDealerById(item.Dealer)
8314
+	//for _, item := range goodList {
8285 8315
 	//
8286
-	//		manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8316
+	//	var sum_in_count int64
8317
+	//	var sum_out_count int64
8318
+	//	var flush_out_count int64
8319
+	//	infor, _ := service.GetAllWarehouseSumInCount(item.ID)
8320
+	//
8321
+	//	for _, item := range infor {
8322
+	//		sum_in_count += item.WarehousingCount
8323
+	//	}
8324
+	//
8325
+	//	outInfo, _ := service.GetAllWarehouseSumOutCount(item.ID)
8287 8326
 	//
8288
-	//		service.UpdateGoodInfoByUserOrgId(item.ID, dealer.DealerName, manufacturer.ManufacturerName)
8327
+	//	for _, item := range outInfo {
8328
+	//		sum_out_count += item.Count
8289 8329
 	//	}
8330
+	//
8331
+	//	flush_out_count = sum_in_count - sum_out_count
8332
+	//
8333
+	//	service.UpdateGoodInfoByIdOne(item.ID, flush_out_count)
8290 8334
 	//}
8291 8335
 
8292
-	goodList, _ := service.GetAllGoodList(orgId)
8293
-
8294
-	for _, item := range goodList {
8295
-
8296
-		var sum_in_count int64
8297
-		var sum_out_count int64
8298
-		var flush_out_count int64
8299
-		infor, _ := service.GetAllWarehouseSumInCount(item.ID)
8300
-
8301
-		for _, item := range infor {
8302
-			sum_in_count += item.WarehousingCount
8303
-		}
8304
-
8305
-		outInfo, _ := service.GetAllWarehouseSumOutCount(item.ID)
8306
-
8307
-		for _, item := range outInfo {
8308
-			sum_out_count += item.Count
8309
-		}
8310
-
8311
-		flush_out_count = sum_in_count - sum_out_count
8312
-
8313
-		service.UpdateGoodInfoById(item.ID, flush_out_count)
8314
-	}
8315
-
8316 8336
 }

+ 16 - 0
models/dialysis.go 查看文件

@@ -780,6 +780,22 @@ func (MonitoringRecord) TableName() string {
780 780
 	return "xt_monitoring_record"
781 781
 }
782 782
 
783
+type MonitoringRecordOne struct {
784
+	ID                     int64               `gorm:"column:id" json:"id"`
785
+	UserOrgId              int64               `gorm:"column:user_org_id" json:"user_org_id"`
786
+	PatientId              int64               `gorm:"column:patient_id" json:"patient_id"`
787
+	MonitoringDate         int64               `gorm:"column:monitoring_date" json:"monitoring_date"`
788
+	OperateTime            int64               `gorm:"column:operate_time" json:"operate_time"`
789
+	MonitoringTime         string              `gorm:"column:monitoring_time" json:"monitoring_time"`
790
+	SystolicBloodPressure  float64             `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
791
+	DiastolicBloodPressure float64             `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
792
+	MonitoringRecord       []*MonitoringRecord `gorm:"ForeignKey:MonitoringDate,PatientId;AssociationForeignKey:MonitoringDate,PatientId" json:"child"`
793
+}
794
+
795
+func (MonitoringRecordOne) TableName() string {
796
+	return "xt_monitoring_record"
797
+}
798
+
783 799
 type DialysisOrders struct {
784 800
 	ID             int64        `gorm:"column:id" json:"id"`
785 801
 	DialysisDate   int64        `gorm:"column:dialysis_date" json:"dialysis_date"`

+ 1 - 0
models/drug_stock.go 查看文件

@@ -194,6 +194,7 @@ type DrugWarehouseOutInfo struct {
194 194
 	BaseDrugLib             BaseDrugLib `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId"json:"drug" `
195 195
 	OverCount               int64       `gorm:"column:over_count" json:"over_count" form:"over_count"`
196 196
 	OrderId                 int64       `gorm:"column:order_id" json:"order_id" form:"order_id"`
197
+	ManafacturerName        string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
197 198
 }
198 199
 
199 200
 func (DrugWarehouseOutInfo) TableName() string {

+ 1 - 0
models/good_models.go 查看文件

@@ -226,6 +226,7 @@ type GoodInfoSevenThirty struct {
226 226
 	SumCancelCount              int64                `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
227 227
 	TotalCount                  int64                `gorm:"column:total_count" json:"total_count" form:"total_count"`
228 228
 	TotalCountOne               int64                `gorm:"column:total_count_one" json:"total_count_one" form:"total_count_one"`
229
+	TotalCountTwo               int64                `gorm:"column:total_count_two" json:"total_count_two" form:"total_count_two"`
229 230
 }
230 231
 
231 232
 func (GoodInfoSevenThirty) TableName() string {

+ 2 - 0
models/self_drug_models.go 查看文件

@@ -78,6 +78,7 @@ type XtBaseDrug struct {
78 78
 	IsPharmacy             int64   `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
79 79
 	DrugDosageFormName     string  `gorm:"column:drug_dosage_form_name" json:"drug_dosage_form_name" form:"drug_dosage_form_name"`
80 80
 	TotalCountOne          int64   `gorm:"column:total_count_one" json:"total_count" form:"total_count_one"`
81
+	TotalCountTwo          int64   `gorm:"column:total_count_two" json:"total_count_two" form:"total_count_two"`
81 82
 }
82 83
 
83 84
 func (XtBaseDrug) TableName() string {
@@ -1137,6 +1138,7 @@ type GoodInformation struct {
1137 1138
 	XtGoodStockCount            []*XtGoodStockCount `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_good_stock"`
1138 1139
 	GoodStockCount              []*XtGoodStockCount `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_good_stock_info"`
1139 1140
 	WarehousingInfo             []*WarehousingInfo  `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
1141
+	GoodTypeName                string              `gorm:"column:good_type_name" json:"good_type_name" form:"good_type_name"`
1140 1142
 }
1141 1143
 
1142 1144
 func (GoodInformation) TableName() string {

+ 1 - 0
models/stock_models.go 查看文件

@@ -304,6 +304,7 @@ type WarehouseOutInfo struct {
304 304
 	OverCount               int64                `gorm:"column:over_count" json:"over_count" form:"over_count"`
305 305
 	OrderId                 int64                `gorm:"column:order_id" json:"order_id" form:"order_id"`
306 306
 	WarehousingInfoNight    WarehousingInfoNight `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId"`
307
+	DealerName              string               `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
307 308
 }
308 309
 
309 310
 func (WarehouseOutInfo) TableName() string {

+ 3 - 2
service/common_service.go 查看文件

@@ -1,11 +1,12 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7 5
 	"strconv"
8 6
 	"time"
7
+
8
+	"XT_New/models"
9
+	"github.com/jinzhu/gorm"
9 10
 )
10 11
 
11 12
 func GetInspectionMajor(orgid int64) (inspection []*models.XtInspectionReference, err error) {

+ 1 - 24
service/dialysis_service.go 查看文件

@@ -2459,49 +2459,26 @@ func CreatePrescriptionLog(log models.XtDialysisPrescriptionLog) error {
2459 2459
 
2460 2460
 func CreateBeforLog(log models.XtAssessmentBeforeDislysisLog) error {
2461 2461
 
2462
-	ut := writeDb.Begin()
2463 2462
 	err := XTWriteDB().Create(&log).Error
2464 2463
 
2465
-	if err != nil {
2466
-		ut.Rollback()
2467
-		return err
2468
-	}
2469
-	ut.Commit()
2470 2464
 	return err
2471 2465
 }
2472 2466
 
2473 2467
 func CreateAfterDialysisLog(log models.XtAssessmentAfterDialysisLog) error {
2474 2468
 
2475
-	ut := writeDb.Begin()
2476 2469
 	err := XTWriteDB().Create(&log).Error
2477
-	if err != nil {
2478
-		ut.Rollback()
2479
-		return err
2480
-	}
2481
-	ut.Commit()
2470
+
2482 2471
 	return err
2483 2472
 }
2484 2473
 
2485 2474
 func CreateDoctorAdviceLog(log models.XtDoctorAdviceLog) error {
2486 2475
 
2487
-	ut := writeDb.Begin()
2488 2476
 	err := XTWriteDB().Create(&log).Error
2489
-	if err != nil {
2490
-		ut.Rollback()
2491
-		return err
2492
-	}
2493
-	ut.Commit()
2494 2477
 	return err
2495 2478
 }
2496 2479
 
2497 2480
 func CreateMonitorRecordLog(log models.XtMonitorRecordLog) error {
2498 2481
 
2499
-	ut := writeDb.Begin()
2500 2482
 	err := XTWriteDB().Create(&log).Error
2501
-	if err != nil {
2502
-		ut.Rollback()
2503
-		return err
2504
-	}
2505
-	ut.Commit()
2506 2483
 	return err
2507 2484
 }

+ 43 - 22
service/his_service.go 查看文件

@@ -1,11 +1,12 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"fmt"
6
-	"github.com/jinzhu/gorm"
7 5
 	"strings"
8 6
 	"time"
7
+
8
+	"XT_New/models"
9
+	"github.com/jinzhu/gorm"
9 10
 )
10 11
 
11 12
 type VMSchedule struct {
@@ -414,14 +415,9 @@ func SaveHisPrescriptionOne(tx *gorm.DB, prescription *models.HisPrescription) (
414 415
 }
415 416
 
416 417
 func SaveHisPrescription(prescription *models.HisPrescription) (err error) {
417
-	tx := writeDb.Begin()
418 418
 
419
-	if err = tx.Model(&models.HisPrescription{}).Save(prescription).Error; err != nil {
420
-		tx.Rollback()
421
-		return
422
-	}
423
-	tx.Commit()
424
-	return
419
+	err = writeDb.Model(&models.HisPrescription{}).Save(prescription).Error
420
+	return err
425 421
 }
426 422
 
427 423
 func SaveHisPrescriptionTwo(prescription *models.HisPrescription) (err error) {
@@ -941,12 +937,8 @@ func CreateNewHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB)
941 937
 	return
942 938
 }
943 939
 func CreateHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
944
-	tx := writeDb.Begin()
945
-	if err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error; err != nil {
946
-		tx.Rollback()
947
-		return
948
-	}
949
-	tx.Commit()
940
+
941
+	err = writeDb.Model(&models.HisPrescriptionProject{}).Save(project).Error
950 942
 
951 943
 	return
952 944
 }
@@ -1051,14 +1043,10 @@ func FindLastPatientPrescriptionInfo(org_id int64, patient_id int64, record_date
1051 1043
 }
1052 1044
 
1053 1045
 func SavePatientPrescriptionInfo(info models.HisPrescriptionInfo) (err error) {
1054
-	tx := writeDb.Begin()
1055 1046
 
1056
-	if err = tx.Model(&models.HisPrescription{}).Save(&info).Error; err != nil {
1057
-		tx.Rollback()
1058
-		return
1059
-	}
1060
-	tx.Commit()
1061
-	return
1047
+	err = writeDb.Model(&models.HisPrescription{}).Save(&info).Error
1048
+
1049
+	return err
1062 1050
 }
1063 1051
 
1064 1052
 func GetHisOrderList(user_org_id int64, page int64, limit int64, start_time_timestamp int64, end_time_timestamp int64, doctor_id int64, keywords string, p_type int64, sort_type int64, start_time string, end_time string, charge_type int64, sch_type int64, zone_type int64, med_type int64) (order []*models.HisOrder, err error, total int64) {
@@ -3059,3 +3047,36 @@ func GetBatchHisProjectByIDs(ids []int64) (list []*models.HisPrescriptionProject
3059 3047
 	err = readDb.Model(&models.HisPrescriptionProject{}).Where("id in (?) and status = 1", ids).Find(&list).Error
3060 3048
 	return
3061 3049
 }
3050
+
3051
+func UpdatePrescriptionAdvice(drug_id int64, user_org_id int64, price float64) (models.HisPrescriptionAdviceTemplate, error) {
3052
+
3053
+	adviceTemplate := models.HisPrescriptionAdviceTemplate{}
3054
+	err := XTWriteDB().Model(&adviceTemplate).Where("drug_id = ? and user_org_id =? and status =1", drug_id, user_org_id).Updates(map[string]interface{}{"price": price}).Error
3055
+	return adviceTemplate, err
3056
+}
3057
+
3058
+func UpdateBaseMinPrice(drug_id int64, user_org_id int64, retial_price float64) (models.BaseDrugLib, error) {
3059
+
3060
+	lib := models.BaseDrugLib{}
3061
+
3062
+	err := XTWriteDB().Model(&lib).Where("id = ? and org_id = ?", drug_id, user_org_id).Updates(map[string]interface{}{"min_price": retial_price}).Error
3063
+	return lib, err
3064
+}
3065
+
3066
+func UpdatePrescriptionProject(good_id int64, user_org_id int64, packing_price float64) (models.HisPrescriptionProjectTemplate, error) {
3067
+
3068
+	projectTemplate := models.HisPrescriptionProjectTemplate{}
3069
+
3070
+	err := XTWriteDB().Model(&projectTemplate).Where("project_id = ? and status=1 and user_org_id =?", good_id, user_org_id).Updates(map[string]interface{}{"price": packing_price}).Error
3071
+
3072
+	return projectTemplate, err
3073
+}
3074
+
3075
+func UpdateGood(good_id int64, user_org_id int64, packing_price float64) (models.GoodInfo, error) {
3076
+
3077
+	goodInfo := models.GoodInfo{}
3078
+
3079
+	err := XTWriteDB().Where("id = ? and user_org_id = ? and status=1", good_id, user_org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
3080
+
3081
+	return goodInfo, err
3082
+}

文件差異過大導致無法顯示
+ 777 - 184
service/mobile_dialysis_service.go


+ 14 - 1
service/patient_service.go 查看文件

@@ -1550,7 +1550,7 @@ func GetPatientDialysisRecord(orgID, patientID int64, page, limit, start, end, m
1550 1550
 		}).
1551 1551
 		Joins("JOIN xt_schedule as s ON s.patient_id=? and FROM_UNIXTIME(s.schedule_date, '%Y-%m-%d')=FROM_UNIXTIME(do.dialysis_date, '%Y-%m-%d')", patientID).
1552 1552
 		Joins("JOIN xt_device_zone as dz ON dz.org_id = ? and dz.id=s.partition_id", orgID).
1553
-		Where("do.patient_id=? and do.user_org_id=?  and do.status=1", patientID, orgID).Group("s.schedule_date")
1553
+		Where("do.patient_id=? and do.user_org_id=?  and do.status=1 and s.status=1", patientID, orgID).Group("s.schedule_date")
1554 1554
 
1555 1555
 	if start != 0 {
1556 1556
 		db = db.Where("do.dialysis_date>=?", start)
@@ -4039,3 +4039,16 @@ func GetPatientAfterRecordList(patient_id int64, user_org_id int64) (after []*mo
4039 4039
 
4040 4040
 	return after, err
4041 4041
 }
4042
+
4043
+func GetMonitorRecordByGroup(patient_id int64, user_org_id int64) (monitor []*models.MonitoringRecordOne, err error) {
4044
+
4045
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and status=1 and monitoring_date>=1711900800", patient_id, user_org_id).Order("id desc").Preload("MonitoringRecord", "status=1 and user_org_id =? and monitoring_date>=1711900800", user_org_id).Group("monitoring_date").Limit(5).Find(&monitor).Error
4046
+
4047
+	return monitor, err
4048
+}
4049
+
4050
+func GetMonitorRecordList(patient_id int64, monitor_date int64, user_org_id int64) (monitor []*models.MonitoringRecord, err error) {
4051
+
4052
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and monitoring_date = ? and status =1", patient_id, user_org_id, monitor_date).Find(&monitor).Error
4053
+	return monitor, err
4054
+}

+ 5 - 4
service/secondary_service.go 查看文件

@@ -1,13 +1,14 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8 5
 	"math/rand"
9 6
 	"strconv"
10 7
 	"time"
8
+
9
+	"XT_New/models"
10
+	"XT_New/utils"
11
+	"github.com/jinzhu/gorm"
11 12
 )
12 13
 
13 14
 // 生成编号,规则为:"SH-"+4位随机数
@@ -1152,7 +1153,7 @@ func DeleteSecondOrderInfo(id int64) error {
1152 1153
 
1153 1154
 func GetStockFlowOrderList(good_id int64, user_org_id int64) (list []*models.VmStockFlow, err error) {
1154 1155
 
1155
-	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1", good_id, user_org_id).Order("ctime asc").Find(&list).Error
1156
+	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1", good_id, user_org_id).Order("id asc").Find(&list).Error
1156 1157
 	return list, err
1157 1158
 }
1158 1159
 

+ 48 - 5
service/self_drug_service.go 查看文件

@@ -3339,6 +3339,13 @@ func GetDrugAllInfo(org_id int64) (warehouseInfo []*models.DrugWarehouseInfo, er
3339 3339
 	return warehouseInfo, err
3340 3340
 }
3341 3341
 
3342
+func GetDrugOutAllInfo(org_id int64) (warehouseInfo []*models.DrugWarehouseOutInfo, err error) {
3343
+
3344
+	err = XTReadDB().Where("org_id = ? and status= 1 and ctime>=1672502400 and ctime<=1704038399", org_id).Find(&warehouseInfo).Error
3345
+
3346
+	return warehouseInfo, err
3347
+}
3348
+
3342 3349
 func UpdateDealerManufacturer(id int64, dealer_name string, manufactruer string) (err error) {
3343 3350
 
3344 3351
 	warehouseInfo := models.DrugWarehouseInfo{}
@@ -3347,16 +3354,24 @@ func UpdateDealerManufacturer(id int64, dealer_name string, manufactruer string)
3347 3354
 	return err
3348 3355
 }
3349 3356
 
3357
+func UpdateDealerManufacturerOne(id int64, manufactruer string) (err error) {
3358
+
3359
+	warehouseInfo := models.DrugWarehouseOutInfo{}
3360
+	err = XTWriteDB().Model(&warehouseInfo).Where("id = ? and status =1", id).Updates(map[string]interface{}{"manafacturer_name": manufactruer}).Error
3361
+
3362
+	return err
3363
+}
3364
+
3350 3365
 func GetDrugWarehouseInfoByItemId(drug_id int64) (list []*models.XtDrugWarehouseInfo, err error) {
3351 3366
 
3352
-	err = XTReadDB().Where("drug_id = ? and status=1 and is_check=1 and ctime<1640966400", drug_id).Find(&list).Error
3367
+	err = XTReadDB().Where("drug_id = ? and status=1 and is_check=1 and ctime<1704038399", drug_id).Find(&list).Error
3353 3368
 
3354 3369
 	return list, err
3355 3370
 }
3356 3371
 
3357 3372
 func GetDrugWarehosueOutInfoByItemId(drug_id int64) (list []*models.XtDrugWarehouseOutInfo, err error) {
3358 3373
 
3359
-	err = XTReadDB().Where("drug_id = ? and status=1 and is_check=1 and ctime<1640966400", drug_id).Find(&list).Error
3374
+	err = XTReadDB().Where("drug_id = ? and status=1 and is_check=1 and ctime<1704038399", drug_id).Find(&list).Error
3360 3375
 
3361 3376
 	return list, err
3362 3377
 }
@@ -3368,9 +3383,23 @@ func UpdateBaseDrugByIdCount(drug_id int64, flush_count int64) (models.XtBaseDru
3368 3383
 	return drug, err
3369 3384
 }
3370 3385
 
3386
+func UpdateBaseDrugByIdCountTwo(drug_id int64, flush_count int64) (models.XtBaseDrug, error) {
3387
+
3388
+	drug := models.XtBaseDrug{}
3389
+	err := XTWriteDB().Model(&drug).Model(&drug).Where("id = ? and status=1", drug_id).Updates(map[string]interface{}{"total_count_two": flush_count}).Error
3390
+	return drug, err
3391
+}
3392
+
3371 3393
 func GetAllWareHouseInforByUserOrg(org_id int64) (info []*models.WarehousingInfo, err error) {
3372 3394
 
3373
-	err = XTReadDB().Where("org_id =? and status =1 and is_check=1 and ctime>=1640966400 and ctime<=1703952000", org_id).Find(&info).Error
3395
+	err = XTReadDB().Where("org_id =? and status =1 and is_check=1 and ctime>=1672502400 and ctime<=1703952000", org_id).Find(&info).Error
3396
+
3397
+	return info, err
3398
+}
3399
+
3400
+func GetAllWareHouseOutByUserOrg(org_id int64) (info []*models.WarehouseOutInfo, err error) {
3401
+
3402
+	err = XTReadDB().Where("org_id =? and status =1 and is_check=1 and ctime>=1672502400 and ctime<=1703952000", org_id).Find(&info).Error
3374 3403
 
3375 3404
 	return info, err
3376 3405
 }
@@ -3382,16 +3411,23 @@ func UpdateGoodInfoByUserOrgId(id int64, dealer_name string, manufactruer string
3382 3411
 	return err
3383 3412
 }
3384 3413
 
3414
+func UpdateGoodInfoByUserOrgIdTwo(id int64, dealer_name string) (err error) {
3415
+
3416
+	WarehouseOutInfo := models.WarehouseOutInfo{}
3417
+	err = XTWriteDB().Model(&WarehouseOutInfo).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dealer_name": dealer_name}).Error
3418
+	return err
3419
+}
3420
+
3385 3421
 func GetAllWarehouseSumInCount(org_id int64) (infor []*models.WarehousingInfo, err error) {
3386 3422
 
3387
-	err = XTReadDB().Where("id = ? and status =1 and is_check =1 and ctime<1640966400", org_id).Find(&infor).Error
3423
+	err = XTReadDB().Where("id = ? and status =1 and is_check =1 and ctime<1704038399", org_id).Find(&infor).Error
3388 3424
 
3389 3425
 	return infor, err
3390 3426
 }
3391 3427
 
3392 3428
 func GetAllWarehouseSumOutCount(org_id int64) (infor []*models.WarehouseOutInfo, err error) {
3393 3429
 
3394
-	err = XTReadDB().Where("id = ? and status =1 and is_check =1 and ctime<1640966400", org_id).Find(&infor).Error
3430
+	err = XTReadDB().Where("id = ? and status =1 and is_check =1 and ctime<1704038399", org_id).Find(&infor).Error
3395 3431
 
3396 3432
 	return infor, err
3397 3433
 }
@@ -3402,3 +3438,10 @@ func UpdateGoodInfoById(id int64, total_count_one int64) error {
3402 3438
 
3403 3439
 	return err
3404 3440
 }
3441
+
3442
+func UpdateGoodInfoByIdOne(id int64, total_count_one int64) error {
3443
+
3444
+	err := XTWriteDB().Model(&models.GoodInfoSevenThirty{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"total_count_two": total_count_one}).Error
3445
+
3446
+	return err
3447
+}

+ 39 - 2
service/sign_service.go 查看文件

@@ -1,14 +1,15 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"bytes"
7 5
 	"crypto/hmac"
8 6
 	"crypto/sha1"
9 7
 	"encoding/base64"
10 8
 	"encoding/json"
11 9
 	"fmt"
10
+
11
+	"XT_New/models"
12
+	"XT_New/utils"
12 13
 	"github.com/astaxie/beego"
13 14
 	//"github.com/jung-kurt/gofpdf"
14 15
 	"io/ioutil"
@@ -2224,3 +2225,39 @@ func UpdateSchedulePatient(patient_id int64, schedule_date int64, zone_id int64,
2224 2225
 	err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id = ? and schedule_date =? and partition_id = ? and bed_id =?", patient_id, schedule_date, zone_id, bed_id).Updates(map[string]interface{}{"status": 1}).Error
2225 2226
 	return err
2226 2227
 }
2228
+
2229
+func GetDialysisOrderByUserOrgId() (order []*models.XtDialysisOrder, err error) {
2230
+
2231
+	err = XTReadDB().Where("status=1").Group("user_org_id").Find(&order).Error
2232
+
2233
+	return order, err
2234
+}
2235
+
2236
+func GetFieldConfigGroupList(module int64) (filedConfig []*models.FiledConfig, err error) {
2237
+
2238
+	err = XTReadDB().Where("module = ?", module).Group("filed_name").Order("filed_name_cn asc").Find(&filedConfig).Error
2239
+
2240
+	return filedConfig, err
2241
+}
2242
+
2243
+func GetFieldConfigByOrgId(org_id int64, field_name_cn string, module int64) (fiedConfig models.FiledConfig, err error) {
2244
+
2245
+	err = XTReadDB().Where("org_id = ? and filed_name_cn = ? and module =?", org_id, field_name_cn, module).Find(&fiedConfig).Error
2246
+
2247
+	return fiedConfig, err
2248
+}
2249
+
2250
+func CretedConfig(config models.FiledConfig) error {
2251
+
2252
+	err := XTWriteDB().Create(&config).Error
2253
+
2254
+	return err
2255
+}
2256
+
2257
+func GetFieldConfigList(user_org_id int64) (filedConfig []*models.FiledConfig, err error) {
2258
+
2259
+	err = XTReadDB().Where("org_id =?", user_org_id).Find(&filedConfig).Error
2260
+
2261
+	return filedConfig, err
2262
+
2263
+}

+ 22 - 8
service/stock_service.go 查看文件

@@ -3738,7 +3738,7 @@ func CreateGoodsInfomation(info *models.GoodInfo) error {
3738 3738
 
3739 3739
 func UpdateGoodsInformation(info *models.GoodInfo, goodName string, goodType int64, specificationName string, orgid int64) error {
3740 3740
 
3741
-	err := XTWriteDB().Model(&info).Where("good_name = ? and good_type_id = ? and specification_name = ? and org_id = ? and status = 1", goodName, goodType, specificationName, orgid).Updates(map[string]interface{}{"good_name": info.GoodName, "good_type_id": info.GoodTypeId, "medical_insurance_level": info.MedicalInsuranceLevel, "good_kind": info.GoodKind, "specification_name": info.SpecificationName, "manufacturer": info.Manufacturer, "good_unit": info.GoodUnit, "retail_price": info.RetailPrice, "stock_warn_count": info.StockWarnCount, "dealer": info.Dealer, "pinyin": info.Pinyin, "wubi": info.Wubi, "buy_price": info.BuyPrice, "medical_insurance_number": info.MedicalInsuranceNumber, "is_special_diseases": info.IsSpecialDiseases, "is_record": info.IsRecord, "statistics_category": info.StatisticsCategory, "good_status": info.GoodStatus, "social_security_directory_code": info.SocialSecurityDirectoryCode, "production_type": info.ProductionType, "special_medical": info.SpecialMedical, "remark": info.Remark}).Error
3741
+	err := XTWriteDB().Model(&info).Where("good_name = ? and good_type_id = ? and specification_name = ? and org_id = ? and status = 1", goodName, goodType, specificationName, orgid).Updates(map[string]interface{}{"good_name": info.GoodName, "good_type_id": info.GoodTypeId, "medical_insurance_level": info.MedicalInsuranceLevel, "good_kind": info.GoodKind, "specification_name": info.SpecificationName, "manufacturer": info.Manufacturer, "good_unit": info.GoodUnit, "retail_price": info.RetailPrice, "stock_warn_count": info.StockWarnCount, "dealer": info.Dealer, "pinyin": info.Pinyin, "wubi": info.Wubi, "buy_price": info.BuyPrice, "medical_insurance_number": info.MedicalInsuranceNumber, "is_special_diseases": info.IsSpecialDiseases, "is_record": info.IsRecord, "statistics_category": info.StatisticsCategory, "good_status": info.GoodStatus, "social_security_directory_code": info.SocialSecurityDirectoryCode, "production_type": info.ProductionType, "special_medical": info.SpecialMedical, "remark": info.Remark, "number": info.Number, "register_number": info.RegisterNumber}).Error
3742 3742
 	return err
3743 3743
 }
3744 3744
 
@@ -8132,13 +8132,8 @@ func UpdateGoodInfoSumCountSix(goodid int64, sum_count int64, orgid int64) error
8132 8132
 }
8133 8133
 
8134 8134
 func UpdateGoodInfoReduceSumCount(goodid int64, sum_count int64, orgid int64) error {
8135
-	tx := XTWriteDB().Begin()
8136
-	err = tx.Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8137
-	if err != nil {
8138
-		tx.Rollback()
8139
-		return err
8140
-	}
8141
-	tx.Commit()
8135
+
8136
+	err = XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
8142 8137
 	return err
8143 8138
 
8144 8139
 }
@@ -8892,6 +8887,25 @@ func GetGoodTypeObj(goodid int64, org_id int64) (models.GoodsType, error) {
8892 8887
 	return goodsType, err
8893 8888
 }
8894 8889
 
8890
+func GetAllGoodTypeName(good_type_id int64, org_id int64) (good_type_name string) {
8891
+
8892
+	goodsTypeList, _ := GetAllGoodType(org_id)
8893
+	for _, item := range goodsTypeList {
8894
+		if good_type_id == item.ID {
8895
+			good_type_name = item.TypeName
8896
+		}
8897
+	}
8898
+	return good_type_name
8899
+}
8900
+
8901
+func UpdateGoodTypeName(good_id int64, good_type_name string) (models.GoodInformation, error) {
8902
+
8903
+	information := models.GoodInformation{}
8904
+
8905
+	err := XTWriteDB().Model(&information).Where("id = ? and status =1", good_id).Updates(map[string]interface{}{"good_type_name": good_type_name}).Error
8906
+	return information, err
8907
+}
8908
+
8895 8909
 func GetSencondeGoodWarehouseInfo(good_id int64, org_id int64) (info []*models.WarehousingInfo, err error) {
8896 8910
 
8897 8911
 	err = XTReadDB().Where("good_id = ? and org_id= ? and status= 1 and is_check = 1", good_id, org_id).Find(&info).Error