|
@@ -402,7 +402,7 @@ func UpdatePatientCaseHistory(patient_id int64, record_date int64, user_org_id i
|
402
|
402
|
return err
|
403
|
403
|
}
|
404
|
404
|
|
405
|
|
-func SaveHisPrescription(tx *gorm.DB, prescription *models.HisPrescription) (err error) {
|
|
405
|
+func SaveHisPrescriptionOne(tx *gorm.DB, prescription *models.HisPrescription) (err error) {
|
406
|
406
|
|
407
|
407
|
err = tx.Model(&models.HisPrescription{}).Save(prescription).Error
|
408
|
408
|
if err != nil {
|
|
@@ -413,6 +413,17 @@ func SaveHisPrescription(tx *gorm.DB, prescription *models.HisPrescription) (err
|
413
|
413
|
return
|
414
|
414
|
}
|
415
|
415
|
|
|
416
|
+func SaveHisPrescription(prescription *models.HisPrescription) (err error) {
|
|
417
|
+ tx := writeDb.Begin()
|
|
418
|
+
|
|
419
|
+ if err = tx.Model(&models.HisPrescription{}).Save(prescription).Error; err != nil {
|
|
420
|
+ tx.Rollback()
|
|
421
|
+ return
|
|
422
|
+ }
|
|
423
|
+ tx.Commit()
|
|
424
|
+ return
|
|
425
|
+}
|
|
426
|
+
|
416
|
427
|
func SaveHisPrescriptionTwo(prescription *models.HisPrescription) (err error) {
|
417
|
428
|
|
418
|
429
|
err = writeDb.Model(&models.HisPrescription{}).Save(prescription).Error
|
|
@@ -887,7 +898,7 @@ func GetHisAdminUserDoctors(org_id int64) (doctors []*models.UserAdminRole, err
|
887
|
898
|
return
|
888
|
899
|
}
|
889
|
900
|
|
890
|
|
-func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
|
|
901
|
+func CreateHisDoctorAdviceOne(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
|
891
|
902
|
|
892
|
903
|
err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error
|
893
|
904
|
|
|
@@ -898,6 +909,18 @@ func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo, tx *gorm.DB) (err erro
|
898
|
909
|
return
|
899
|
910
|
}
|
900
|
911
|
|
|
912
|
+func CreateHisDoctorAdvice(s *models.HisDoctorAdviceInfo) (err error) {
|
|
913
|
+
|
|
914
|
+ tx := writeDb.Begin()
|
|
915
|
+ if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
|
|
916
|
+ tx.Rollback()
|
|
917
|
+ return
|
|
918
|
+ }
|
|
919
|
+ tx.Commit()
|
|
920
|
+
|
|
921
|
+ return
|
|
922
|
+}
|
|
923
|
+
|
901
|
924
|
func CreateHisDoctorAdviceTwo(s *models.HisDoctorAdviceInfo) (err error) {
|
902
|
925
|
tx := writeDb.Begin()
|
903
|
926
|
if err = tx.Model(&models.HisDoctorAdviceInfo{}).Save(s).Error; err != nil {
|
|
@@ -909,7 +932,7 @@ func CreateHisDoctorAdviceTwo(s *models.HisDoctorAdviceInfo) (err error) {
|
909
|
932
|
return
|
910
|
933
|
}
|
911
|
934
|
|
912
|
|
-func CreateHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
|
935
|
+func CreateNewHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
913
|
936
|
err = tx.Model(&models.HisPrescriptionProject{}).Save(project).Error
|
914
|
937
|
if err != nil {
|
915
|
938
|
tx.Rollback()
|
|
@@ -917,11 +940,21 @@ func CreateHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (e
|
917
|
940
|
}
|
918
|
941
|
return
|
919
|
942
|
}
|
|
943
|
+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()
|
920
|
950
|
|
921
|
|
-func GetLastHisProject(patient_id int64, user_org_id int64, record_date int64, tx *gorm.DB) (models.HisPrescriptionProject, error) {
|
|
951
|
+ return
|
|
952
|
+}
|
|
953
|
+
|
|
954
|
+func GetLastHisProject(patient_id int64, user_org_id int64, record_date int64, tx *gorm.DB, good_id int64) (models.HisPrescriptionProject, error) {
|
922
|
955
|
|
923
|
956
|
prescriptionProject := models.HisPrescriptionProject{}
|
924
|
|
- err := tx.Where("patient_id = ? and user_org_id = ? and record_date = ? and status=1", patient_id, user_org_id, record_date).Find(&prescriptionProject).Error
|
|
957
|
+ err := tx.Where("patient_id = ? and user_org_id = ? and record_date = ? and status=1 and project_id = ? and type =3", patient_id, user_org_id, record_date, good_id).Find(&prescriptionProject).Error
|
925
|
958
|
if err != gorm.ErrRecordNotFound {
|
926
|
959
|
if err != nil {
|
927
|
960
|
tx.Rollback()
|
|
@@ -940,7 +973,7 @@ func CreateHisProjectThree(project *models.HisPrescriptionProject) (err error) {
|
940
|
973
|
return
|
941
|
974
|
}
|
942
|
975
|
|
943
|
|
-func SaveHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
|
976
|
+func SaveNewHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err error) {
|
944
|
977
|
//err = tx.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error
|
945
|
978
|
if err = tx.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error; err != nil {
|
946
|
979
|
tx.Rollback()
|
|
@@ -949,6 +982,11 @@ func SaveHisProjectTwo(project *models.HisPrescriptionProject, tx *gorm.DB) (err
|
949
|
982
|
return
|
950
|
983
|
}
|
951
|
984
|
|
|
985
|
+func SaveHisProjectTwo(project *models.HisPrescriptionProject) (err error) {
|
|
986
|
+ err = writeDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = ? AND id = ?", project.UserOrgId, project.ID).Updates(map[string]interface{}{"feedetl_sn": project.FeedetlSn, "mtime": time.Now().Unix()}).Error
|
|
987
|
+ return
|
|
988
|
+}
|
|
989
|
+
|
952
|
990
|
func CreateHisPatientTwo(patient *models.VMHisPatient) error {
|
953
|
991
|
err := writeDb.Create(&patient).Error
|
954
|
992
|
return err
|
|
@@ -2639,7 +2677,7 @@ func DeletePrintInfo(id int64) {
|
2639
|
2677
|
writeDb.Model(&models.HisLabelPrintInfo{}).Where("p_project_id = ?", id).Updates(map[string]interface{}{"status": 0})
|
2640
|
2678
|
}
|
2641
|
2679
|
|
2642
|
|
-func CreateHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err error) {
|
|
2680
|
+func CreateNewHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err error) {
|
2643
|
2681
|
if err = tx.Save(&label).Error; err != nil {
|
2644
|
2682
|
tx.Rollback()
|
2645
|
2683
|
return
|
|
@@ -2647,6 +2685,11 @@ func CreateHisLabelRecord(label *models.HisLabelPrintInfo, tx *gorm.DB) (err err
|
2647
|
2685
|
return
|
2648
|
2686
|
}
|
2649
|
2687
|
|
|
2688
|
+func CreateHisLabelRecord(label *models.HisLabelPrintInfo) error {
|
|
2689
|
+ err := writeDb.Save(&label).Error
|
|
2690
|
+ return err
|
|
2691
|
+}
|
|
2692
|
+
|
2650
|
2693
|
func CreateHisLabelRecordTwo(label *models.HisLabelPrintInfo) (err error) {
|
2651
|
2694
|
err = writeDb.Save(&label).Error
|
2652
|
2695
|
return
|