28169 3 weken geleden
bovenliggende
commit
30e6785b70

+ 0 - 4
.idea/.gitignore Bestand weergeven

1
-# Default ignored files
2
-/workspace.xml
3
-# Datasource local storage ignored files
4
-/dataSources.local.xml

+ 0 - 5
.idea/codeStyles/codeStyleConfig.xml Bestand weergeven

1
-<component name="ProjectCodeStyleConfiguration">
2
-  <state>
3
-    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
-  </state>
5
-</component>

+ 0 - 12
.idea/dataSources.xml Bestand weergeven

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
4
-    <data-source source="LOCAL" name="@rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com" uuid="a5e97996-c706-42df-9eba-66746647237e">
5
-      <driver-ref>mysql.8</driver-ref>
6
-      <synchronize>true</synchronize>
7
-      <remarks>lijc de database</remarks>
8
-      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
9
-      <jdbc-url>jdbc:mysql://rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com:3306</jdbc-url>
10
-    </data-source>
11
-  </component>
12
-</project>

+ 0 - 4
.idea/encodings.xml Bestand weergeven

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
-</project>

+ 0 - 26
.idea/misc.xml Bestand weergeven

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="JavaScriptSettings">
4
-    <option name="languageLevel" value="ES6" />
5
-  </component>
6
-  <component name="SvnBranchConfigurationManager">
7
-    <option name="myConfigurationMap">
8
-      <map>
9
-        <entry key="$PROJECT_DIR$/../CDM">
10
-          <value>
11
-            <SvnBranchConfiguration>
12
-              <option name="trunkUrl" value="svn://112.74.16.180/Product/SGJ/SGJ1.0/Project/SGJ1.0/Application/MBGL" />
13
-            </SvnBranchConfiguration>
14
-          </value>
15
-        </entry>
16
-        <entry key="$PROJECT_DIR$/../SYB_Admin">
17
-          <value>
18
-            <SvnBranchConfiguration>
19
-              <option name="trunkUrl" value="svn://112.74.16.180/Product/SYB/SYB1.0/Application/SYB_Admin" />
20
-            </SvnBranchConfiguration>
21
-          </value>
22
-        </entry>
23
-      </map>
24
-    </option>
25
-  </component>
26
-</project>

+ 0 - 5
.idea/vcs.xml Bestand weergeven

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <project version="4">
2
 <project version="4">
3
-  <component name="GitSharedSettings">
4
-    <option name="FORCE_PUSH_PROHIBITED_PATTERNS">
5
-      <list />
6
-    </option>
7
-  </component>
8
   <component name="VcsDirectoryMappings">
3
   <component name="VcsDirectoryMappings">
9
     <mapping directory="$PROJECT_DIR$" vcs="Git" />
4
     <mapping directory="$PROJECT_DIR$" vcs="Git" />
10
   </component>
5
   </component>

BIN
XT_New.exe Bestand weergeven


+ 13 - 0
conf/app.conf Bestand weergeven

65
 readmysqlpass2 = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
65
 readmysqlpass2 = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
66
 readmysqlname2 = sgj_xt
66
 readmysqlname2 = sgj_xt
67
 
67
 
68
+readmysqlhost3 = rm-wz9r3iil42mn24675oo.mysql.rds.aliyuncs.com
69
+readmysqlport3 = 3306
70
+readmysqluser3 = syh
71
+readmysqlpass3 = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
72
+readmysqlname3 = sgj_xt
73
+
74
+
68
 writemysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
75
 writemysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
69
 writemysqlport = 3306
76
 writemysqlport = 3306
70
 writemysqluser = syh
77
 writemysqluser = syh
103
 readsgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
110
 readsgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
104
 readsgjpatientmysqlname = sgj_patient
111
 readsgjpatientmysqlname = sgj_patient
105
 
112
 
113
+
114
+
106
 writesgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
115
 writesgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
107
 writesgjpatientmysqlport = 3306
116
 writesgjpatientmysqlport = 3306
108
 writesgjpatientmysqluser = syh
117
 writesgjpatientmysqluser = syh
116
 readpatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
125
 readpatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
117
 readpatientname = sgj_cdm
126
 readpatientname = sgj_cdm
118
 
127
 
128
+
129
+
119
 writepatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
130
 writepatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
120
 writepatientport = 3306
131
 writepatientport = 3306
121
 writepatientuser = syh
132
 writepatientuser = syh
122
 writepatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
133
 writepatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
123
 writepatientname = sgj_cdm
134
 writepatientname = sgj_cdm
124
 
135
 
136
+
137
+
125
 redishost = kuyicloud.redis.rds.aliyuncs.com
138
 redishost = kuyicloud.redis.rds.aliyuncs.com
126
 redisport = 6379
139
 redisport = 6379
127
 redispasswrod = 1Q2W3e4r!@#$
140
 redispasswrod = 1Q2W3e4r!@#$

+ 4 - 4
controllers/base_api_controller.go Bestand weergeven

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10164 //机构id
86
+		subscibe.OrgId = 10744 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10744 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 18470 //4
97
 		adminUserInfo.CurrentAppId = 18470 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10164 //机构id小英9675或4
332
+		subscibe.OrgId = 10744 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10744 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 18470 //4
343
 		adminUserInfo.CurrentAppId = 18470 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 18 - 7
controllers/dialysis_api_controller.go Bestand weergeven

2500
 
2500
 
2501
 			}
2501
 			}
2502
 		}
2502
 		}
2503
+
2504
+		if adminUserInfo.CurrentOrgId == 10744 {
2505
+			evaluation, _ := service.GetAssessmentBeforThrity(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2506
+			if evaluation.WeightBefore > 0 {
2507
+				assessment.WeightLoss = evaluation.WeightBefore - assessment.WeightAfter
2508
+			}
2509
+
2510
+		}
2511
+
2503
 		err = service.UpdateAssessmentAfterDislysisRecord(&assessment)
2512
 		err = service.UpdateAssessmentAfterDislysisRecord(&assessment)
2504
 		//记录日志
2513
 		//记录日志
2505
 		byterequest, _ := json.Marshal(assessment)
2514
 		byterequest, _ := json.Marshal(assessment)
3529
 				}
3538
 				}
3530
 			}
3539
 			}
3531
 
3540
 
3532
-			if assessmentBeforeDislysis.ID > 0 {
3533
-				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3534
-				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3535
-					dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3536
-					if adminUserInfo.CurrentOrgId == 10751 {
3537
-						dewater_amount = dewater_amount * 1000
3541
+			if adminUserInfo.CurrentOrgId != 10751 {
3542
+				if assessmentBeforeDislysis.ID > 0 {
3543
+					dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3544
+					if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3545
+						dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3546
+						//if adminUserInfo.CurrentOrgId == 10751 {
3547
+						//	dewater_amount = dewater_amount * 1000
3548
+						//}
3549
+						service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
3538
 					}
3550
 					}
3539
-					service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
3540
 				}
3551
 				}
3541
 			}
3552
 			}
3542
 
3553
 

+ 13 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Bestand weergeven

882
 			evaluation.UserOrgId = adminUserInfo.Org.Id
882
 			evaluation.UserOrgId = adminUserInfo.Org.Id
883
 			// 获取上一次透前评估信息,部分数据是需要从上一次透前评估继承
883
 			// 获取上一次透前评估信息,部分数据是需要从上一次透前评估继承
884
 			lastPredialysisEvaluation, _ := service.MobileGetLastTimePredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
884
 			lastPredialysisEvaluation, _ := service.MobileGetLastTimePredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
885
+
885
 			// 获取上一次透后评估,插入本次透前评估的上次透后体重(weight_after_last_transparency)字段
886
 			// 获取上一次透后评估,插入本次透前评估的上次透后体重(weight_after_last_transparency)字段
886
 			assessmentAfterDislysis, getAADErr := service.MobileGetLastTimeAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
887
 			assessmentAfterDislysis, getAADErr := service.MobileGetLastTimeAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
887
 			if getAADErr != nil {
888
 			if getAADErr != nil {
968
 				if adminUserInfo.Org.Id == 10702 {
969
 				if adminUserInfo.Org.Id == 10702 {
969
 					evaluation.PulseFrequency = 0
970
 					evaluation.PulseFrequency = 0
970
 				}
971
 				}
972
+				if adminUserInfo.Org.Id == 10121 || adminUserInfo.Org.Id == 10234 {
973
+					evaluation.Height = lastPredialysisEvaluation.Height
974
+				}
971
 			}
975
 			}
972
 		} else {
976
 		} else {
973
 			evaluation.UpdatedTime = time.Now().Unix()
977
 			evaluation.UpdatedTime = time.Now().Unix()
1073
 		}
1077
 		}
1074
 
1078
 
1075
 		afterevaluation.WeightAfter = weight_after
1079
 		afterevaluation.WeightAfter = weight_after
1080
+
1076
 		afterevaluation.WeightLoss = weight_loss
1081
 		afterevaluation.WeightLoss = weight_loss
1077
 
1082
 
1078
 		if adminUserInfo.Org.Id == 10138 {
1083
 		if adminUserInfo.Org.Id == 10138 {
1148
 			afterevaluation.Temperature = 36.5
1153
 			afterevaluation.Temperature = 36.5
1149
 		}
1154
 		}
1150
 
1155
 
1156
+		if adminUserInfo.Org.Id == 10744 {
1157
+			evaluation, _ := service.GetAssessmentBeforThrity(adminUserInfo.Org.Id, id, theAssessmentDateTime)
1158
+			if evaluation.WeightBefore > 0 {
1159
+				afterevaluation.WeightLoss = evaluation.WeightBefore - weight_after
1160
+			}
1161
+
1162
+		}
1163
+
1151
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
1164
 		err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
1152
 
1165
 
1153
 		//记录日志
1166
 		//记录日志

+ 20 - 9
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

1538
 					infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id, 4)
1538
 					infor, _ := service.GetDialysisInformationByRecordDate(advices.PatientId, advices.AdviceDate, adminUserInfo.Org.Id, 4)
1539
 					//申请状态不允许的情况 拒绝修改
1539
 					//申请状态不允许的情况 拒绝修改
1540
 					if infor.ApplicationStatus != 1 {
1540
 					if infor.ApplicationStatus != 1 {
1541
+
1541
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1542
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInformationExist)
1542
 						return
1543
 						return
1544
+
1543
 					}
1545
 					}
1544
 
1546
 
1545
 				}
1547
 				}
1649
 
1651
 
1650
 		storeHouseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.Org.Id)
1652
 		storeHouseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.Org.Id)
1651
 
1653
 
1652
-		if drugStockConfig.IsOpen == 1 {
1654
+		if drugStockConfig.IsOpen == 1 && adminUserInfo.Org.Id != 10644 && adminUserInfo.Org.Id != 10721 {
1653
 			if groupno > 0 {
1655
 			if groupno > 0 {
1654
 				advices, _ := service.FindAllDoctorAdviceByGoroupNoTwety(adminUserInfo.Org.Id, groupno)
1656
 				advices, _ := service.FindAllDoctorAdviceByGoroupNoTwety(adminUserInfo.Org.Id, groupno)
1655
 
1657
 
2182
 			// 查询信息规挡的设置天数
2184
 			// 查询信息规挡的设置天数
2183
 
2185
 
2184
 			infor, _ := service.GetDialysisInformationSetting(item.UserOrgId)
2186
 			infor, _ := service.GetDialysisInformationSetting(item.UserOrgId)
2187
+
2188
+			fmt.Println("infor==================", infor.ID)
2185
 			if infor.ID > 0 {
2189
 			if infor.ID > 0 {
2186
 
2190
 
2187
 				var cha_time int64
2191
 				var cha_time int64
2288
 								PrescribingNumberUnit: item.PrescribingNumberUnit,
2292
 								PrescribingNumberUnit: item.PrescribingNumberUnit,
2289
 							}
2293
 							}
2290
 							service.CreateDrugError(drugError)
2294
 							service.CreateDrugError(drugError)
2295
+							tx.Rollback()
2291
 						}
2296
 						}
2292
 					}
2297
 					}
2293
 					advice, _ := service.FindHisDoctorAdviceByIdTwo(adminInfo.Org.Id, item.ID, tx)
2298
 					advice, _ := service.FindHisDoctorAdviceByIdTwo(adminInfo.Org.Id, item.ID, tx)
2451
 						}
2456
 						}
2452
 					}
2457
 					}
2453
 
2458
 
2459
+					fmt.Println("prescribing_number_total", prescribing_number_total)
2460
+					fmt.Println("total------------", total)
2461
+
2454
 					if prescribing_number_total <= total {
2462
 					if prescribing_number_total <= total {
2455
 
2463
 
2456
 						pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
2464
 						pharmacyConfig, _ := service.FindPharmacyConfig(advice.UserOrgId)
4607
 			}
4615
 			}
4608
 		}
4616
 		}
4609
 
4617
 
4610
-		if evaluation.ID > 0 {
4611
-			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4612
-			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4613
-				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4614
-				if adminUserInfo.Org.Id == 10751 {
4615
-					dewater_amount = dewater_amount * 1000
4618
+		if adminUserInfo.Org.Id != 10751 {
4619
+			if evaluation.ID > 0 {
4620
+				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4621
+				if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4622
+					dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4623
+					//if adminUserInfo.Org.Id == 10751 {
4624
+					//	dewater_amount = dewater_amount * 1000
4625
+					//}
4626
+					service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
4616
 				}
4627
 				}
4617
-				service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
4618
 			}
4628
 			}
4619
 		}
4629
 		}
4620
 
4630
 
6337
 func (c *PatientApiController) CreateGroupAdvice() {
6347
 func (c *PatientApiController) CreateGroupAdvice() {
6338
 	is_child, _ := c.GetInt64("is_child", 0)
6348
 	is_child, _ := c.GetInt64("is_child", 0)
6339
 
6349
 
6350
+	fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh", is_child)
6340
 	if is_child == 1 {
6351
 	if is_child == 1 {
6341
 		patient, _ := c.GetInt64("id", 0)
6352
 		patient, _ := c.GetInt64("id", 0)
6342
 		if patient <= 0 {
6353
 		if patient <= 0 {
7020
 				}
7031
 				}
7021
 			}
7032
 			}
7022
 
7033
 
7023
-			err = service.DeleteDoctorAdviceByGroupNo(&advice)
7034
+			err = service.DeleteDoctorAdviceByGroupNoOne(&advice)
7024
 			//记录日志
7035
 			//记录日志
7025
 			byterequest, _ := json.Marshal(advice)
7036
 			byterequest, _ := json.Marshal(advice)
7026
 			adviceLog := models.XtDoctorAdviceLog{
7037
 			adviceLog := models.XtDoctorAdviceLog{

+ 154 - 11
controllers/patient_api_controller.go Bestand weergeven

225
 
225
 
226
 	beego.Router("/api/patient/getinspectionbyprojectid", &PatientApiController{}, "Get:GetInspectionByProjectId")
226
 	beego.Router("/api/patient/getinspectionbyprojectid", &PatientApiController{}, "Get:GetInspectionByProjectId")
227
 
227
 
228
+	beego.Router("/api/patient/getpatientmaplist", &PatientApiController{}, "Get:GetPatientMapList")
229
+
230
+	beego.Router("/api/patient/savepatientcount", &PatientApiController{}, "Get:SavePatientCount")
231
+
232
+	beego.Router("/api/patient/getpatientcount", &PatientApiController{}, "Get:GetPatientCountList")
233
+
234
+	beego.Router("/api/patient/checkpatientcount", &PatientApiController{}, "Get:CheckPatientCount")
235
+
236
+	beego.Router("/api/patient/returncheckpatientcount", &PatientApiController{}, "Get:ReturnCheckPatientCount")
237
+
228
 }
238
 }
229
 func (c *PatientApiController) GetExportList() {
239
 func (c *PatientApiController) GetExportList() {
230
 	startTime := c.GetString("start_time")
240
 	startTime := c.GetString("start_time")
1520
 }
1530
 }
1521
 
1531
 
1522
 func (c *PatientApiController) CreateGroupAdvice() {
1532
 func (c *PatientApiController) CreateGroupAdvice() {
1533
+
1523
 	var err error
1534
 	var err error
1524
 	defer func() {
1535
 	defer func() {
1525
 		if rec := recover(); rec != nil {
1536
 		if rec := recover(); rec != nil {
1554
 	}
1565
 	}
1555
 	utils.ErrorLog("%v", dataBody)
1566
 	utils.ErrorLog("%v", dataBody)
1556
 
1567
 
1557
-	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1558
-	if appRole.UserType == 3 {
1559
-		headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
1560
-		if getPermissionErr != nil {
1561
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1562
-			return
1563
-		} else if headNursePermission == nil {
1564
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateAdvice)
1565
-			return
1566
-		}
1567
-	}
1568
+	//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1569
+	//if appRole.UserType == 3 {
1570
+	//	headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
1571
+	//	if getPermissionErr != nil {
1572
+	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1573
+	//		return
1574
+	//	} else if headNursePermission == nil {
1575
+	//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateAdvice)
1576
+	//		return
1577
+	//	}
1578
+	//}
1568
 
1579
 
1569
 	timeLayout := "2006-01-02"
1580
 	timeLayout := "2006-01-02"
1570
 	loc, _ := time.LoadLocation("Local")
1581
 	loc, _ := time.LoadLocation("Local")
1575
 		return
1586
 		return
1576
 	}
1587
 	}
1577
 	adviceType := int64(dataBody["advice_type"].(float64))
1588
 	adviceType := int64(dataBody["advice_type"].(float64))
1589
+
1590
+	fmt.Println("adviceType----------------", adviceType)
1578
 	if adviceType != 1 && adviceType != 2 && adviceType != 3 && adviceType != 4 {
1591
 	if adviceType != 1 && adviceType != 2 && adviceType != 3 && adviceType != 4 {
1579
 		utils.ErrorLog("advice_type != 1&&2")
1592
 		utils.ErrorLog("advice_type != 1&&2")
1580
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1593
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
9060
 		"inspection": inspection,
9073
 		"inspection": inspection,
9061
 	})
9074
 	})
9062
 }
9075
 }
9076
+
9077
+func (this *PatientApiController) GetPatientMapList() {
9078
+
9079
+	keyword := this.GetString("keyword")
9080
+	orgId := this.GetAdminUserInfo().CurrentOrgId
9081
+
9082
+	patient, _ := service.GetPatientMapList(orgId, keyword)
9083
+
9084
+	this.ServeSuccessJSON(map[string]interface{}{
9085
+		"patient": patient,
9086
+	})
9087
+}
9088
+
9089
+func (this *PatientApiController) SavePatientCount() {
9090
+
9091
+	orgId := this.GetAdminUserInfo().CurrentOrgId
9092
+
9093
+	creater := this.GetAdminUserInfo().AdminUser.Id
9094
+
9095
+	patient_id, _ := this.GetInt64("patient_id")
9096
+
9097
+	hd_count, _ := this.GetInt64("hd_count")
9098
+
9099
+	hdf_count, _ := this.GetInt64("hdf_count")
9100
+
9101
+	hdhp_count, _ := this.GetInt64("hdhp_count")
9102
+
9103
+	hp_count, _ := this.GetInt64("hp_count")
9104
+
9105
+	other_count, _ := this.GetInt64("other_count")
9106
+
9107
+	remark := this.GetString("remark")
9108
+
9109
+	recordDateStr := time.Now().Format("2006-01-02")
9110
+	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
9111
+
9112
+	nowtime := recordDate.Unix()
9113
+
9114
+	patientInCount := models.SfPatientInCount{
9115
+		PatientId:  patient_id,
9116
+		UserOrgId:  orgId,
9117
+		HdCount:    hd_count,
9118
+		HdfCount:   hdf_count,
9119
+		HdhpCount:  hdhp_count,
9120
+		HpCount:    hp_count,
9121
+		Status:     1,
9122
+		Creater:    creater,
9123
+		Ctime:      time.Now().Unix(),
9124
+		Mtime:      time.Now().Unix(),
9125
+		IsCheck:    2,
9126
+		RecordDate: nowtime,
9127
+		Remark:     remark,
9128
+		OtherCount: other_count,
9129
+	}
9130
+
9131
+	fmt.Println(patientInCount)
9132
+
9133
+	db := service.XTWriteDB()
9134
+	// 开始外部循环的事务
9135
+	tx := db.Begin()
9136
+	// 在函数结束时处理事务回滚
9137
+	defer func() {
9138
+		if r := recover(); r != nil {
9139
+			tx.Rollback()
9140
+		}
9141
+	}()
9142
+
9143
+	service.CreatePatientInCount(tx, patientInCount)
9144
+
9145
+	service.ModifyPatientCount(tx, hd_count, hdf_count, hdhp_count, hp_count, patient_id)
9146
+
9147
+	tx.Commit()
9148
+
9149
+	this.ServeSuccessJSON(map[string]interface{}{
9150
+		"patientInCount": patientInCount,
9151
+	})
9152
+
9153
+}
9154
+
9155
+func (this *PatientApiController) GetPatientCountList() {
9156
+
9157
+	orgId := this.GetAdminUserInfo().CurrentOrgId
9158
+	patient_id, _ := this.GetInt64("patient_id")
9159
+	page, _ := this.GetInt64("page")
9160
+	limit, _ := this.GetInt64("limit")
9161
+	patient, total, _ := service.GetPatientCountList(orgId, patient_id, page, limit)
9162
+
9163
+	this.ServeSuccessJSON(map[string]interface{}{
9164
+		"patient": patient,
9165
+		"total":   total,
9166
+	})
9167
+}
9168
+
9169
+func (this *PatientApiController) CheckPatientCount() {
9170
+
9171
+	id, _ := this.GetInt64("id")
9172
+
9173
+	checkpatientcount, _ := service.CheckPatientCount(id)
9174
+
9175
+	this.ServeSuccessJSON(map[string]interface{}{
9176
+		"checkpatientcount": checkpatientcount,
9177
+	})
9178
+}
9179
+
9180
+func (this *PatientApiController) ReturnCheckPatientCount() {
9181
+
9182
+	id, _ := this.GetInt64("id")
9183
+
9184
+	db := service.XTWriteDB()
9185
+	// 开始外部循环的事务
9186
+	tx := db.Begin()
9187
+	// 在函数结束时处理事务回滚
9188
+	defer func() {
9189
+		if r := recover(); r != nil {
9190
+			tx.Rollback()
9191
+		}
9192
+	}()
9193
+
9194
+	patientCount, _ := service.ReturnCheckPatientCount(id)
9195
+
9196
+	patientCountObj, _ := service.GetPatientCountById(id)
9197
+
9198
+	service.UpdatePatientInCount(tx, patientCountObj.HdCount, patientCountObj.HdfCount, patientCountObj.HdhpCount, patientCountObj.HpCount, patientCountObj.PatientId)
9199
+
9200
+	tx.Commit()
9201
+	this.ServeSuccessJSON(map[string]interface{}{
9202
+		"patientCount": patientCount,
9203
+	})
9204
+
9205
+}

+ 66 - 51
controllers/sign_api_controller.go Bestand weergeven

1525
 
1525
 
1526
 	//
1526
 	//
1527
 
1527
 
1528
-	adviceInfo, _ := service.GetHisDoctorAdviceByUserOrgId(10752)
1529
-	adminInfo := this.GetAdminUserInfo()
1530
-	db := service.XTWriteDB()
1531
-	tx := db.Begin()
1532
-	if len(adviceInfo) > 0 {
1533
-		for _, item := range adviceInfo {
1534
-
1535
-			drug, _ := service.FindBaseDrugLibRecordSeven(adminInfo.CurrentOrgId, item.DrugId)
1536
-			var local_count int64
1537
-			if item.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
1538
-
1539
-				prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1540
-				prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1541
-
1542
-				local_count += prescribingNumberSevenTy * drug.MinNumber
1543
-			}
1544
-
1545
-			if item.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
1546
-
1547
-				prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1548
-				prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1549
-				local_count += prescribingNumberSevenTy
1550
-			}
1551
-
1552
-			if item.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
1553
-
1554
-				prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1555
-				prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1556
-				local_count += prescribingNumberSevenTy
1557
-			}
1558
-
1559
-			item.PrescribingNumberUnit = drug.MinUnit
1560
-
1561
-			service.BloodNewHisDrugsDelivery(item.UserOrgId, 5685, item, tx)
1528
+	//adviceInfo, _ := service.GetHisDoctorAdviceByUserOrgId(10752)
1529
+	//adminInfo := this.GetAdminUserInfo()
1530
+	//db := service.XTWriteDB()
1531
+	//tx := db.Begin()
1532
+	//if len(adviceInfo) > 0 {
1533
+	//	for _, item := range adviceInfo {
1534
+	//
1535
+	//		drug, _ := service.FindBaseDrugLibRecordSeven(adminInfo.CurrentOrgId, item.DrugId)
1536
+	//		var local_count int64
1537
+	//		if item.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
1538
+	//
1539
+	//			prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1540
+	//			prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1541
+	//
1542
+	//			local_count += prescribingNumberSevenTy * drug.MinNumber
1543
+	//		}
1544
+	//
1545
+	//		if item.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
1546
+	//
1547
+	//			prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1548
+	//			prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1549
+	//			local_count += prescribingNumberSevenTy
1550
+	//		}
1551
+	//
1552
+	//		if item.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
1553
+	//
1554
+	//			prescribingNumberTenty := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 64)
1555
+	//			prescribingNumberSevenTy, _ := strconv.ParseInt(prescribingNumberTenty, 10, 64)
1556
+	//			local_count += prescribingNumberSevenTy
1557
+	//		}
1558
+	//
1559
+	//		item.PrescribingNumberUnit = drug.MinUnit
1560
+	//
1561
+	//		service.BloodNewHisDrugsDelivery(item.UserOrgId, 5685, item, tx)
1562
+	//
1563
+	//		storeConfig, _ := service.GetNewAllStoreHouseConfig(item.UserOrgId, tx)
1564
+	//
1565
+	//		stockInfo, _ := service.GetNewDrugAllStockInfo(storeConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId, tx)
1566
+	//		var sum_count int64
1567
+	//		for _, its := range stockInfo {
1568
+	//			baseDrug, _ := service.GetNewBaseDrugMedical(its.DrugId, tx)
1569
+	//			if its.MaxUnit == baseDrug.MaxUnit {
1570
+	//				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
1571
+	//			}
1572
+	//			sum_count += its.StockMaxNumber + its.StockMinNumber
1573
+	//		}
1574
+	//		//更新基础库存
1575
+	//		service.UpdateNewBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId, tx)
1576
+	//		//剩余库存
1577
+	//		service.UpdateNewDrugStockCount(item.DrugId, item.UserOrgId, storeConfig.DrugStorehouseOut, sum_count, tx)
1578
+	//
1579
+	//		over, _ := service.FindNewOverCount(item.DrugId, item.UserOrgId, storeConfig.DrugStorehouseOut, tx)
1580
+	//		service.UpdateNewActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount, tx)
1581
+	//	}
1582
+	//}
1562
 
1583
 
1563
-			storeConfig, _ := service.GetNewAllStoreHouseConfig(item.UserOrgId, tx)
1584
+	//tx.Commit()
1585
+	schedule, _ := service.CheckSchedule()
1564
 
1586
 
1565
-			stockInfo, _ := service.GetNewDrugAllStockInfo(storeConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId, tx)
1566
-			var sum_count int64
1567
-			for _, its := range stockInfo {
1568
-				baseDrug, _ := service.GetNewBaseDrugMedical(its.DrugId, tx)
1569
-				if its.MaxUnit == baseDrug.MaxUnit {
1570
-					its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
1571
-				}
1572
-				sum_count += its.StockMaxNumber + its.StockMinNumber
1573
-			}
1574
-			//更新基础库存
1575
-			service.UpdateNewBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId, tx)
1576
-			//剩余库存
1577
-			service.UpdateNewDrugStockCount(item.DrugId, item.UserOrgId, storeConfig.DrugStorehouseOut, sum_count, tx)
1587
+	if len(schedule) > 0 {
1588
+		for _, item := range schedule {
1589
+			fmt.Println("item.p------------------", item.PatientId)
1578
 
1590
 
1579
-			over, _ := service.FindNewOverCount(item.DrugId, item.UserOrgId, storeConfig.DrugStorehouseOut, tx)
1580
-			service.UpdateNewActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount, tx)
1591
+			service.UpdateScheduleByIdOneList(item.ID, item.ScheduleDate, item.ScheduleType, item.ScheduleWeek, item.Status, item.PatientId, item.PartitionId, item.BedId, item.DialysisMachineName, item.UserOrgId, item.ModeId)
1581
 		}
1592
 		}
1582
 	}
1593
 	}
1583
 
1594
 
1584
-	tx.Commit()
1585
 	this.ServeSuccessJSON(map[string]interface{}{
1595
 	this.ServeSuccessJSON(map[string]interface{}{
1586
 		"msg": "ok",
1596
 		"msg": "ok",
1587
 	})
1597
 	})
1811
 		"msg": "ok",
1821
 		"msg": "ok",
1812
 	})
1822
 	})
1813
 }
1823
 }
1824
+
1825
+func (this *SignApiController) CheckSchedule() {
1826
+
1827
+	service.CheckSchedule()
1828
+}

+ 1 - 0
models/dialysis.go Bestand weergeven

346
 	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
346
 	SystolicBloodPressure  float64 `gorm:"column:systolic_blood_pressure" json:"systolic_blood_pressure"`
347
 	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
347
 	DiastolicBloodPressure float64 `gorm:"column:diastolic_blood_pressure" json:"diastolic_blood_pressure"`
348
 	DryWeight              float64 `gorm:"column:dry_weight" json:"dry_weight"`
348
 	DryWeight              float64 `gorm:"column:dry_weight" json:"dry_weight"`
349
+	Height                 int64   `gorm:"column:height" json:"height" form:"height"`
349
 }
350
 }
350
 
351
 
351
 func (PredialysisEvaluationList) TableName() string {
352
 func (PredialysisEvaluationList) TableName() string {

+ 40 - 0
models/patient_models.go Bestand weergeven

27
 	ScheduleRemark     string `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
27
 	ScheduleRemark     string `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
28
 	FirstLetter        string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
28
 	FirstLetter        string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
29
 	IsInfectious       int64  `gorm:"column:is_infectious" json:"is_infectious" form:"is_infectious"`
29
 	IsInfectious       int64  `gorm:"column:is_infectious" json:"is_infectious" form:"is_infectious"`
30
+	Height             int64  `gorm:"column:height" json:"height" form:"height"`
30
 }
31
 }
31
 
32
 
32
 func (MSchedualPatientList) TableName() string {
33
 func (MSchedualPatientList) TableName() string {
3121
 	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3122
 	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3122
 	Count        int64
3123
 	Count        int64
3123
 }
3124
 }
3125
+
3126
+type SfPatients struct {
3127
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
3128
+	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3129
+	Name        string `gorm:"column:name" json:"name" form:"name"`
3130
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
3131
+	Lapseto     int64  `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
3132
+	FirstLetter string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
3133
+	HdCount     int64  `gorm:"column:hd_count" json:"hd_count" form:"hd_count"`
3134
+	HdfCount    int64  `gorm:"column:hdf_count" json:"hdf_count" form:"hdf_count"`
3135
+	HdhpCount   int64  `gorm:"column:hdhp_count" json:"hdhp_count" form:"hdhp_count"`
3136
+	HpCount     int64  `gorm:"column:hp_count" json:"hp_count" form:"hp_count"`
3137
+}
3138
+
3139
+func (SfPatients) TableName() string {
3140
+	return "xt_patients"
3141
+}
3142
+
3143
+type SfPatientInCount struct {
3144
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
3145
+	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3146
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3147
+	HdCount    int64  `gorm:"column:hd_count" json:"hd_count" form:"hd_count"`
3148
+	HdfCount   int64  `gorm:"column:hdf_count" json:"hdf_count" form:"hdf_count"`
3149
+	HdhpCount  int64  `gorm:"column:hdhp_count" json:"hdhp_count" form:"hdhp_count"`
3150
+	HpCount    int64  `gorm:"column:hp_count" json:"hp_count" form:"hp_count"`
3151
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
3152
+	Creater    int64  `gorm:"column:creater" json:"creater" form:"creater"`
3153
+	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
3154
+	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
3155
+	IsCheck    int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
3156
+	RecordDate int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
3157
+	Remark     string `gorm:"column:remark" json:"remark" form:"remark"`
3158
+	OtherCount int64  `gorm:"column:other_count" json:"other_count" form:"other_count"`
3159
+}
3160
+
3161
+func (SfPatientInCount) TableName() string {
3162
+	return "xt_patient_in_count"
3163
+}

+ 17 - 0
service/db.go Bestand weergeven

26
 
26
 
27
 var readDb *gorm.DB
27
 var readDb *gorm.DB
28
 var readDb2 *gorm.DB
28
 var readDb2 *gorm.DB
29
+var readDb3 *gorm.DB
29
 var writeDb *gorm.DB
30
 var writeDb *gorm.DB
30
 var readUserDb *gorm.DB
31
 var readUserDb *gorm.DB
31
 var writeUserDb *gorm.DB
32
 var writeUserDb *gorm.DB
33
 var readMiddleDb *gorm.DB
34
 var readMiddleDb *gorm.DB
34
 var writeMiddleDb *gorm.DB
35
 var writeMiddleDb *gorm.DB
35
 
36
 
37
+var newReadMiddleDb *gorm.DB
38
+
36
 var readPatientDb *gorm.DB
39
 var readPatientDb *gorm.DB
37
 var writePatientDb *gorm.DB
40
 var writePatientDb *gorm.DB
38
 
41
 
57
 	readPass2 := beego.AppConfig.String("readmysqlpass2")
60
 	readPass2 := beego.AppConfig.String("readmysqlpass2")
58
 	readName2 := beego.AppConfig.String("readmysqlname2")
61
 	readName2 := beego.AppConfig.String("readmysqlname2")
59
 
62
 
63
+	readHost3 := beego.AppConfig.String("readmysqlhost3")
64
+	readPort3 := beego.AppConfig.String("readmysqlport3")
65
+	readUser3 := beego.AppConfig.String("readmysqluser3")
66
+	readPass3 := beego.AppConfig.String("readmysqlpass3")
67
+	readName3 := beego.AppConfig.String("readmysqlname3")
68
+
60
 	writeHost := beego.AppConfig.String("writemysqlhost")
69
 	writeHost := beego.AppConfig.String("writemysqlhost")
61
 	writePort := beego.AppConfig.String("writemysqlport")
70
 	writePort := beego.AppConfig.String("writemysqlport")
62
 	writeUser := beego.AppConfig.String("writemysqluser")
71
 	writeUser := beego.AppConfig.String("writemysqluser")
127
 
136
 
128
 	rdsn2 := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser2, readPass2, readHost2, readPort2, readName2)
137
 	rdsn2 := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser2, readPass2, readHost2, readPort2, readName2)
129
 
138
 
139
+	rdsn3 := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser3, readPass3, readHost3, readPort3, readName3)
140
+
130
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
141
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
131
 
142
 
132
 	rudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUser, readUserPass, readUserHost, readUserPort, readUserName)
143
 	rudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUser, readUserPass, readUserHost, readUserPort, readUserName)
146
 
157
 
147
 	readDb2, err = gorm.Open("mysql", rdsn2)
158
 	readDb2, err = gorm.Open("mysql", rdsn2)
148
 
159
 
160
+	readDb3, err = gorm.Open("mysql", rdsn3)
161
+
149
 	readDb, err = gorm.Open("mysql", rdsn)
162
 	readDb, err = gorm.Open("mysql", rdsn)
150
 	if err != nil {
163
 	if err != nil {
151
 		//beego.Error(err)
164
 		//beego.Error(err)
158
 	readDb2.DB().SetMaxOpenConns(100)
171
 	readDb2.DB().SetMaxOpenConns(100)
159
 	readDb2.LogMode(true)
172
 	readDb2.LogMode(true)
160
 
173
 
174
+	readDb3.DB().SetMaxIdleConns(10)
175
+	readDb3.DB().SetMaxOpenConns(100)
176
+	readDb3.LogMode(true)
177
+
161
 	writeDb, err = gorm.Open("mysql", wdsn)
178
 	writeDb, err = gorm.Open("mysql", wdsn)
162
 	if err != nil {
179
 	if err != nil {
163
 		//beego.Error(err)
180
 		//beego.Error(err)

+ 12 - 0
service/dialysis_service.go Bestand weergeven

1074
 	return
1074
 	return
1075
 }
1075
 }
1076
 
1076
 
1077
+func DeleteDoctorAdviceByGroupNoOne(m *models.DoctorAdvice) (err error) {
1078
+	ut := writeDb.Begin()
1079
+	err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ? AND user_org_id =  ? and patient_id = ? and advice_date = ?", m.GroupNo, m.UserOrgId, m.PatientId, m.AdviceDate).Update(map[string]interface{}{"UpdatedTime": m.UpdatedTime, "Status": 0, "modifier": m.Modifier}).Error
1080
+	if err != nil {
1081
+		ut.Rollback()
1082
+		return
1083
+	}
1084
+	ut.Commit()
1085
+
1086
+	return
1087
+}
1088
+
1077
 func GetDialysisBoard(orgID int64, scheduleDate int64, offset, limit int64) ([]*models.DialysisBoardVM, error) {
1089
 func GetDialysisBoard(orgID int64, scheduleDate int64, offset, limit int64) ([]*models.DialysisBoardVM, error) {
1078
 	var boards []*models.DialysisBoardVM
1090
 	var boards []*models.DialysisBoardVM
1079
 	db := readDb.
1091
 	db := readDb.

+ 1 - 1
service/mobile_dialysis_service.go Bestand weergeven

195
 	SchRemark          string `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
195
 	SchRemark          string `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
196
 	ScheduleRemark     string `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
196
 	ScheduleRemark     string `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
197
 	FirstLetter        string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
197
 	FirstLetter        string `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
198
+	Height             int64  `gorm:"column:height" json:"height" form:"height"`
198
 }
199
 }
199
 
200
 
200
 func (MSchedualPatientVMList) TableName() string {
201
 func (MSchedualPatientVMList) TableName() string {
8619
 		}
8620
 		}
8620
 		if patient_id > 0 {
8621
 		if patient_id > 0 {
8621
 			if execution_state > 0 {
8622
 			if execution_state > 0 {
8622
-				fmt.Println("execution_state---------------------", execution_state)
8623
 				if cost_type > 0 {
8623
 				if cost_type > 0 {
8624
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8624
 					db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ? and id = ?", orgID, patient_id).
8625
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
8625
 						Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).

+ 115 - 5
service/patient_service.go Bestand weergeven

687
 }
687
 }
688
 
688
 
689
 func FindPatientWithDeviceByNo(orgID int64, no string, time int64) (patient models.SchedualPatient2, err error) {
689
 func FindPatientWithDeviceByNo(orgID int64, no string, time int64) (patient models.SchedualPatient2, err error) {
690
-	err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
691
-		return db.Preload("DeviceNumber", "org_id = ?", orgID).
692
-			Preload("DeviceZone", "org_id = ?", orgID).
693
-			Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
694
-	}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1 ", orgID, no).First(&patient).Error
690
+
691
+	if orgID != 9882 {
692
+		err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
693
+			return db.Preload("DeviceNumber", "org_id = ?", orgID).
694
+				Preload("DeviceZone", "org_id = ?", orgID).
695
+				Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
696
+		}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1 ", orgID, no).First(&patient).Error
697
+	}
698
+
699
+	if orgID == 9882 {
700
+		err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
701
+			return db.Preload("DeviceNumber", "org_id = ?", orgID).
702
+				Preload("DeviceZone", "org_id = ?", orgID).
703
+				Where("user_org_id = ? AND schedule_date = ? ", orgID, time)
704
+		}).Preload("InfectiousDiseases", "status = 1").Where("user_org_id=? and dialysis_no = ? and status = 1 and  lapseto =1", orgID, no).First(&patient).Error
705
+
706
+	}
707
+
695
 	return
708
 	return
709
+
696
 }
710
 }
697
 
711
 
698
 func FindPatientWithDeviceByPatientId(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
712
 func FindPatientWithDeviceByPatientId(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
5050
 
5064
 
5051
 	return err
5065
 	return err
5052
 }
5066
 }
5067
+
5068
+func GetPatientMapList(user_org_id int64, keyword string) (patient []*models.SfPatients, err error) {
5069
+
5070
+	keyword = "%" + keyword + "%"
5071
+
5072
+	err = XTReadDB().Where("user_org_id = ? and status=1 and lapseto =1 and (name like ? or first_letter like ?)", user_org_id, keyword, keyword).Find(&patient).Error
5073
+
5074
+	return patient, err
5075
+}
5076
+
5077
+func CreatePatientInCount(tx *gorm.DB, patientCount models.SfPatientInCount) error {
5078
+
5079
+	err := tx.Create(&patientCount).Error
5080
+
5081
+	if err != nil {
5082
+		tx.Rollback()
5083
+		return err
5084
+	}
5085
+	return err
5086
+}
5087
+
5088
+func ModifyPatientCount(tx *gorm.DB, hd_count int64, hdf_count int64, hdhp_count int64, hp_count int64, patient_id int64) (models.SfPatients, error) {
5089
+
5090
+	patients := models.SfPatients{}
5091
+
5092
+	err = tx.Model(&patients).Where("id = ?", patient_id).UpdateColumn("hd_count", gorm.Expr("hd_count + ?", hd_count)).Error
5093
+
5094
+	err = tx.Model(&patients).Where("id = ?", patient_id).UpdateColumn("hdf_count", gorm.Expr("hdf_count + ?", hdf_count)).Error
5095
+
5096
+	err = tx.Model(&patients).Where("id=?", patient_id).UpdateColumn("hdhp_count", gorm.Expr("hdhp_count + ?", hdhp_count)).Error
5097
+
5098
+	err = tx.Model(&patients).Where("id=?", patient_id).UpdateColumn("hp_count", gorm.Expr("hp_count + ?", hp_count)).Error
5099
+
5100
+	return patients, err
5101
+}
5102
+
5103
+func UpdatePatientInCount(tx *gorm.DB, hd_count int64, hdf_count int64, hdhp_count int64, hp_count int64, patient_id int64) (models.SfPatients, error) {
5104
+
5105
+	patients := models.SfPatients{}
5106
+
5107
+	err = tx.Model(&patients).Where("id = ?", patient_id).UpdateColumn("hd_count", gorm.Expr("hd_count - ?", hd_count)).Error
5108
+
5109
+	err = tx.Model(&patients).Where("id = ?", patient_id).UpdateColumn("hdf_count", gorm.Expr("hdf_count - ?", hdf_count)).Error
5110
+
5111
+	err = tx.Model(&patients).Where("id=?", patient_id).UpdateColumn("hdhp_count", gorm.Expr("hdhp_count - ?", hdhp_count)).Error
5112
+
5113
+	err = tx.Model(&patients).Where("id=?", patient_id).UpdateColumn("hp_count", gorm.Expr("hp_count - ?", hp_count)).Error
5114
+
5115
+	return patients, err
5116
+}
5117
+
5118
+func GetPatientCountList(user_org_id int64, patient_id int64, page int64, limit int64) (patient []*models.SfPatientInCount, total int64, err error) {
5119
+
5120
+	db := XTReadDB().Model(&patient).Where("status=1")
5121
+
5122
+	offset := (page - 1) * limit
5123
+
5124
+	if patient_id > 0 {
5125
+		db = db.Where("patient_id = ?", patient_id)
5126
+	}
5127
+
5128
+	if user_org_id > 0 {
5129
+		db = db.Where("user_org_id = ?", user_org_id)
5130
+	}
5131
+
5132
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&patient).Error
5133
+
5134
+	return patient, total, err
5135
+}
5136
+
5137
+func CheckPatientCount(id int64) (models.SfPatientInCount, error) {
5138
+
5139
+	patientInCount := models.SfPatientInCount{}
5140
+
5141
+	err = XTWriteDB().Model(&patientInCount).Where("id = ?", id).Updates(map[string]interface{}{"is_check": 1}).Error
5142
+
5143
+	return patientInCount, err
5144
+}
5145
+
5146
+func ReturnCheckPatientCount(id int64) (models.SfPatientInCount, error) {
5147
+
5148
+	patientInCount := models.SfPatientInCount{}
5149
+
5150
+	err = XTWriteDB().Model(&patientInCount).Where("id = ?", id).Updates(map[string]interface{}{"is_check": 2}).Error
5151
+
5152
+	return patientInCount, err
5153
+}
5154
+
5155
+func GetPatientCountById(id int64) (models.SfPatientInCount, error) {
5156
+
5157
+	patientInCount := models.SfPatientInCount{}
5158
+
5159
+	err := XTReadDB().Where("id = ?", id).Find(&patientInCount).Error
5160
+
5161
+	return patientInCount, err
5162
+}

+ 15 - 1
service/sign_service.go Bestand weergeven

2192
 
2192
 
2193
 func GetScheduleListByOrder(user_org_id int64) (list []*models.XtSchedule, err error) {
2193
 func GetScheduleListByOrder(user_org_id int64) (list []*models.XtSchedule, err error) {
2194
 
2194
 
2195
-	err = XTReadDB().Where("user_org_id = ? and schedule_date >=? and status =1 and schedule_date<=?", 10579, 1703260800, 1703347200).Find(&list).Error
2195
+	err = XTReadDB().Where("user_org_id = ? and schedule_date >=? and status =1 and schedule_date<=?", 10579, 1741795200, 1742054400).Find(&list).Error
2196
 	return list, err
2196
 	return list, err
2197
 }
2197
 }
2198
 
2198
 
2485
 
2485
 
2486
 	return
2486
 	return
2487
 }
2487
 }
2488
+
2489
+func CheckSchedule() (schedule []*models.XtSchedule, err error) {
2490
+
2491
+	err = readDb3.Where("user_org_id = 10445 and schedule_date<1741536000").Find(&schedule).Error
2492
+
2493
+	return schedule, err
2494
+}
2495
+
2496
+func UpdateScheduleByIdOneList(id int64, schedule_date int64, schedule_type int64, schedule_week int64, status int64, patient_id int64, partition_id int64, bed_id int64, dialysis_machine_name string, user_org_id int64, mode_id int64) error {
2497
+
2498
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"schedule_date": schedule_date, "schedule_type": schedule_type, "schedule_week": schedule_week, "status": status, "patient_id": patient_id, "partition_id": partition_id, "bed_id": bed_id, "dialysis_machine_name": dialysis_machine_name, "user_org_id": user_org_id, "mode_id": mode_id}).Error
2499
+
2500
+	return err
2501
+}